This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Different error pages for 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Different error pages for 404" Watch "Different error pages for 404" New topic
Author

Different error pages for 404

Peter Kovac
Ranch Hand

Joined: Aug 08, 2010
Posts: 42
Hi,

My question is why there are different error pages for the same 404 status.

E.g:

http://my.server.com -> returns empty page / no content / status=404
http://my.server.com/invalid_app_context -> returns empty page / no content / status=404
http://my.server.com/app_context/INVALID -> returns the usual error report page / status=404


I've an application installed in app_context in the last request but the URL is wrong for it.

Thanks,
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

The first two will be handled by whatever's installed as the ROOT web app. So no surprise that they're different from the last, which is handled by your web app.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Peter Kovac
Ranch Hand

Joined: Aug 08, 2010
Posts: 42
Bear Bibeault wrote:The first two will be handled by whatever's installed as the ROOT web app. So no surprise that they're different from the last, which is handled by your web app.

Thanks. Do you how can I configure the root web app? Where's it located? My WEB-INF contains only my application.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

Create a web app with a context path of ROOT.
Peter Kovac
Ranch Hand

Joined: Aug 08, 2010
Posts: 42
Thanks I found the DefaultServlet as the root app.
But is there a reason why you have different behavior between deployed applications and root by default? I mean should they just show the same error page if no customization is done?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

If they do the same thing, things will be the same. But nothing says that they do the same thing.
 
Have you checked out Aspose?
 
subject: Different error pages for 404
 
It's not a secret anymore!