This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 60800
    
  65

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: 60800
    
  65

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: 60800
    
  65

If they do the same thing, things will be the same. But nothing says that they do the same thing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different error pages for 404
 
Similar Threads
creating user accounts
Facing problem while tomcat 5.5 serves css, and jsp
HttpServletResponse.sendError
getting error code in pagenotfound.jsp
About Exception, Throwable and log files.