rewrite trailing slash and 3.3.0 snapshot

Splash Forums PrettyFaces Users rewrite trailing slash and 3.3.0 snapshot

Tagged: ,

This topic contains 13 replies, has 4 voices, and was last updated by  Christian Kaltepoth 5 years, 9 months ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #17935

    RedShadow
    Participant

    Hi,

    I have a similiar problem with this code on version 3.3.0. I believe there are two issues that contribute to this:

    First issue is that setting of the rewriteOccurred flag happens in the finally clause, which won’t be set until the request has completed through its series of forwards.

    This would have been alright if the subsequent forward will not pass through the PrettyFilter. But if it does, then the second issue, wherein the URL to test for the rewrite rule matching is retrieved from the PrettyContext will always return the url of the original request. This causes the rewrite rule to forward to the target URL of the original request over and over.

    hope this analysis helps.

    #20972

    RedShadow
    Participant

    today i faces a strange error…

    when i call “/admin” it gets rewritten by “/admin/” and the page is rendered.

    but when i call “/admin/user” it gets not rewritten, it just shows me an error.

    Here is my rewrite rule:

    <rewrite match=”^((?!.*.w*).)*$” trailingSlash=”append” toCase=”lowercase” redirect=”chain”/>

    My dependency:

    <dependency>

    <groupId>com.ocpsoft</groupId>

    <artifactId>prettyfaces-jsf2</artifactId>

    <version>3.3.0-SNAPSHOT</version>

    </dependency>

    And this is the error:

    WARNUNG: StandardWrapperValve[default]: PWC1406: Servlet.service() for servlet default threw exception

    com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at com.blazebit.web.cms.filter.LoginRedirectFilter.doFilter(LoginRedirectFilter.java:46)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)

    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)

    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)

    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)

    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

    at java.lang.Thread.run(Thread.java:619)

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 30 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 40 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 50 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 60 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 70 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 80 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 90 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 100 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 110 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 120 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 130 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 140 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 150 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 160 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 170 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 180 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 190 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 200 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 210 more

    Caused by: com.ocpsoft.pretty.PrettyException: Error occurred during canonicalization of request <[/admin/user]>

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:226)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:71)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:785)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 220 more

    Caused by: javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20

    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:772)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:649)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:483)

    at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:454)

    at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:350)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:300)

    at com.ocpsoft.pretty.PrettyFilter.rewrite(PrettyFilter.java:220)

    … 230 more

    EDIT:

    I just realised that this only happens with redirect=”chain”, does anyone know what the problem is with that? The expected behaviour is that i dont get redirected but it renders the view which i would expect. Here an example, when i call “/admin/user” i don’t want to get redirected(at least not if it is not necessary) but i want the view to be displayed which i would reach when i call “/admin/user/”

    EDIT2:

    The redirect=”chain” attribute seems not to work correctly. I tried to deny the direct access to pages by rendering a page not found site and with chaining this would be very elegant.

    <rewrite match=”^/admin/.*.xhtml$” substitute=”/admin/pageNotFound.xhtml” redirect=”chain”/>

    Expected behaviour: Call “/admin/admin.xhtml” Display “/admin/pageNotFound.xhtml”

    Actual behaviour: Same exception as the one at the top.

    Summary: the attribute redirect with the value chain is not working correctly. Is this a bug or have i missused the functionallity?

    #20973

    Could you please post your entire pretty-config.xml? thanks.

    #20974

    RedShadow
    Participant

    <?xml version=”1.0″ encoding=”UTF-8″?>

    <pretty-config xmlns=”http://ocpsoft.com/prettyfaces/3.2.0&#8243;

    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;

    xsi:schemaLocation=”http://ocpsoft.com/prettyfaces/3.2.0

    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.2.0.xsd“>

    <rewrite match=”^((?!.*.w*).)*$” trailingSlash=”append” toCase=”lowercase” redirect=”chain”/>

    <rewrite match=”^/admin/.*.xhtml$” substitute=”/admin/pageNotFound.xhtml” redirect=”chain”/>

    <url-mapping id=”cmsStart”>

    <pattern value=”/admin/” />

    <view-id>#{authentificationBean.getViewPath}</view-id>

    </url-mapping>

    <!– Index –>

    <url-mapping id=”moduleIndex1″>

    <pattern value=”/admin/#{indexModuleBean.moduleName}/” />

    <view-id>#{indexModuleBean.getViewPath}</view-id>

    <action>#{indexModuleBean.standardEntriesPerPage}</action>

    <action>#{indexModuleBean.standardPage}</action>

    </url-mapping>

    <url-mapping id=”moduleIndex2″>

    <pattern value=”/admin/#{indexModuleBean.moduleName}/index/” />

    <view-id>#{indexModuleBean.getViewPath}</view-id>

    <action>#{indexModuleBean.standardEntriesPerPage}</action>

    <action>#{indexModuleBean.standardPage}</action>

    </url-mapping>

    <url-mapping id=”moduleIndex3″>

    <pattern value=”/admin/#{indexModuleBean.moduleName}/index/#{indexModuleBean.entriesPerPage}/” />

    <view-id>#{indexModuleBean.getViewPath}</view-id>

    <action>#{indexModuleBean.standardPage}</action>

    </url-mapping>

    <url-mapping id=”moduleIndex4″>

    <pattern value=”/admin/#{indexModuleBean.moduleName}/index/#{indexModuleBean.entriesPerPage}/#{indexModuleBean.page}/” />

    <view-id>#{indexModuleBean.getViewPath}</view-id>

    </url-mapping>

    <!– Edit, Delete, Detail, Add –>

    <url-mapping id=”moduleEdit”>

    <pattern value=”/admin/#{editModuleBean.moduleName}/edit/#{editModuleBean.entryId}/” />

    <view-id>#{editModuleBean.getViewPath}</view-id>

    </url-mapping>

    <url-mapping id=”moduleDelete”>

    <pattern value=”/admin/#{deleteModuleBean.moduleName}/delete/#{deleteModuleBean.entryId}/” />

    <view-id>#{deleteModuleBean.getViewPath}</view-id>

    </url-mapping>

    <url-mapping id=”moduleDetail”>

    <pattern value=”/admin/#{detailModuleBean.moduleName}/edit/#{detailModuleBean.entryId}/” />

    <view-id>#{detailModuleBean.getViewPath}</view-id>

    </url-mapping>

    <url-mapping id=”moduleAdd”>

    <pattern value=”/admin/#{addModuleBean.moduleName}/add/” />

    <view-id>#{addModuleBean.getViewPath}</view-id>

    </url-mapping>

    </pretty-config>

    #20975

    I think the problem has something to do with your pattern:

    <rewrite match="^/admin/.*.xhtml$" substitute="/admin/pageNotFound.xhtml" redirect="chain"/>

    It looks like your substitute is also matched by the pattern of the rule. If the pattern matches the first time the request will be rewritten and forwarded. But then the forwarded request matches another time, so it is forwarded again. And so on and so on.

    You should either change your pattern or substitute to get our of this endless loop.

    #20976

    RedShadow
    Participant

    I have already thought about this, but i would ruin my dir structure. Could i use something like ?!(pageNotFound) instead of .* to get this work. I don’t know how build this pattern to don’t get an endless loop.

    #20977

    Yes. My recommendation would be to test the regex in java first, then port it to the prettyfaces config. But in theory, yes. Using a regex lookahead should fix your problem.

    #20978

    You could take a look at this post for a working example of a “everything but X” expression.

    #20982

    RedShadow
    Participant

    I have tested the expression now and it works, the problem is still only with redirect=”chain”.

    <rewrite match=”^/admin/((?!pageNotFound).)*.xhtml$” substitute=”/admin/pageNotFound.xhtml” redirect=”chain”/>

    Without chain i get redirected and the page is rendered to me. Is there maybe a problem with chain then?

    #20983

    Could you perhaps build a small example application that reproduces this? Then I could debug what is going wrong there. Building some simple app shouldn’t take longer then 5 minutes if you use my archetypes:

    https://github.com/chkal/prettyfaces-archetypes/wiki

    Thanks..

    #20984

    RedShadow
    Participant

    Reproducing is not really possible, i don’t why. In the end the i had to face the problem that the prettyfaces servlet gets access to the request first and so it also gets the submitted form requests first. A rule like this ruins the process and some actions does not work correctly anymore.

    I solved this problem now with a servlet filter, but if there is a working solution for such problems i would be happy to be informed about it.

    Thanks

    #20987

    First, what is the problem you are still experiencing with chain?

    Second, am I correct in assuming that you are using this mapping to try to secure your admin .xhtml files?

    There are better ways of doing that then by using PrettyFaces, since we are not really designed to be a security tool at this point (PrettyFaces 4 will make such things much easier.)

    Seam Security comes to mind, or something like that.

    Also, if you just map your faces servlet to .xhtml, .xhtml files are automatically secured.

    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    #20991

    weljoweb
    Participant

    Hi,

    I solved our problem by following ChKal’s advise to create a rewrite rule that won’t match on subsequent request. In our case I included the query parameter as part of the rewrite match rule, which will be replaced by another query parameter name on the substitute value. Note the following behavior though that the original request path info is still being used to test for subsequent rewrites

    e.g.

    <rewrite match=”/catalog/subcatalog.jsp?(.)folder_id=([0-9]*)”

    outbound=”false” substitute=”/subcatalog?subcat=$2″

    redirect=”chain” />

    Browser Request: /catalog/subcatalog.jsp?folder_id=12345

    originalUrl evaluates to: /catalog/subcatalog.jsp?folder_id=12345

    newUrl evaluates to: /subcatalog?folderid=12345

    The request is forwarded to newUrl: /subcatalog?subcat=12345

    Forwarded Request: /catalog/subcatalog?folderid=12345

    originalUrl evaluates to: /catalog/subcatalog.jsp?subcat=12345

    ==> The original path is combined with the new query parameter. This is because PrettyContext has been initialized and will no longer be created for subsequent chain processing so the requestURL will always be the original path.

    #20992

    @weljoweb: Thanks for your analysis!

    Perhaps we could find a way to prevent theses endless forwards. I created a ticket to track this:

    http://code.google.com/p/prettyfaces/issues/detail?id=121

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.

Comments are closed.