Response Redirection
- Response code 302: Resource Temporarily Moved
- Informs client the requested resource is not at the
requested URL.
- Actual URL is given in the response header.
- Most browsers follow the new link without informing user.
- Another use of 302 besides intended purpose: link tracking, or
keeping track of where visitors are going from your site.
- Do not directly encode links from your site.
- Instead, encode links to go to your Servlet where they are logged.
- Then send response 302 back to requestor with a real link to the
site.
- Technique used so often a convenience method sendRedirect()
is included in HttpServletResponse.