org.mortbay.jetty
Class Request

java.lang.Object
  extended by org.mortbay.jetty.Request
All Implemented Interfaces:
HttpServletRequest, ServletRequest

public class Request
extends Object
implements HttpServletRequest

Request.

Author:
gregw

Field Summary
private static Collection __defaultLocale
           
private static Cookie[] __noCookies
           
private static int __NONE
           
private static int __READER
           
private  Attributes _attributes
           
private  String _authType
           
private  String _characterEncoding
           
private  HttpConnection _connection
           
private  ContextHandler.Context _context
           
private  String _contextPath
           
private  Continuation _continuation
           
private  Cookie[] _cookies
           
private  boolean _cookiesExtracted
           
private  boolean _dns
           
private  EndPoint _endp
           
private  int _inputState
           
private  String[] _lastCookies
           
private  String _method
           
private  MultiMap _parameters
           
private  boolean _paramsExtracted
           
private  String _pathInfo
           
private  int _port
           
private  String _protocol
           
private  String _queryString
           
private  BufferedReader _reader
           
private  Object _requestAttributeListeners
           
private  String _requestedSessionId
           
private  boolean _requestedSessionIdFromCookie
           
private  String _requestURI
           
private  Map _savedNewSessions
           
private  String _scheme
           
private  String _serverName
           
private  String _servletPath
           
private  HttpSession _session
           
private  SessionManager _sessionManager
           
private static int _STREAM
           
private  long _timeStamp
           
private  String _timeStampStr
           
private  URI _uri
           
private  Principal _userPrincipal
           
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
Request(HttpConnection connection)
           
 
Method Summary
 void addEventListener(EventListener listener)
           
private  void extractParameters()
           
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 Attributes getAttributes()
           
 String getAuthType()
           
 String getCharacterEncoding()
           
 HttpConnection getConnection()
           
 int getContentLength()
           
 String getContentType()
           
 ContextHandler.Context getContext()
           
 String getContextPath()
           
 Continuation getContinuation()
           
 Continuation getContinuation(boolean create)
           
 Cookie[] getCookies()
           
 long getDateHeader(String name)
           
 String getHeader(String name)
           
 Enumeration getHeaderNames()
           
 Enumeration getHeaders(String name)
           
 int getInputState()
           
 ServletInputStream getInputStream()
           
 int getIntHeader(String name)
           
 String getLocalAddr()
           
 Locale getLocale()
           
 Enumeration getLocales()
           
 String getLocalName()
           
 int getLocalPort()
           
 String getMethod()
           
 String getParameter(String name)
           
 Map getParameterMap()
           
 Enumeration getParameterNames()
           
 MultiMap getParameters()
           
 String[] getParameterValues(String name)
           
 String getPathInfo()
           
 String getPathTranslated()
           
 String getProtocol()
           
 String getQueryString()
           
 BufferedReader getReader()
           
 String getRealPath(String path)
           
 String getRemoteAddr()
           
 String getRemoteHost()
           
 int getRemotePort()
           
 String getRemoteUser()
           
static Request getRequest(HttpServletRequest request)
           
 RequestDispatcher getRequestDispatcher(String path)
           
 String getRequestedSessionId()
           
 String getRequestURI()
           
 StringBuffer getRequestURL()
           
 StringBuffer getRootURL()
          Reconstructs the URL the client used to make the request.
 String getScheme()
           
 String getServerName()
           
 int getServerPort()
           
 String getServletPath()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 SessionManager getSessionManager()
           
 long getTimeStamp()
          Get Request TimeStamp
 String getTimeStampStr()
          Get Request TimeStamp
 URI getUri()
           
 Principal getUserPrincipal()
           
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(String role)
           
 HttpSession recoverNewSession(Object key)
           
(package private)  void recycle()
           
 void removeAttribute(String name)
           
 void removeEventListener(EventListener listener)
           
 void saveNewSession(Object key, HttpSession session)
           
 void setAttribute(String name, Object value)
           
 void setAttributes(Attributes attributes)
           
 void setAuthType(String authType)
           
 void setCharacterEncoding(String encoding)
           
 void setContext(ContextHandler.Context context)
           
 void setContextPath(String contextPath)
           
(package private)  void setContinuation(Continuation cont)
           
 void setCookies(Cookie[] cookies)
           
 void setMethod(String method)
           
 void setParameters(MultiMap parameters)
           
 void setPathInfo(String pathInfo)
           
 void setProtocol(String protocol)
           
 void setQueryString(String queryString)
           
 void setRequestedSessionId(String requestedSessionId)
           
 void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie)
           
 void setRequestURI(String requestURI)
           
 void setScheme(String scheme)
           
 void setServerName(String host)
           
 void setServletPath(String servletPath)
           
 void setSession(HttpSession session)
           
 void setSessionManager(SessionManager sessionManager)
           
 void setTimeStamp(long ts)
           
 void setUri(URI uri)
           
 void setUserPrincipal(Principal userPrincipal)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

__defaultLocale

