You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by André Warnier <aw...@ice-sa.com> on 2011/01/26 17:04:55 UTC
Re: [OT] 400 error when a request does not map to a context
Konstantin Kolinko wrote:
> 2011/1/25 Christopher Schultz <ch...@christopherschultz.net>:
>> 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: [OT] 400 error when a request does not map to a context
Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/1/26 André Warnier <aw...@ice-sa.com>:
> 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 ?
>
It is just the context that is mapped to path "". Naming it "ROOT" is
a Tomcat convention.
Technically, you can put <Context> element into server.xml and use any
name there.
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org