'How should I handle 404 error for resources in wicket?

I have an ExamplePage written in wicket 7.18.0 and I have some images in that page. How should I handle those images if it is returning 404 error? I would like to keep the page functional though the images are responding with 404 error.

Currently, I followed examples in https://cwiki.apache.org/confluence/display/WICKET/Error+Pages+and+Feedback+Messages and created an ErrorPage for error-code 404. Though user can view the ExamplePage without images, the server will respond user with ErrorPage when they are getting the images together with the ExamplePage.

From user side, they can view http://localhost:8080/ExamplePage?0 successfully, but then I lost the latest page number. As at background, the server is responding user with http://localhost:8080/ErrorPage?1 due to the 404 image. All the Links in ExamplePage are not functioning, it will just refresh the same page and redirect me to http://localhost:8080/ExamplePage?2 again.

Is it possible to separate 404 error location for html and other resources e.g. images in web.xml? Or are there any suggestions?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source