private static final Collection __defaultLocale

__NONE

private static final int __NONE
See Also:
Constant Field Values

_STREAM

private static final int _STREAM
See Also:
Constant Field Values

__READER

private static final int __READER
See Also:
Constant Field Values

__noCookies

private static Cookie[] __noCookies

_connection

private HttpConnection _connection

_endp

private EndPoint _endp

_attributes

private Attributes _attributes

_authType

private String _authType

_characterEncoding

private String _characterEncoding

_serverName

private String _serverName

_method

private String _method

_pathInfo

private String _pathInfo

_port

private int _port

_protocol

private String _protocol

_queryString

private String _queryString

_requestedSessionId

private String _requestedSessionId

_requestedSessionIdFromCookie

private boolean _requestedSessionIdFromCookie

_requestURI

private String _requestURI

_scheme

private String _scheme

_contextPath

private String _contextPath

_servletPath

private String _servletPath

_uri

private URI _uri

_userPrincipal

private Principal _userPrincipal

_parameters

private MultiMap _parameters

_paramsExtracted

private boolean _paramsExtracted

_inputState

private int _inputState

_reader

private BufferedReader _reader

_dns

private boolean _dns

_context

private ContextHandler.Context _context

_session

private HttpSession _session

_sessionManager

private SessionManager _sessionManager

_cookiesExtracted

private boolean _cookiesExtracted

_cookies

private Cookie[] _cookies

_lastCookies

private String[] _lastCookies

_timeStamp

private long _timeStamp

_timeStampStr

private String _timeStampStr

_continuation

private Continuation _continuation

_requestAttributeListeners

private Object _requestAttributeListeners

_savedNewSessions

private Map _savedNewSessions
Constructor Detail

Request

Request(HttpConnection connection)
Method Detail

recycle

void recycle()

getTimeStampStr

public String getTimeStampStr()
Get Request TimeStamp

Returns:
The time that the request was received.

getTimeStamp

public long getTimeStamp()
Get Request TimeStamp

Returns:
The time that the request was received.

setTimeStamp

public void setTimeStamp(long ts)

getAttribute

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

getAttributeNames

public Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface ServletRequest

getAuthType

public String getAuthType()
Specified by:
getAuthType in interface HttpServletRequest

getCharacterEncoding

public String getCharacterEncoding()
Specified by:
getCharacterEncoding in interface ServletRequest

getContentLength

public int getContentLength()
Specified by:
getContentLength in interface ServletRequest

getContentType

public String getContentType()
Specified by:
getContentType in interface ServletRequest

getContextPath

public String getContextPath()
Specified by:
getContextPath in interface HttpServletRequest

getCookies

public Cookie[] getCookies()
Specified by:
getCookies in interface HttpServletRequest

getDateHeader

public long getDateHeader(String name)
Specified by:
getDateHeader in interface HttpServletRequest

getHeader

public String getHeader(String name)
Specified by:
getHeader in interface HttpServletRequest

getHeaderNames

public Enumeration getHeaderNames()
Specified by:
getHeaderNames in interface HttpServletRequest

getHeaders

public Enumeration getHeaders(String name)
Specified by:
getHeaders in interface HttpServletRequest

getInputStream

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

getIntHeader

public int getIntHeader(String name)
Specified by:
getIntHeader in interface HttpServletRequest

getLocalAddr

public String getLocalAddr()
Specified by:
getLocalAddr in interface ServletRequest

getLocale

public Locale getLocale()
Specified by:
getLocale in interface ServletRequest

getLocales

public Enumeration getLocales()
Specified by:
getLocales in interface ServletRequest

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface ServletRequest

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface ServletRequest

getMethod

public String getMethod()
Specified by:
getMethod in interface HttpServletRequest

getParameter

public String getParameter(String name)
Specified by:
getParameter in interface ServletRequest

getParameterMap

public Map getParameterMap()
Specified by:
getParameterMap in interface ServletRequest

getParameterNames

public Enumeration getParameterNames()
Specified by:
getParameterNames in interface ServletRequest

getParameterValues

public String[] getParameterValues(String name)
Specified by:
getParameterValues in interface ServletRequest

getPathInfo

public String getPathInfo()
Specified by:
getPathInfo in interface HttpServletRequest

getPathTranslated

public String getPathTranslated()
Specified by:
getPathTranslated in interface HttpServletRequest

getProtocol

public String getProtocol()
Specified by:
getProtocol in interface ServletRequest

getReader

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

getRealPath

public String getRealPath(String path)
Specified by:
getRealPath in interface ServletRequest

getRemoteAddr

public String getRemoteAddr()
Specified by:
getRemoteAddr in interface ServletRequest

getRemoteHost

public String getRemoteHost()
Specified by:
getRemoteHost in interface ServletRequest

getRemotePort

public int getRemotePort()
Specified by:
getRemotePort in interface ServletRequest

getRemoteUser

public String getRemoteUser()
Specified by:
getRemoteUser in interface HttpServletRequest

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String path)
Specified by:
getRequestDispatcher in interface ServletRequest

