tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: related to bad url encoding?...
Date Tue, 22 Feb 2011 22:01:49 GMT
alex wrote:

> so, what do I do if I need to show error in this scenario and I run 
> standalone tomcat?

It seems to me that by the 400 status code, the error is already shown, correctly.
Tomcat is doing the minimum, but it is doing it according to the RFC.

HTTP RFC 2616 says:

10.4 Client Error 4xx

The 4xx class of status code is intended for cases in which the client seems to have erred.
Except when responding to a HEAD request, the server SHOULD include an entity containing
an explanation of the error situation, and whether it is a temporary or permanent condition.
These status codes are applicable to any request method. User agents SHOULD display any 
included entity to the user.

(Notice "SHOULD", not "MUST").

10.4.1 400 Bad Request
The request could not be understood by the server due to malformed syntax.
The client SHOULD NOT repeat the request without modifications.

(This thus seems to be the appropriate status code. After all, the client /did/ send a 
malformed URL.)

(In any case, none of the other ones seems to fit.)

10.4.2 401 Unauthorized
10.4.3 402 Payment Required
10.4.4 403 Forbidden
10.4.5 404 Not Found
10.4.6 405 Method Not Allowed
10.4.7 406 Not Acceptable
10.4.8 407 Proxy Authentication Required
10.4.9 408 Request Timeout
10.4.10 409 Conflict
10.4.11 410 Gone
10.4.12 411 Length Required
10.4.13 412 Precondition Failed
10.4.14 413 Request Entity Too Large
10.4.15 414 Request-URI Too Long
10.4.16 415 Unsupported Media Type
10.4.17 416 Requested Range Not Satisfiable
10.4.18 417 Expectation Failed


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

View raw message