I have such a problem.
I need to show a customized error page when you get a 404 HTTP error. I am using Wicket 1.4 and Tomcat6. I implemented these things in web.xml for example
<filter-name>wicket.filter</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>
and fits into this code in my WebApplication application:
mount(new HybridUrlCodingStrategy("/404", PageNotFound.class));
PageNotFound class isErrorPage set true, isVersioned false and
@Override
protected void configureResponse() {
super.configureResponse();
getWebRequestCycle().getWebResponse().getHttpServletResponse().setStatus(HttpServletResponse.SC_NOT_FOUND);
}
Now the problem is that when I enter some kind of invalid URL, for example http://localhost:8080/myApp-war/invalidUrl
, I can see my PageNotFound. But when I enter something like http://localhost:8080/myApp-war/?wicket:bookmarkablePage=:com.mypackage.invalidUrl
, I just get a blank, clear page without any data.
, tomcat "HTTP Status 404 -/myApp-war/invalidUrl"
: "HTTP Status 404 - "
? , <error-page>
? , .