2012-12-25 4 views
2

OCPsoft Rewrite을 버전 1.0.5.Final에서 1.1.0.Final으로 업데이트하면 다음 규칙이 더 이상 작동하지 않으며 수정 방법을 모르겠습니다. 그것은 :1.0.5에서 1.1.0으로 업데이트 한 후 OCPsoft 다시 쓰기 규칙이 더 이상 작동하지 않습니다.

구성 문자열은 이제 문자 그대로 다음과 같습니다 재 작성 changelog에서

.addRule(
    Join.path("/{i}/{d}") 
     .where("i").matches("[-_a-zA-Z0-9~*]{8}") 
     .where("d").matches("[-_a-zA-Z0-9~*]{32}") 
     .to("/resources/html/user/doSomething.html?i={i}&d={d}") 
) 

당신이 나를 도울 도울 수있는 하나의 포인트가있다. 정규 표현식은 통해 구성해야합니다> 매개 변수와 같은 : .defineRule().when(Path.matches("/{*}").where("*").matches(".*"))

내가 얻을 예외 하나를 다음입니다 :

Exception starting filter OCPsoft Rewrite Filter 
    java.lang.NullPointerException 
     at org.ocpsoft.rewrite.servlet.config.rule.Join.where(Join.java:199) 
     at org.ocpsoft.rewrite.servlet.config.rule.Join.where(Join.java:47) 
     at com.myapp.util.RewriteConfigurationProvider.getConfiguration(RewriteConfigurationProvider.java:39) 
     ... 
+0

추 신. 늦게 답변 죄송합니다 :) 휴일! – Lincoln

답변

2

다음은 난 그냥이 절을 가입 순서를 변경했다, 속임수를 썼는지 :이 문제를 파악하고 재 작성 지원 포럼 내 질문에 대답 링컨에

.addRule(
    Join.path("/{i}/{d}") 
     .to("/resources/html/user/doSomething.html") 
     .where("i").matches("[-_a-zA-Z0-9~*]{8}") 
     .where("d").matches("[-_a-zA-Z0-9~*]{32}") 
     .withRequestBinding(); 
) 

감사합니다.

1

흠 .. 버그가 생겼는데, 내가하려고합니다 이를 재현 할 수 있지만 대상 URL에 {i}{d}을 다시 정의 할 필요는 없습니다.

.addRule(
    Join.path("/{i}/{d}") 
    .where("i").matches("[-_a-zA-Z0-9~*]{8}") 
    .where("d").matches("[-_a-zA-Z0-9~*]{32}") 
    .to("/resources/html/user/doSomething.html").withRequestBinding(); 
) 

당신이 그렇게하면 내가 추측하고있어, 문제는 멀리 갈 것입니다 : 당신이 요청과 같이, 바인딩을 사용하는 경우 자동으로 당신을 위해 처리합니다 가입. 이전 .html에 대한 요청을 새 URL로 리디렉션하려면 .withInboundCorrection()을 사용할 수도 있습니다. 당신은 여전히이 문제가있는 경우

, 지원 포럼에 게시하고 우리는 당신이 잘하면 문제가되지 않습니다, 문제가 있었다

죄송합니다 :) 해결해 드리겠습니다 더 이상 :)