org.norther.tammi.spray.protocol.chain
Class HttpProtocolRequest

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by org.norther.tammi.spray.filter.chain.ServletRequestWrapper
          extended by org.norther.tammi.spray.filter.chain.HttpServletRequestWrapper
              extended by org.norther.tammi.spray.protocol.chain.AbstractProtocolRequest
                  extended by org.norther.tammi.spray.protocol.chain.BaseProtocolRequest
                      extended by org.norther.tammi.spray.protocol.chain.HttpProtocolRequest
All Implemented Interfaces:
EventListener, HttpServletRequest, ServletRequest, Poolable, Recyclable, FilterChainListener
Direct Known Subclasses:
HttpRMIRequest

public class HttpProtocolRequest
extends BaseProtocolRequest
implements HttpServletRequest

A default implementation of the HTTP protocol request. It implements the javax.servlet.http.HttpServletRequest interface by applying methods provided by the javax.servlet.ServletRequest implementation used as an adaptee.

Author:
Ilkka Priha

Nested Class Summary
 
Nested classes/interfaces inherited from class org.norther.tammi.spray.protocol.chain.AbstractProtocolRequest
AbstractProtocolRequest.ProtocolRequestExtension
 
Field Summary
 
Fields inherited from class org.norther.tammi.spray.protocol.chain.AbstractProtocolRequest
BODY_PARSED, COOKIE_SESSION, HEADERS_PARSED, REQUEST_PARSED, URI_PARSED, URL_SESSION
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
HttpProtocolRequest()
          Constructs a new request.
HttpProtocolRequest(ServletRequest req)
          Constructs a new request with a wrapped one.
 
Method Summary
 void dispose()
          Disposes the object after use.
protected  void drain()
          Drains a HTTP/1.1 request to guarantee a fresh stream for the next round.
 void filtered(FilterChainEvent event)
          Notifies the object that it has been activated within a filter chain.
 Object getAttribute(String name)
           
 String getAuthType()
           
 String getContextPath()
           
 ServletInputStream getInputStream()
           
 int getMaxRequestLength()
          Gets the maximum allowed request length.
protected  Map getParsedHeaderMap()
          Gets the parsed HTTP headers as a map of names and value vectors.
protected  Map getParsedParameterMap()
          Gets the parsed parameters as a map of names and value arrays.
protected  List getParsedRequestList()
          Gets the parsed request as a list of items.
protected  String getParsedRequestURI()
          Gets the parsed request URI.
 String getPathInfo()
           
 String getPathTranslated()
           
 BufferedReader getReader()
           
 String getRemoteAddr()
           
 String getRemoteUser()
           
 String getRequestedSessionId()
           
 int getServerPort()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 Principal getUserPrincipal()
           
protected  boolean isRedirection()
          Checks whether this request is a redirection.
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
protected  boolean isSecureSession()
          Checks whether the session is secure.
 boolean isUserInRole(String role)
           
 void setMaxRequestLength(int length)
          Sets the maximum allowed request length.
 
Methods inherited from class org.norther.tammi.spray.protocol.chain.BaseProtocolRequest
getCharacterEncoding, getContentLength, getContentType, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getLocale, getLocales, getMethod, getProtocol, getQueryString, getRequestDispatcher, getRequestURI, getRequestURL, getServerName, getServletPath
 
Methods inherited from class org.norther.tammi.spray.protocol.chain.AbstractProtocolRequest
addParameter, addParameter, addParameterMap, getAuthorityURL, getAuthorityURL, getAuthorityURL, getHttpFilter, getInternalCharacterEncoding, getParameter, getParameterMap, getParameterNames, getParameterValues, getPathTail, getRedirectionURL, getVersion, isAuthentication, removeParameter, setAuthentication, setParameter, setRedirection, setRedirectionURL
 
Methods inherited from class org.norther.tammi.spray.filter.chain.HttpServletRequestWrapper
setRequest
 
Methods inherited from class org.norther.tammi.spray.filter.chain.ServletRequestWrapper
completed, disposed, getExtension, getFilterChain, getFilteredRequest, getFilteredResponse, isDisposed, recycle, recycle, recycled, setExtension
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttributeNames, getLocalAddr, getLocalName, getLocalPort, getRealPath, getRemoteHost, getRemotePort, getRequest, getScheme, removeAttribute, setAttribute, setCharacterEncoding
 
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
getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getQueryString, getRequestURI, getRequestURL, getServletPath
 
Methods inherited from interface javax.servlet.ServletRequest
getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getRealPath, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

HttpProtocolRequest

public HttpProtocolRequest()
Constructs a new request.


HttpProtocolRequest

public HttpProtocolRequest(ServletRequest req)
Constructs a new request with a wrapped one.

Parameters:
req - the wrapped request.
Method Detail

dispose

public void dispose()
Description copied from interface: Recyclable
Disposes the object after use. The method is called when the object is returned to its pool. The dispose method must call its super.

Specified by:
dispose in interface Recyclable
Overrides:
dispose in class BaseProtocolRequest

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface ServletRequest
Overrides:
getServerPort in class BaseProtocolRequest

getRemoteAddr

public String getRemoteAddr()
Specified by:
getRemoteAddr in interface ServletRequest
Overrides:
getRemoteAddr in class ServletRequestWrapper