getRequestedSessionId

public String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface HttpServletRequest

getRequestURI

public String getRequestURI()
Specified by:
getRequestURI in interface HttpServletRequest

getRequestURL

public StringBuffer getRequestURL()
Specified by:
getRequestURL in interface HttpServletRequest

getScheme

public String getScheme()
Specified by:
getScheme in interface ServletRequest

getServerName

public String getServerName()
Specified by:
getServerName in interface ServletRequest

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface ServletRequest

getServletPath

public String getServletPath()
Specified by:
getServletPath in interface HttpServletRequest

getSession

public HttpSession getSession()
Specified by:
getSession in interface HttpServletRequest

getSession

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

getUserPrincipal

public Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface HttpServletRequest

getQueryString

public String getQueryString()
Specified by:
getQueryString in interface HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Specified by:
isRequestedSessionIdFromCookie in interface HttpServletRequest

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Specified by:
isRequestedSessionIdFromUrl in interface HttpServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Specified by:
isRequestedSessionIdFromURL in interface HttpServletRequest

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface HttpServletRequest

isSecure

public boolean isSecure()
Specified by:
isSecure in interface ServletRequest

isUserInRole

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

removeAttribute

public void removeAttribute(String name)
Specified by:
removeAttribute in interface ServletRequest

setAttribute

public void setAttribute(String name,
                         Object value)
Specified by:
setAttribute in interface ServletRequest

setCharacterEncoding

public void setCharacterEncoding(String encoding)
                          throws UnsupportedEncodingException
Specified by:
setCharacterEncoding in interface ServletRequest
Throws:
UnsupportedEncodingException

extractParameters

private void extractParameters()

setServerName

public void setServerName(String host)
Parameters:
host - The host to set.

getUri

public URI getUri()
Returns:
Returns the uri.

setUri

public void setUri(URI uri)
Parameters:
uri - The uri to set.

getConnection

public HttpConnection getConnection()
Returns:
Returns the connection.

getInputState

public int getInputState()
Returns:
Returns the inputState.

setAuthType

public void setAuthType(String authType)
Parameters:
authType - The authType to set.

setCookies

public void setCookies(Cookie[] cookies)
Parameters:
cookies - The cookies to set.

setMethod

public void setMethod(String method)
Parameters:
method - The method to set.

setPathInfo

public void setPathInfo(String pathInfo)
Parameters:
pathInfo - The pathInfo to set.

setProtocol

public void setProtocol(String protocol)
Parameters:
protocol - The protocol to set.

setRequestedSessionId

public void setRequestedSessionId(String requestedSessionId)
Parameters:
requestedSessionId - The requestedSessionId to set.

getSessionManager

public SessionManager getSessionManager()
Returns:
Returns the sessionManager.

setSessionManager

public void setSessionManager(SessionManager sessionManager)
Parameters:
sessionManager - The sessionManager to set.

setRequestedSessionIdFromCookie

public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie)
Parameters:
requestedSessionIdCookie - The requestedSessionIdCookie to set.

setSession

public void setSession(HttpSession session)
Parameters:
session - The session to set.

setScheme

public void setScheme(String scheme)
Parameters:
scheme - The scheme to set.

setQueryString

public void setQueryString(String queryString)
Parameters:
queryString - The queryString to set.

setRequestURI

public void setRequestURI(String requestURI)
Parameters:
requestURI - The requestURI to set.

setContextPath

public void setContextPath(String contextPath)
Parameters:
servletPath - The servletPath to set.

setServletPath

public void setServletPath(String servletPath)
Parameters:
servletPath - The servletPath to set.

setUserPrincipal

public void setUserPrincipal(Principal userPrincipal)
Parameters:
userPrincipal - The userPrincipal to set.

setContext

public void setContext(ContextHandler.Context context)
Parameters:
context -

getContext

public ContextHandler.Context getContext()
Returns:

getRootURL

public StringBuffer getRootURL()
Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a path.

Because this method returns a StringBuffer, not a string, you can modify the URL easily, for example, to append path and query parameters. This method is useful for creating redirect messages and for reporting errors.

Returns:
"scheme://host:port"

getAttributes

public Attributes getAttributes()

setAttributes

public void setAttributes(Attributes attributes)

getContinuation

public Continuation getContinuation()

getContinuation

public Continuation getContinuation(boolean create)

setContinuation

void setContinuation(Continuation cont)

getParameters

public MultiMap getParameters()
Returns:
Returns the parameters.

setParameters

public void setParameters(MultiMap parameters)
Parameters:
parameters - The parameters to set.

toString

public String toString()
Overrides:
toString in class Object

getRequest

public static Request getRequest(HttpServletRequest request)

addEventListener

public void addEventListener(EventListener listener)

removeEventListener

public void removeEventListener(EventListener listener)

saveNewSession

public void saveNewSession(Object key,
                           HttpSession session)

recoverNewSession

public HttpSession recoverNewSession(Object key)