Quantcast

Error page on missing image resource

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Error page on missing image resource

Roman Dircenkov
I have issued that when an image or other static resource for rendering page is requested and not found by webapp server, my wicket appication is trying to render an error page configured in application. I would like an error page to NOT be instantiated when lookup for image or other static resource fails.

We have configured an error page as follows

in Application init:
mount(new HybridUrlCodingStrategy("/404", NotFoundErrorPage.class));

web.xml
<filter-mapping>
        <filter-name>wicket.ib-frontend</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
</filter-mapping>

<error-page>
     <error-code>404</error-code>
     <location>/404</location>
</error-page>

also in wicket filter
<init-param>
  <param-name>ignorePaths</param-name>
  <param-value>static/,external/,...</param-value>
</init-param>

When wicket filter processing request for /static/.../image.png it indeed identifies "static" part in requestPath, and doing just filter.doChain, after that resource is not found by DefaultServlet and redispatched to /404 as configured in web.xml. After redispatching WicketFilter comes again in the stack with resourcePath set to 404 this time which is now not identified as ignorePath part and looks for an error page.

Do I miss something, or this is a correct behaviour? Is there any way to avoid this?
Loading...