isSecure

public boolean isSecure()
Specified by:
isSecure in interface ServletRequest
Overrides:
isSecure in class ServletRequestWrapper

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface ServletRequest
Overrides:
getAttribute in class ServletRequestWrapper

getInputStream

public ServletInputStream getInputStream()
                                  throws IOException
Specified by:
getInputStream in interface ServletRequest
Overrides:
getInputStream in class ServletRequestWrapper
Throws:
IOException

getReader

public BufferedReader getReader()
                         throws IOException
Specified by:
getReader in interface ServletRequest
Overrides:
getReader in class ServletRequestWrapper
Throws:
IOException

getContextPath

public String getContextPath()
Specified by:
getContextPath in interface HttpServletRequest
Overrides:
getContextPath in class HttpServletRequestWrapper

getRequestedSessionId

public String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface HttpServletRequest
Overrides:
getRequestedSessionId in class HttpServletRequestWrapper

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Specified by:
isRequestedSessionIdFromCookie in interface HttpServletRequest
Overrides:
isRequestedSessionIdFromCookie in class HttpServletRequestWrapper

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Specified by:
isRequestedSessionIdFromUrl in interface HttpServletRequest
Overrides:
isRequestedSessionIdFromUrl in class HttpServletRequestWrapper

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Specified by:
isRequestedSessionIdFromURL in interface HttpServletRequest
Overrides:
isRequestedSessionIdFromURL in class HttpServletRequestWrapper

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface HttpServletRequest
Overrides:
isRequestedSessionIdValid in class HttpServletRequestWrapper

getSession

public HttpSession getSession()
Specified by:
getSession in interface HttpServletRequest
Overrides:
getSession in class HttpServletRequestWrapper

getSession

public HttpSession getSession(boolean create)
Specified by:
getSession in interface HttpServletRequest
Overrides:
getSession in class HttpServletRequestWrapper

getPathInfo

public String getPathInfo()
Specified by:
getPathInfo in interface HttpServletRequest
Overrides:
getPathInfo in class HttpServletRequestWrapper

getPathTranslated

public String getPathTranslated()
Specified by:
getPathTranslated in interface HttpServletRequest
Overrides:
getPathTranslated in class HttpServletRequestWrapper

getAuthType

public String getAuthType()
Specified by:
getAuthType in interface HttpServletRequest
Overrides:
getAuthType in class HttpServletRequestWrapper

getRemoteUser

public String getRemoteUser()
Specified by:
getRemoteUser in interface HttpServletRequest
Overrides:
getRemoteUser in class HttpServletRequestWrapper

getUserPrincipal

public Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface HttpServletRequest
Overrides:
getUserPrincipal in class HttpServletRequestWrapper

isUserInRole

public boolean isUserInRole(String role)
Specified by:
isUserInRole in interface HttpServletRequest
Overrides:
isUserInRole in class HttpServletRequestWrapper

filtered

public void filtered(FilterChainEvent event)
Description copied from interface: FilterChainListener
Notifies the object that it has been activated within a filter chain.

Specified by:
filtered in interface FilterChainListener
Overrides:
filtered in class ServletRequestWrapper
Parameters:
event - the filter chain event.

getMaxRequestLength

public int getMaxRequestLength()
Gets the maximum allowed request length.

Returns:
the maximum request length.

setMaxRequestLength

public void setMaxRequestLength(int length)
Sets the maximum allowed request length.

Parameters:
length - the maximum request length.

drain

protected void drain()
Description copied from class: AbstractProtocolRequest
Drains a HTTP/1.1 request to guarantee a fresh stream for the next round.

Specified by:
drain in class AbstractProtocolRequest

isRedirection

protected boolean isRedirection()
Description copied from class: AbstractProtocolRequest
Checks whether this request is a redirection.

Overrides:
isRedirection in class AbstractProtocolRequest
Returns:
true if a redirection, otherwise false.

isSecureSession

protected boolean isSecureSession()
Description copied from class: AbstractProtocolRequest
Checks whether the session is secure.

Overrides:
isSecureSession in class AbstractProtocolRequest
Returns:
true if secure, otherwise false.

getParsedRequestList

protected List getParsedRequestList()
Description copied from class: BaseProtocolRequest
Gets the parsed request as a list of items.

Specified by:
getParsedRequestList in class BaseProtocolRequest
Returns:
the parsed request as a list.

getParsedHeaderMap

protected Map getParsedHeaderMap()
Description copied from class: BaseProtocolRequest
Gets the parsed HTTP headers as a map of names and value vectors.

Specified by:
getParsedHeaderMap in class BaseProtocolRequest
Returns:
the parsed headers as a map.

getParsedParameterMap

protected Map getParsedParameterMap()
Description copied from class: AbstractProtocolRequest
Gets the parsed parameters as a map of names and value arrays.

Overrides:
getParsedParameterMap in class AbstractProtocolRequest
Returns:
the parsed parameters as a map.

getParsedRequestURI

protected String getParsedRequestURI()
Description copied from class: BaseProtocolRequest
Gets the parsed request URI.

Specified by:
getParsedRequestURI in class BaseProtocolRequest
Returns:
the parsed request URI.


Copyright © 2004 The Norther Organization. All rights reserved.