02/28/2005
 

com.epicentric.common.website
Class RedirectUtils

java.lang.Object
  |
  +--com.epicentric.common.website.RedirectUtils

Deprecated. as of 7.0, to be removed in 9.0 or later

public class RedirectUtils
extends Object

Utility class for handling HTTP and Servlet redirect and forward actions

Since:
4.0

Constructor Summary
RedirectUtils()
          Deprecated.  
 
Method Summary
static void forward(javax.servlet.jsp.PageContext pageContext, String path)
          Deprecated. This method is similar to WebsiteUtils.sendRedirect, but results in a server-side redirect rather than a client-side, HTTP-header-based one.
static String getAlternativeHost(javax.servlet.http.HttpServletRequest request)
          Deprecated. Looks up the alternative host for a particular request based on the XML mapping file.
static String getAlternativeHost(String oldHost)
          Deprecated. Looks up the alternative host for a particular host (domain) based on the XML mapping file.
static int getAlternativePort(javax.servlet.http.HttpServletRequest request)
          Deprecated. Looks up the alternative port for a particular request based on the XML mapping file.
static int getAlternativePort(String oldHost, int oldPort)
          Deprecated. Looks up the alternative port for a particular host (domain) based on the XML mapping file.
static String getAlternativeProtocol(javax.servlet.http.HttpServletRequest request)
          Deprecated. Looks up the alternative protocol for a particular request based on the XML mapping file.
static String getAlternativeProtocol(String oldHost, String oldProtocol)
          Deprecated. Looks up the alternative protocol for a particular host (domain) based on the XML mapping file.
static String getHostName(javax.servlet.http.HttpServletRequest request)
          Deprecated. Wrapper method for HttpServletRequest.getHeader("Host") which converts possible "host:port" formatted hostnames into simple "host" formatted hostnames.
static String getServerBase(javax.servlet.http.HttpServletRequest request)
          Deprecated. Looks up the alternative server base (just the protocol, port number, and server name, no portal Http root) for a particular request based on the XML mapping file.
static String getServerBaseURL(javax.servlet.http.HttpServletRequest request)
          Deprecated. Looks up the alternative server base URL for a particular request based on the XML mapping file.
static void printRedirect(Writer out, String url)
          Deprecated. Writes a meta-refresh tag to the given writer.
static void sendRedirect(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, String path)
          Deprecated. Provides Websphere (and official JSDK 2.1 spec) support for redirects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedirectUtils

public RedirectUtils()
Deprecated. 
Method Detail

forward

public static void forward(javax.servlet.jsp.PageContext pageContext,
                           String path)
                    throws IOException
Deprecated. 
This method is similar to WebsiteUtils.sendRedirect, but results in a server-side redirect rather than a client-side, HTTP-header-based one. Where sendRedirect calls through to HttpServletResponse.sendRedirect, this method calls through to RequestDispatcher.forward. These forwards have the advantage of maintaining the exact state of the original HttpServletRequest object, so POST operations can be conditionally forwarded without the loss of any form data.
NOTE: Unlike sendRedirect, this method currently requires a RELATIVE path!!!
Parameters:
req - The request object for the page
res - The response object for the page
path - The RELATIVE path to the next requested URL (may include query parameters)

sendRedirect

public static void sendRedirect(javax.servlet.http.HttpServletRequest req,
                                javax.servlet.http.HttpServletResponse res,
                                String path)
                         throws IOException
Deprecated. 
Provides Websphere (and official JSDK 2.1 spec) support for redirects. This method has been rewritten to support multi-homed Vignette Portal instances. It now constructs absolute URLs for the redirect by querying the ServletRequest rather than properties.txt, so relative URLs will no longer necessarily get rewritten to whatever host is specified in properties.txt. Note that if a valid absolute URL is passed into this method, that will be used for the redirect regardless of what the ServletRequest or properties.txt indicates. If the old behavior of this routine is required, an XML file can be specified by a new property in properties.txt called portal.http.redirectmap. See the sample properties.txt and redirect_map.xml for more details.
Parameters:
req - The request object for the page
res - The response object for the page
path - The absolute or relative path to the next requested URL (may include query parameters)
See Also:
RedirectUtils.printRedirect(Writer out, String url)

getHostName

public static String getHostName(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Wrapper method for HttpServletRequest.getHeader("Host") which converts possible "host:port" formatted hostnames into simple "host" formatted hostnames. This method queries HTTP_HOST, which always comes from the browser client, whereas HttpServletRequest.getServerName queries SERVER_NAME, which comes from the webserver configuration. This method should always be used instead of request.getServerName to ensure correct behavior for Entitlements, sendRedirect, and other internal systems.
Parameters:
req - The request object for the page

getAlternativeProtocol

public static String getAlternativeProtocol(String oldHost,
                                            String oldProtocol)
Deprecated. 
Looks up the alternative protocol for a particular host (domain) based on the XML mapping file.
Parameters:
oldHost - the host from the request that this protocol is for
oldProtocol - the current protocol, used as the default result
Returns:
the alternative protocol or the oldProtocol if no mapping is defined

getAlternativeProtocol

public static String getAlternativeProtocol(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Looks up the alternative protocol for a particular request based on the XML mapping file.
Parameters:
request - the request that requires interpretation
Returns:
the alternative protocol or the current protocol if no mapping is defined

getAlternativePort

public static int getAlternativePort(String oldHost,
                                     int oldPort)
Deprecated. 
Looks up the alternative port for a particular host (domain) based on the XML mapping file.
Parameters:
oldHost - the host from the request that this port is for
oldPort - the current port, used as the default result
Returns:
the alternative port or the oldPort if no mapping is defined

getAlternativePort

public static int getAlternativePort(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Looks up the alternative port for a particular request based on the XML mapping file.
Parameters:
request - the request that requires interpretation
Returns:
the alternative port or the current port if no mapping is defined

getAlternativeHost

public static String getAlternativeHost(String oldHost)
Deprecated. 
Looks up the alternative host for a particular host (domain) based on the XML mapping file.
Parameters:
oldHost - the host from the request that the replacement is for
Returns:
the alternative host or the oldHost if no mapping is defined

getAlternativeHost

public static String getAlternativeHost(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Looks up the alternative host for a particular request based on the XML mapping file.
Parameters:
request - the request that requires interpretation
Returns:
the alternative host or the current ost if no mapping is defined

getServerBaseURL

public static String getServerBaseURL(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Looks up the alternative server base URL for a particular request based on the XML mapping file.
Parameters:
request - the request that requires interpretation
Returns:
the server base URL after mapping effects with trailing slash

getServerBase

public static String getServerBase(javax.servlet.http.HttpServletRequest request)
Deprecated. 
Looks up the alternative server base (just the protocol, port number, and server name, no portal Http root) for a particular request based on the XML mapping file.
Parameters:
request - the request that requires interpretation
Returns:
the server base after mapping effects with trailing slash

printRedirect

public static void printRedirect(Writer out,
                                 String url)
Deprecated. 
Writes a meta-refresh tag to the given writer. This should be used in process pages for modules where a redirect is necessary, instead of calling response.sendRedirect(url) which has some issues when used in modules.
Parameters:
out - The JspWriter out object that's implicitly defined in the page
url - The url to redirect to - this may be absolute or relative

02/28/2005
 

Copyright and Trademark Notices