Behavior of sendRedirect() in V4.0 and V5.0
 Technote (FAQ)
 
Problem
Explanation of the differences in the default behavior of sendRedirect() in all releases of WebSphere® Application Server V4.0 and V5.0.
 
Solution
The following examples assume that your context root is "/webapp/examples"

Example 1:

When requesting the following:

http://localhost/webapp/examples/subdir/hello.jsp

Hello.jsp does a sendRedirect()as shown below (this is a relative sendRedirect that begins with a "/"):

response.sendRedirect ("/me.jsp");

  1. For WebSphere Application Server V5.0 (all releases)

    By default, in all releases of V5.0, this results in your client being redirected to the following URL:

    http://localhost/me.jsp

    However, if your Java™ Virtual Machine (JVM) system property com.ibm.websphere.sendredirect.compatibility is set to true, this will result in your client being redirected to the following URL:

    http://localhost/webapp/examples/me.jsp

  2. For WebSphere Application Server V4.0 (all releases)

    By default, in all releases of V4.0, this results in the client being redirected to the following URL:

    http://localhost/webapp/examples/me.jsp

    However, if your JVM system property com.ibm.websphere.sendredirect.compliance is set to true, this will result in your client being redirected to the following URL:

    http://localhost/me.jsp

Example 2:

When requesting the following:
http://localhost/webapp/examples/subdir/hello.jsp


Hello.jsp does a sendRedirect() as shown below (this is a relative sendRedirect that does not begin with a "/"):

response.sendRedirect ("me.jsp")

All releases of WebSphere Application Server V4.0 and V5.0 will make this relative to the current URL and redirect the client to the following URL (notice that "subdir" is included in the redirected URL):
http://localhost/webapp/examples/subdir/me.jsp

 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Servlet Engine/Web Container
Operating system(s): HP-UX
Software version: 4.0
Software edition:
Reference #: 1084187
IBM Group: Software Group
Modified date: Feb 28, 2005