tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: [OT] 400 error when a request does not map to a context
Date Wed, 26 Jan 2011 16:04:55 GMT
Konstantin Kolinko wrote:
> 2011/1/25 Christopher Schultz <>:
>> Should I expect that a request that doesn't map to a running context
>> should return a 400 error? I would have expected a 404 Not Found.
>> Tomcat 6.0.29 and Tomcat 7.0.6 both behave this way.
>> With no ROOT context deployed, make a request to something that doesn't
>> map to a deployed webapp, like "/nocontext" or even "/" and you'll get a
>> 400 Bad Request.
> It is a known issue, but I think that it is only of concern when the
> ROOT webapp is temporarily unavailable, e.g. being redeployed.
> In normal operation people do not see it.
> Do you want to propose a patch? To return 404 instead of 400 when
> request cannot be matched.
> 1) I think that it is somewhere around the Mapper class
> 2) I think that it is not possible to return well known green "page
> 404" html page (as valve is not available), but at least we can give
> blank response with correct HTTP result code (like Http11Processor and
> others do).
>> HTTP Spec says 400 means "The request could not be understood by the
>> server due to malformed syntax" but the request is perfectly valid.

By the way, having had my curiosity triggered by what Chris was reporting, I scanned the 
Servlet Spec 3.0 for mentions of the "ROOT" (default) context, and could not really find 
much of relevance.
Namely, it does not mention that one is required.  Is it ?
And it also does not mention webapps/ROOT as being a default context, or even as 
corresponding necessarily to the "top of the URL space".
So, my question is : is "webapps/ROOT" purely a Tomcat thing, or did I miss something in 
the Servlet Spec ?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message