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

Quick Search    Search Deep

org.enhydra.servlet.filter
Class RequestFilter  view RequestFilter download RequestFilter.java

java.lang.Object
  extended byorg.enhydra.servlet.filter.RequestFilter
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, org.apache.tomcat.core.RequestAdapter, javax.servlet.ServletRequest
Direct Known Subclasses:
PrintTransactionRequest

public class RequestFilter
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest, org.apache.tomcat.core.RequestAdapter

This replaces the BasicTransactionRequest. This is part of the basic transaction filter. This is what wraps around the servlet request object. This class does nothing, every single call is a pass-through to the real request. This class exists so that it can be extended. You would then only need to override the methods you are interested in. All the other calls will be passed through by this class.


Field Summary
protected  org.apache.tomcat.core.RequestAdapter adapter
          The RequestAdapter used by Tomcat.
protected  javax.servlet.http.HttpServletRequest myRequest
          The original request.
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
RequestFilter(javax.servlet.http.HttpServletRequest originalRequest)
          Constructor.
 
Method Summary
 int doRead()
           
 int doRead(byte[] b, int off, int len)
          Fill in the buffer.
 java.lang.Object getAttribute(java.lang.String name)
          This call is passed on to the original HttpServletRequest object.
 java.util.Enumeration getAttributeNames()
          Returns an Enumeration containing the names of the attributes available to this request.
 java.lang.String getAuthType()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getCharacterEncoding()
          This call is passed on to the original HttpServletRequest object.
 int getContentLength()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getContentType()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getContextPath()
          Returns the portion of the request URI that indicates the context of the request.
 java.lang.String[] getCookieHeaders()
          Return the cookies
 javax.servlet.http.Cookie[] getCookies()
          This call is passed on to the original HttpServletRequest object.
 long getDateHeader(java.lang.String name)
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getHeader(java.lang.String name)
          This call is passed on to the original HttpServletRequest object.
 java.util.Enumeration getHeaderNames()
          This call is passed on to the original HttpServletRequest object.
 java.util.Enumeration getHeaders(java.lang.String name)
          Returns all the values of the specified request header as an Enumeration of String objects.
 javax.servlet.ServletInputStream getInputStream()
          This call is passed on to the original HttpServletRequest object.
 int getIntHeader(java.lang.String name)
          This call is passed on to the original HttpServletRequest object.
 java.util.Locale getLocale()
          Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
 java.util.Enumeration getLocales()
          Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
 java.lang.String getMethod()
          This call is passed on to the original HttpServletRequest object.
 org.apache.tomcat.util.MimeHeaders getMimeHeaders()
           
 java.lang.String getParameter(java.lang.String name)
          This call is passed on to the original HttpServletRequest object.
 java.util.Enumeration getParameterNames()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String[] getParameterValues(java.lang.String name)
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getPathInfo()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getPathTranslated()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getProtocol()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getQueryString()
          This call is passed on to the original HttpServletRequest object.
 java.io.BufferedReader getReader()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getRealPath(java.lang.String path)
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getRemoteAddr()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getRemoteHost()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getRemoteUser()
          This call is passed on to the original HttpServletRequest object.
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String name)
          Returns a javax.servlet.RequestDispatcher object that acts as a wrapper for the resource located at the given path.
 java.lang.String getRequestedSessionId()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getRequestURI()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getScheme()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getServerName()
          This call is passed on to the original HttpServletRequest object.
 int getServerPort()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getServletName()
           
 java.lang.String getServletPath()
          This call is passed on to the original HttpServletRequest object.
 java.lang.String getServletPrefix()
           
 javax.servlet.http.HttpSession getSession()
          Returns the current session associated with this request, or if the request does not have a session, creates one.
 javax.servlet.http.HttpSession getSession(boolean create)
          This call is passed on to the original HttpServletRequest object.
 java.security.Principal getUserPrincipal()
          Returns a java.security.Principal object containing the name of the current authenticated user.
 boolean isRequestedSessionIdFromCookie()
          This call is passed on to the original HttpServletRequest object.
 boolean isRequestedSessionIdFromUrl()
          This call is passed on to the original HttpServletRequest object.
 boolean isRequestedSessionIdFromURL()
          Checks whether the requested session ID came in as part of the request URL.
 boolean isRequestedSessionIdValid()
          This call is passed on to the original HttpServletRequest object.
 boolean isSecure()
          Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
 boolean isUserInRole(java.lang.String role)
          Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
 void recycle()
           
 void removeAttribute(java.lang.String name)
          Removes an attribute from this request.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Stores an attribute in this request.
 void setQueryString(java.lang.String queryString)
          This call is passed on to the original HttpServletRequest object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getRequestURL
 
