Further to this, the W3 recognized the fact that many clients did not adhere to the specification for 302 and 303, so they introduced 307 in HTTP 1.1--which was intended to be followed more strictly. The original method must be used when following a re-direct, but when a non-idempotent method is used (i.e.: POST), the client must obtain confirmation from the user before following the re-direct. Only handled by HTTP 1.1 capable browsers only. :-(

At 20:50 2003-02-06 -0800, you wrote:
It isn't against the HTTP specification to sendRedirect (which in Tomcat
will result in a 302 response).  It's just that very few (if any) browsers
actually implement the spec in this area.  Most of them will respond by
doing a GET to the new URL, instead of a POST (which is what the RFC says to
do).

If you wanted to be completely safe with broken browsers, then you should
also add the POSTed parameters to the query string in your example below.

"Julius Davies" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Hello, Tomcat User's List,

There was some talk a few days ago about "response.sendRedirect()" after a
POST request being against the HTTP specification...  is that really true?
For example, would this be a problem?  IE and Netscape seem to do what I
want!


// This is common trick I use after a form submission to
// help make navigation easier for the user, and to help
// avoid dual-submission of the same form.
//
// "request" is an HttpServletRequest and "response"
// is an HttpServletResponse.

if ( "POST".equalsIgnoreCase( request.getMethod() ) )
{
   StringBuffer buf = new StringBuffer();
   buf.append( request.getRequestURI() );
   buf.append( "?" );
   buf.append( request.getQueryString() );
   response.sendRedirect( buf.toString() );
   return;
}


I would appreciate any advice anyone might have.


yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385

This email represents my personal opinions and concerns and not those of
CUCBC.




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Sean Dockery
[EMAIL PROTECTED]
Certified Java Web Component Developer
Certified Delphi Programmer
SBD Consultants
http://www.sbdconsultants.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to