com.veriplace.web
Class DefaultRedirector

java.lang.Object
  extended by com.veriplace.web.DefaultRedirector
All Implemented Interfaces:
Redirector

public class DefaultRedirector
extends java.lang.Object
implements Redirector

Default implementation of Redirector. Sends a regular HTTP redirect response, using code 302 for HTTP 1.0 or 303 for HTTP 1.1.

The choice of status code is based on the HTTP 1.0 specification, which states:

If the 302 status code is received in response to a request using the POST method, 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: When automatically redirecting a POST request after receiving a 302 status code, some existing user agents will erroneously change it into a GET request.

In practice, most HTTP 1.0 User Agents handle 302 redirects after a POST as a GET. However, the HTTP 1.1 specification added a 303 redirect specification for this scenario and some HTTP 1.1 User Agents do not handle 302 redirects "conventionally".

Therefore, applications should send a different redirect code for 1.1 User Agents.

Since:
2.0

Constructor Summary
DefaultRedirector()
           
 
Method Summary
 void sendRedirect(HttpServletRequest request, HttpServletResponse response, java.lang.String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRedirector

public DefaultRedirector()
Method Detail

sendRedirect

public void sendRedirect(HttpServletRequest request,
                         HttpServletResponse response,
                         java.lang.String url)
                  throws java.io.IOException
Specified by:
sendRedirect in interface Redirector
Throws:
java.io.IOException