Methods inherited from interface javax.servlet.ServletRequest
getLocalAddr, getLocalName, getLocalPort, getParameterMap, getRemotePort, setCharacterEncoding
 

Field Detail

myRequest

protected javax.servlet.http.HttpServletRequest myRequest
The original request. All calls will be passed through to this object. It is set by the constructor.


adapter

protected org.apache.tomcat.core.RequestAdapter adapter
The RequestAdapter used by Tomcat.

Constructor Detail

RequestFilter

public RequestFilter(javax.servlet.http.HttpServletRequest originalRequest)
Constructor. You must pass in the original request. All the HttpServletRequest calls will be passed on to this object.

Method Detail

getContentLength

public int getContentLength()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getContentLength in interface javax.servlet.ServletRequest

getContentType

public java.lang.String getContentType()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getContentType in interface javax.servlet.ServletRequest

getProtocol

public java.lang.String getProtocol()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getProtocol in interface javax.servlet.ServletRequest

getScheme

public java.lang.String getScheme()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getScheme in interface javax.servlet.ServletRequest

getServerName

public java.lang.String getServerName()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getServerName in interface javax.servlet.ServletRequest

getServerPort

public int getServerPort()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getServerPort in interface javax.servlet.ServletRequest

getRemoteAddr

public java.lang.String getRemoteAddr()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getRemoteAddr in interface javax.servlet.ServletRequest

getRemoteHost

public java.lang.String getRemoteHost()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getRemoteHost in interface javax.servlet.ServletRequest

getRealPath

public java.lang.String getRealPath(java.lang.String path)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getRealPath in interface javax.servlet.ServletRequest

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getInputStream in interface javax.servlet.ServletRequest

getParameter

public java.lang.String getParameter(java.lang.String name)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getParameter in interface javax.servlet.ServletRequest

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getParameterValues in interface javax.servlet.ServletRequest

getParameterNames

public java.util.Enumeration getParameterNames()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getParameterNames in interface javax.servlet.ServletRequest

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the ServletRequest documentation.

Specified by:
getAttribute in interface javax.servlet.ServletRequest

getMethod

public java.lang.String getMethod()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest

getRequestURI

public java.lang.String getRequestURI()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getRequestURI in interface javax.servlet.http.HttpServletRequest

getServletPath

public java.lang.String getServletPath()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest

getPathInfo

public java.lang.String getPathInfo()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest

getPathTranslated

public java.lang.String getPathTranslated()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest

getQueryString

public java.lang.String getQueryString()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getQueryString in interface javax.servlet.http.HttpServletRequest

setQueryString

public void setQueryString(java.lang.String queryString)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
setQueryString in interface org.apache.tomcat.core.RequestAdapter

getRemoteUser

public java.lang.String getRemoteUser()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest

getAuthType

public java.lang.String getAuthType()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest

getHeader

public java.lang.String getHeader(java.lang.String name)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest

getIntHeader

public int getIntHeader(java.lang.String name)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest

getDateHeader

public long getDateHeader(java.lang.String name)
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest

getHeaderNames

public java.util.Enumeration getHeaderNames()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest

getCookies

public javax.servlet.http.Cookie[] getCookies()
This call is passed on to the original HttpServletRequest object.

Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
This call is passed on to the original HttpServletRequest object.

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest

getRequestedSessionId

public java.lang.String getRequestedSessionId()
This call is passed on to the original HttpServletRequest object. For a description of what this call does, see the HttpServletRequest documentation.

Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
This call is passed on to the original HttpServletRequest object.

Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
This call is passed on to the original HttpServletRequest object.

Specified by:
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
This call is passed on to the original HttpServletRequest object.

Specified by:
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
This call is passed on to the original HttpServletRequest object.

Specified by:
getReader in interface javax.servlet.ServletRequest

getCharacterEncoding

public java.lang.String getCharacterEncoding()
This call is passed on to the original HttpServletRequest object.

Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest

isUserInRole

public boolean isUserInRole(java.lang.String role)
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.

Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest

getLocale

public java.util.Locale getLocale()
Description copied from interface: javax.servlet.ServletRequest
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns the default locale for the server.

Specified by:
getLocale in interface javax.servlet.ServletRequest

getUserPrincipal

public java.security.Principal getUserPrincipal()
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns a java.security.Principal object containing the name of the current authenticated user. If the user has not been authenticated, the method returns null.

Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest

getLocales

public java.util.Enumeration getLocales()
Description copied from interface: javax.servlet.ServletRequest
Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header. If the client request doesn't provide an Accept-Language header, this method returns an Enumeration containing one Locale, the default locale for the server.

Specified by:
getLocales in interface javax.servlet.ServletRequest

getContextPath

public java.lang.String getContextPath()
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.

Specified by:
getContextPath in interface javax.servlet.http.HttpServletRequest

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns all the values of the specified request header as an Enumeration of String objects.

Some headers, such as Accept-Language can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.

If the request did not include any headers of the specified name, this method returns an empty Enumeration. The header name is case insensitive. You can use this method with any request header.

Specified by:
getHeaders in interface javax.servlet.http.HttpServletRequest

removeAttribute

public void removeAttribute(java.lang.String name)
Description copied from interface: javax.servlet.ServletRequest
Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.

Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems.

Specified by:
removeAttribute in interface javax.servlet.ServletRequest

isSecure

public boolean isSecure()
Description copied from interface: javax.servlet.ServletRequest
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

Specified by:
isSecure in interface javax.servlet.ServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Description copied from interface: javax.servlet.http.HttpServletRequest
Checks whether the requested session ID came in as part of the request URL.

Specified by:
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest

getSession

public javax.servlet.http.HttpSession getSession()
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns the current session associated with this request, or if the request does not have a session, creates one.

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest

getAttributeNames

public java.util.Enumeration getAttributeNames()
Description copied from interface: javax.servlet.ServletRequest
Returns an Enumeration containing the names of the attributes available to this request. This method returns an empty Enumeration if the request has no attributes available to it.

Specified by:
getAttributeNames in interface javax.servlet.ServletRequest

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: javax.servlet.ServletRequest
Stores an attribute in this request. Attributes are reset between requests. This method is most often used in conjunction with javax.servlet.RequestDispatcher.

Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems.
If the object passed in is null, the effect is the same as calling ServletRequest.removeAttribute(java.lang.String)>ServletRequest.removeAttribute(java.lang.String) 55 .
It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher, the object set by this method may not be correctly retrieved in the caller servlet.

Specified by:
setAttribute in interface javax.servlet.ServletRequest

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String name)
Description copied from interface: javax.servlet.ServletRequest
Returns a javax.servlet.RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.

The pathname specified may be relative, although it cannot extend outside the current servlet context. If the path begins with a "/" it is interpreted as relative to the current context root. This method returns null if the servlet container cannot return a RequestDispatcher.

The difference between this method and ServletContext.getRequestDispatcher(java.lang.String)>ServletContext.getRequestDispatcher(java.lang.String) 55 is that this method can take a relative path.

Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest

recycle

public void recycle()
Specified by:
recycle in interface org.apache.tomcat.core.RequestAdapter

getMimeHeaders

public org.apache.tomcat.util.MimeHeaders getMimeHeaders()
Specified by:
getMimeHeaders in interface org.apache.tomcat.core.RequestAdapter

getCookieHeaders

public java.lang.String[] getCookieHeaders()
Description copied from interface: org.apache.tomcat.core.RequestAdapter
Return the cookies

Specified by:
getCookieHeaders in interface org.apache.tomcat.core.RequestAdapter

getServletPrefix

public java.lang.String getServletPrefix()
Specified by:
getServletPrefix in interface org.apache.tomcat.core.RequestAdapter

getServletName

public java.lang.String getServletName()
Specified by:
getServletName in interface org.apache.tomcat.core.RequestAdapter

doRead

public int doRead()
           throws java.io.IOException
Specified by:
doRead in interface org.apache.tomcat.core.RequestAdapter

doRead

public int doRead(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Description copied from interface: org.apache.tomcat.core.RequestAdapter
Fill in the buffer. This method is probably easier to implement than previous. This method should only be called from SerlvetInputStream implementations. No need to implement it if your adapter implements ServletInputStream.

Specified by:
doRead in interface org.apache.tomcat.core.RequestAdapter