Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps
Class SaveRequestURLFilter  view SaveRequestURLFilter download SaveRequestURLFilter.java

java.lang.Object
  extended bycom.RuntimeCollective.webapps.SaveRequestURLFilter
All Implemented Interfaces:
javax.servlet.Filter

public class SaveRequestURLFilter
extends java.lang.Object
implements javax.servlet.Filter

A Filter which saves the real request URL to the request object. By real, we mean eg the .do URL rather than the .jsp the request ends up parsing. This makes it possible for a JSP to link to itself. It also saves the real request URI (without the protocol [e.g. http://] or host [e.g. www.myDomain.com]), which can be used for making return urls for redirecting users to log in. You shouldn't care about the details of this class, except to use the SaveRequestURLFilter.getRequestURL(request) and SaveRequestURLFilter.getRequestURI(request) methods. $Id: SaveRequestURLFilter.java,v 1.8 2003/09/30 15:13:04 joe Exp $


Field Summary
private  javax.servlet.FilterConfig config
          Config parameters.
protected static java.lang.String REAL_REQUEST_REFERER
          The keyword under which the real referer URL is put on the request object.
protected static java.lang.String REAL_REQUEST_URI
          The keyword under which the real request URL is put on the request object.
protected static java.lang.String REAL_REQUEST_URL
          The keyword under which the real request URL is put on the request object.
 
Constructor Summary
SaveRequestURLFilter()
          Constructor which (builds and) returns the singleton.
 
Method Summary
static java.lang.String computeRequestURI(javax.servlet.http.HttpServletRequest request)
          Compute the URI from a request.
static java.lang.String computeRequestURL(javax.servlet.http.HttpServletRequest request)
          Compute the URL from a request.
 void destroy()
          Destroy that filter.
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Filter a request.
 javax.servlet.FilterConfig getFilterConfig()
          Get the config parameters.
static java.lang.String getRequestReferer(javax.servlet.http.HttpServletRequest request)
          Get the real request referer from a request.
static java.lang.String getRequestURI(javax.servlet.http.HttpServletRequest request)
          Get the real request URI from a request.
static java.lang.String getRequestURL(javax.servlet.http.HttpServletRequest request)
          Get the real request URL from a request.
 void init(javax.servlet.FilterConfig config)
          Init with parameters.
 void setFilterConfig(javax.servlet.FilterConfig config)
          Set the config parameters.
static void setRequestReferer(javax.servlet.http.HttpServletRequest request, java.lang.String data)
           
static void setRequestURI(javax.servlet.http.HttpServletRequest request, java.lang.String data)
           
static void setRequestURL(javax.servlet.http.HttpServletRequest request, java.lang.String data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

private javax.servlet.FilterConfig config
Config parameters.


REAL_REQUEST_URL

protected static java.lang.String REAL_REQUEST_URL
The keyword under which the real request URL is put on the request object.


REAL_REQUEST_URI

protected static java.lang.String REAL_REQUEST_URI
The keyword under which the real request URL is put on the request object.


REAL_REQUEST_REFERER

protected static java.lang.String REAL_REQUEST_REFERER
The keyword under which the real referer URL is put on the request object.

Constructor Detail

SaveRequestURLFilter

public SaveRequestURLFilter()
Constructor which (builds and) returns the singleton.

Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException
Init with parameters.

Specified by:
init in interface javax.servlet.Filter

destroy

public void destroy()
Destroy that filter.

Specified by:
destroy in interface javax.servlet.Filter

setFilterConfig

public void setFilterConfig(javax.servlet.FilterConfig config)
Set the config parameters.


getFilterConfig

public javax.servlet.FilterConfig getFilterConfig()
Get the config parameters.


getRequestURL

public static java.lang.String getRequestURL(javax.servlet.http.HttpServletRequest request)
Get the real request URL from a request. This differs from getRequestURL in that it contains the protocol (e.g. http://) and host (e.g. www.mydomain.com/) before the URI.


setRequestURL

public static void setRequestURL(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String data)

getRequestURI

public static java.lang.String getRequestURI(javax.servlet.http.HttpServletRequest request)
Get the real request URI from a request. This differs from getRequestURL in that it does not contain the protocol (e.g. http://) or host (e.g. www.mydomain.com/).


setRequestURI

public static void setRequestURI(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String data)

getRequestReferer

public static java.lang.String getRequestReferer(javax.servlet.http.HttpServletRequest request)
Get the real request referer from a request.


setRequestReferer

public static void setRequestReferer(javax.servlet.http.HttpServletRequest request,
                                     java.lang.String data)

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Filter a request.

Specified by:
doFilter in interface javax.servlet.Filter

computeRequestURL

public static java.lang.String computeRequestURL(javax.servlet.http.HttpServletRequest request)
Compute the URL from a request.


computeRequestURI

public static java.lang.String computeRequestURI(javax.servlet.http.HttpServletRequest request)
Compute the URI from a request.