You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2011/03/23 21:51:05 UTC

[jira] [Commented] (WICKET-3551) Using web.xml to render error pages via Wicket yields undesired behavior in Wicket 1.5

    [ https://issues.apache.org/jira/browse/WICKET-3551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010439#comment-13010439 ] 

Martin Grigorov commented on WICKET-3551:
-----------------------------------------

With trunk if I request http://localhost:8080/aaaa I still stay on that url and I see as content:

    * Note how the URL has changed to http://localhost:8080/error/404 (via a 302 redirect). This behavior is not desired. A 404 error page should render without changing the URL that was originally requested, as can be seen in this example.
    * If the application is reconfigured by overriding WebPageRenderer.enableRedirectForStatelessPage() to return false, this solves redirect problem. However, it introduces a new, more serious issue: Wicket is now confused about the depth of the URL and miscalculates the relative paths of resources on the page. For example, the stylesheet reference is now incorrect and doesn't load.

I.e. I can't reproduce it here.

> Using web.xml <error-page> to render error pages via Wicket yields undesired behavior in Wicket 1.5
> ---------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-3551
>                 URL: https://issues.apache.org/jira/browse/WICKET-3551
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.5-RC2
>            Reporter: Matt Brictson
>         Attachments: WICKET-3551-wicket-1.4.tgz, WICKET-3551-wicket-1.5-RC2.tgz
>
>
> In my applications I prefer to use Wicket to render all error pages, including my 404 "not found" page. This allows me to reuse a shared page template afforded by Wicket to create my error pages (i.e. by extending a BasePage), rather than using copy and paste to maintain static error page HTML files.
> I have been doing this as follows:
> web.xml:
>  <error-page>
>    <error-code>404</error-code>
>    <location>/error/404</location>
>  </error-page>
> Now, so long as I have an appropriate bookmarkable page mounted on the "/error/404" path, the servlet container will render my page whenever a 404 "not found" scenario is encountered.
> This works great in Wicket 1.4.x.
> However in Wicket 1.5 (RC2 and the latest SNAPSHOT as of this writing), two problems occur:
> 1. By default, Wicket 1.5 automatically performs a 302 redirect before rendering the error page. This changes the URL from the invalid one (i.e. the one that generated the 404) to the mounted path (/error/404 in this example). This is not the desired behavior for a 404 error page; the original URL requested by the user should be maintained.
> 2. If I attempt to work around the issue by overriding WebPageRenderer.enableRedirectForStatelessPage() to return false, the problem gets worse. Now the URL doesn't change, which is good. But Wicket gets confused about the depth of the request URL path: it seems to calculate relative URLs based on the mounted path rather than the URL that was requested. This causes all relative resources on the page (e.g. stylesheet references) to be miscalculated and break.
> I will attach two quickstarts: one showing this configuration working in 1.4, and another showing the same setup failing as described above in 1.5-RC2.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira