|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mortbay.jetty.Request
public class Request
Jetty Request.
Implements javax.servlet.HttpServletRequest
from the javax.servlet
package.
The standard interface of mostly getters, is extended with setters so that the request is mutable by the handlers that it is passed to. This allows the request object to be as lightweight as possible and not actually implement any significant behaviour. For example
getContextPath
method will return null, until the requeset has been
passed to a ContextHandler
which matches the getPathInfo
with a context
path and calls setContextPath
as a result.SessionHandler
which checks for session cookies
and enables the ability to create new sessions.getServletPath
method will return null until the request has been
passed to a ServletHandler
and the pathInfo matched
against the servlet URL patterns and setServletPath
called as a result.HttpConnection
accepted by the server
and recycled for each HTTP request received via that connection. An effort is made
to avoid reparsing headers and cookies that are likely to be the same for
requests from the same connection.
Field Summary |
---|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
Request()
|
|
Request(HttpConnection connection)
|
Method Summary | |
---|---|
void |
addEventListener(java.util.EventListener listener)
|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
Attributes |
getAttributes()
|
java.lang.String |
getAuthType()
|
java.lang.String |
getCharacterEncoding()
|
HttpConnection |
getConnection()
|
int |
getContentLength()
|
long |
getContentRead()
|
java.lang.String |
getContentType()
|
ContextHandler.SContext |
getContext()
|
java.lang.String |
getContextPath()
|
Continuation |
getContinuation()
|
Continuation |
getContinuation(boolean create)
|
javax.servlet.http.Cookie[] |
getCookies()
|
long |
getDateHeader(java.lang.String name)
|
java.lang.String |
getHeader(java.lang.String name)
|
java.util.Enumeration |
getHeaderNames()
|
java.util.Enumeration |
getHeaders(java.lang.String name)
|
int |
getInputState()
|
javax.servlet.ServletInputStream |
getInputStream()
|
int |
getIntHeader(java.lang.String name)
|
java.lang.String |
getLocalAddr()
|
java.util.Locale |
getLocale()
|
java.util.Enumeration |
getLocales()
|
java.lang.String |
getLocalName()
|
int |
getLocalPort()
|
java.lang.String |
getMethod()
|
java.lang.String |
getParameter(java.lang.String name)
|
java.util.Map |
getParameterMap()
|
java.util.Enumeration |
getParameterNames()
|
MultiMap |
getParameters()
|
java.lang.String[] |
getParameterValues(java.lang.String name)
|
java.lang.String |
getPathInfo()
|
java.lang.String |
getPathTranslated()
|
java.lang.String |
getProtocol()
|
java.lang.String |
getQueryEncoding()
|
java.lang.String |
getQueryString()
|
java.io.BufferedReader |
getReader()
|
java.lang.String |
getRealPath(java.lang.String path)
|
java.lang.String |
getRemoteAddr()
|
java.lang.String |
getRemoteHost()
|
int |
getRemotePort()
|
java.lang.String |
getRemoteUser()
|
static Request |
getRequest(javax.servlet.http.HttpServletRequest request)
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
|
java.lang.String |
getRequestedSessionId()
|
java.lang.String |
getRequestURI()
|
java.lang.StringBuffer |
getRequestURL()
|
java.util.Map |
getRoleMap()
|
java.lang.StringBuffer |
getRootURL()
Reconstructs the URL the client used to make the request. |
java.lang.String |
getScheme()
|
java.lang.String |
getServerName()
|
int |
getServerPort()
|
javax.servlet.ServletContext |
getServletContext()
|
java.lang.String |
getServletName()
|
java.lang.String |
getServletPath()
|
javax.servlet.ServletResponse |
getServletResponse()
|
javax.servlet.http.HttpSession |
getSession()
|
javax.servlet.http.HttpSession |
getSession(boolean create)
|
SessionManager |
getSessionManager()
|
long |
getTimeStamp()
Get Request TimeStamp |
Buffer |
getTimeStampBuffer()
Get Request TimeStamp |
HttpURI |
getUri()
|
java.security.Principal |
getUserPrincipal()
|
UserRealm |
getUserRealm()
|
boolean |
isHandled()
|
boolean |
isRequestedSessionIdFromCookie()
|
boolean |
isRequestedSessionIdFromUrl()
|
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
javax.servlet.http.HttpSession |
recoverNewSession(java.lang.Object key)
|
protected void |
recycle()
|
void |
removeAttribute(java.lang.String name)
|
void |
removeEventListener(java.util.EventListener listener)
|
void |
saveNewSession(java.lang.Object key,
javax.servlet.http.HttpSession session)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setAttributes(Attributes attributes)
|
void |
setAuthType(java.lang.String authType)
|
void |
setCharacterEncoding(java.lang.String encoding)
|
void |
setCharacterEncodingUnchecked(java.lang.String encoding)
|
protected void |
setConnection(HttpConnection connection)
|
void |
setContentType(java.lang.String contentType)
|
void |
setContext(ContextHandler.SContext context)
|
void |
setContextPath(java.lang.String contextPath)
Sets the "context path" for this request |
void |
setCookies(javax.servlet.http.Cookie[] cookies)
|
void |
setHandled(boolean h)
|
void |
setMethod(java.lang.String method)
|
void |
setParameters(MultiMap parameters)
|
void |
setPathInfo(java.lang.String pathInfo)
|
void |
setProtocol(java.lang.String protocol)
|
void |
setQueryEncoding(java.lang.String queryEncoding)
Set the character encoding used for the query string. |
void |
setQueryString(java.lang.String queryString)
|
void |
setRemoteAddr(java.lang.String addr)
|
void |
setRemoteHost(java.lang.String host)
|
void |
setRequestedSessionId(java.lang.String requestedSessionId)
|
void |
setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie)
|
void |
setRequestListeners(java.lang.Object requestListeners)
|
void |
setRequestURI(java.lang.String requestURI)
|
void |
setRoleMap(java.util.Map map)
|
void |
setScheme(java.lang.String scheme)
|
void |
setServerName(java.lang.String host)
|
void |
setServerPort(int port)
|
void |
setServletName(java.lang.String name)
|
void |
setServletPath(java.lang.String servletPath)
|
void |
setSession(javax.servlet.http.HttpSession session)
|
void |
setSessionManager(SessionManager sessionManager)
|
void |
setTimeStamp(long ts)
|
void |
setUri(HttpURI uri)
|
void |
setUserPrincipal(java.security.Principal userPrincipal)
|
void |
setUserRealm(UserRealm userRealm)
|
java.lang.Object |
takeRequestListeners()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Request()
public Request(HttpConnection connection)
Method Detail |
---|
protected void setConnection(HttpConnection connection)
protected void recycle()
public Buffer getTimeStampBuffer()
public long getTimeStamp()
public void setTimeStamp(long ts)
public boolean isHandled()
public void setHandled(boolean h)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletRequest
public java.util.Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public java.lang.String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public long getContentRead()
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public void setContentType(java.lang.String contentType)
public java.lang.String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public long getDateHeader(java.lang.String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getHeader(java.lang.String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
public java.util.Enumeration getHeaders(java.lang.String name)
getHeaders
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.ServletInputStream getInputStream() throws java.io.IOException
getInputStream
in interface javax.servlet.ServletRequest
java.io.IOException
public int getIntHeader(java.lang.String name)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
public java.util.Enumeration getLocales()
getLocales
in interface javax.servlet.ServletRequest
public java.lang.String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getParameter(java.lang.String name)
getParameter
in interface javax.servlet.ServletRequest
public java.util.Map getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public java.util.Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues
in interface javax.servlet.ServletRequest
public java.lang.String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
public java.io.BufferedReader getReader() throws java.io.IOException
getReader
in interface javax.servlet.ServletRequest
java.io.IOException
public java.lang.String getRealPath(java.lang.String path)
getRealPath
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public java.lang.String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interface javax.servlet.ServletRequest
public java.lang.String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
public java.lang.StringBuffer getRequestURL()
getRequestURL
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public java.lang.String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public java.lang.String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getServletName()
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletRequest
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletRequest
public void setCharacterEncoding(java.lang.String encoding) throws java.io.UnsupportedEncodingException
setCharacterEncoding
in interface javax.servlet.ServletRequest
java.io.UnsupportedEncodingException
public void setCharacterEncodingUnchecked(java.lang.String encoding)
public void setServerName(java.lang.String host)
host
- The host to set.public void setServerPort(int port)
port
- The port to set.public void setRemoteAddr(java.lang.String addr)
addr
- The address to set.public void setRemoteHost(java.lang.String host)
host
- The host to set.public HttpURI getUri()
public void setUri(HttpURI uri)
uri
- The uri to set.public HttpConnection getConnection()
public int getInputState()
public void setAuthType(java.lang.String authType)
authType
- The authType to set.public void setCookies(javax.servlet.http.Cookie[] cookies)
cookies
- The cookies to set.public void setMethod(java.lang.String method)
method
- The method to set.public void setPathInfo(java.lang.String pathInfo)
pathInfo
- The pathInfo to set.public void setProtocol(java.lang.String protocol)
protocol
- The protocol to set.public void setRequestedSessionId(java.lang.String requestedSessionId)
requestedSessionId
- The requestedSessionId to set.public SessionManager getSessionManager()
public void setSessionManager(SessionManager sessionManager)
sessionManager
- The sessionManager to set.public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie)
requestedSessionIdCookie
- The requestedSessionIdCookie to set.public void setSession(javax.servlet.http.HttpSession session)
session
- The session to set.public void setScheme(java.lang.String scheme)
scheme
- The scheme to set.public void setQueryString(java.lang.String queryString)
queryString
- The queryString to set.public void setRequestURI(java.lang.String requestURI)
requestURI
- The requestURI to set.public void setContextPath(java.lang.String contextPath)
HttpServletRequest.getContextPath()
public void setServletPath(java.lang.String servletPath)
servletPath
- The servletPath to set.public void setServletName(java.lang.String name)
name
- The servletName to set.public void setUserPrincipal(java.security.Principal userPrincipal)
userPrincipal
- The userPrincipal to set.public void setContext(ContextHandler.SContext context)
context
- public ContextHandler.SContext getContext()
context
used for this request, or null
if setContext(org.mortbay.jetty.handler.ContextHandler.SContext)
has not yet
been called.public java.lang.StringBuffer getRootURL()
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.
public Attributes getAttributes()
public void setAttributes(Attributes attributes)
public Continuation getContinuation()
public Continuation getContinuation(boolean create)
public MultiMap getParameters()
public void setParameters(MultiMap parameters)
parameters
- The parameters to set.public java.lang.String toString()
toString
in class java.lang.Object
public static Request getRequest(javax.servlet.http.HttpServletRequest request)
public void addEventListener(java.util.EventListener listener)
public void removeEventListener(java.util.EventListener listener)
public void setRequestListeners(java.lang.Object requestListeners)
requestListeners
- LazyList
of ServletRequestListener
spublic java.lang.Object takeRequestListeners()
LazyList
of ServletRequestListener
spublic void saveNewSession(java.lang.Object key, javax.servlet.http.HttpSession session)
public javax.servlet.http.HttpSession recoverNewSession(java.lang.Object key)
public UserRealm getUserRealm()
public void setUserRealm(UserRealm userRealm)
userRealm
- The userRealm to set.public java.lang.String getQueryEncoding()
public void setQueryEncoding(java.lang.String queryEncoding)
queryEncoding
- public void setRoleMap(java.util.Map map)
public java.util.Map getRoleMap()
public javax.servlet.ServletContext getServletContext()
public javax.servlet.ServletResponse getServletResponse()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |