tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Fiol Bonnín <fiol.bon...@terra.es>
Subject Re: HTTP Error 302
Date Fri, 21 Nov 2003 17:14:01 GMT
Hi Günter,

302 is NOT an error. It is a "Found" message. It means: You can access 
the resource. Go to Location and fetch it.

RFC 2616 says:

10.3.3 302 Found

   The requested resource resides temporarily under a different URI.
   Since the redirection might be altered on occasion, the client SHOULD
   continue to use the Request-URI for future requests.  This response
   is only cacheable if indicated by a Cache-Control or Expires header
   field.

   The temporary URI SHOULD be given by the Location field in the
   response. Unless the request method was HEAD, the entity of the
   response SHOULD contain a short hypertext note with a hyperlink to
   the new URI(s).

   If the 302 status code is received in response to a request other
   than GET or HEAD, the user agent MUST NOT automatically redirect the
   request unless it can be confirmed by the user, since this might
   change the conditions under which the request was issued.

      Note: RFC 1945 <http://www.faqs.org/rfcs/rfc1945.html> and RFC 2068 <http://www.faqs.org/rfcs/rfc2068.html>
specify that the client is not allowed
      to change the method on the redirected request.  However, most
      existing user agent implementations treat 302 as if it were a 303
      response, performing a GET on the Location field-value regardless
      of the original request method. The status codes 303 and 307 have
      been added for servers that wish to make unambiguously clear which
      kind of reaction is expected of the client.



In Tomcat (or any other servlet container), you can achieve a 302 
message by using response.sendRedirect(URI). And AFAIK, this is the only 
"sane" way this happens.

Of course, you can setResponseCode(302) or something like that, and 
addHeader to add the Location header. But I would call that insanity ;-)

Yours,

Antonio Fiol

Günter Kukies wrote:

>Hi,
>
>what are the common reasons, that tomcat 4.1 is returning a HTTP 302 error page?
>
>Thanks for your answere
>
>Günter
>  
>


Mime
View raw message