org.mortbay.jetty
public class Request extends java.lang.Object implements HttpServletRequest
Implements 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.
The form content that a request can process is limited to protect from Denial of Service
attacks. The size in bytes is limited by ContextHandler.getMaxFormContentSize() or if there is no
context then the "org.eclipse.jetty.server.Request.maxFormContentSize" Server attribute.
The number of parameters keys is limited by ContextHandler.getMaxFormKeys() or if there is no
context then the "org.eclipse.jetty.server.Request.maxFormKeys" Server attribute.
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH| Constructor and Description |
|---|
Request() |
Request(HttpConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(java.util.EventListener listener) |
java.lang.Object |
getAttribute(java.lang.String name) |
java.util.Enumeration |
getAttributeNames() |
org.mortbay.util.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() |
org.mortbay.util.ajax.Continuation |
getContinuation() |
org.mortbay.util.ajax.Continuation |
getContinuation(boolean create) |
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() |
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() |
org.mortbay.util.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(HttpServletRequest request) |
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() |
ServletContext |
getServletContext() |
java.lang.String |
getServletName() |
java.lang.String |
getServletPath() |
ServletResponse |
getServletResponse() |
HttpSession |
getSession() |
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) |
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,
HttpSession session) |
void |
setAttribute(java.lang.String name,
java.lang.Object value) |
void |
setAttributes(org.mortbay.util.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(Cookie[] cookies) |
void |
setHandled(boolean h) |
void |
setMethod(java.lang.String method) |
void |
setParameters(org.mortbay.util.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(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() |
public Request()
public Request(HttpConnection connection)
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 ServletRequestpublic java.util.Enumeration getAttributeNames()
getAttributeNames in interface ServletRequestpublic java.lang.String getAuthType()
getAuthType in interface HttpServletRequestpublic java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ServletRequestpublic long getContentRead()
public int getContentLength()
getContentLength in interface ServletRequestpublic java.lang.String getContentType()
getContentType in interface ServletRequestpublic void setContentType(java.lang.String contentType)
public java.lang.String getContextPath()
getContextPath in interface HttpServletRequestpublic Cookie[] getCookies()
getCookies in interface HttpServletRequestpublic long getDateHeader(java.lang.String name)
getDateHeader in interface HttpServletRequestpublic java.lang.String getHeader(java.lang.String name)
getHeader in interface HttpServletRequestpublic java.util.Enumeration getHeaderNames()
getHeaderNames in interface HttpServletRequestpublic java.util.Enumeration getHeaders(java.lang.String name)
getHeaders in interface HttpServletRequestpublic ServletInputStream getInputStream() throws java.io.IOException
getInputStream in interface ServletRequestjava.io.IOExceptionpublic int getIntHeader(java.lang.String name)
getIntHeader in interface HttpServletRequestpublic java.lang.String getLocalAddr()
getLocalAddr in interface ServletRequestpublic java.util.Locale getLocale()
getLocale in interface ServletRequestpublic java.util.Enumeration getLocales()
getLocales in interface ServletRequestpublic java.lang.String getLocalName()
getLocalName in interface ServletRequestpublic int getLocalPort()
getLocalPort in interface ServletRequestpublic java.lang.String getMethod()
getMethod in interface HttpServletRequestpublic java.lang.String getParameter(java.lang.String name)
getParameter in interface ServletRequestpublic java.util.Map getParameterMap()
getParameterMap in interface ServletRequestpublic java.util.Enumeration getParameterNames()
getParameterNames in interface ServletRequestpublic java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues in interface ServletRequestpublic java.lang.String getPathInfo()
getPathInfo in interface HttpServletRequestpublic java.lang.String getPathTranslated()
getPathTranslated in interface HttpServletRequestpublic java.lang.String getProtocol()
getProtocol in interface ServletRequestpublic java.io.BufferedReader getReader()
throws java.io.IOException
getReader in interface ServletRequestjava.io.IOExceptionpublic java.lang.String getRealPath(java.lang.String path)
getRealPath in interface ServletRequestpublic java.lang.String getRemoteAddr()
getRemoteAddr in interface ServletRequestpublic java.lang.String getRemoteHost()
getRemoteHost in interface ServletRequestpublic int getRemotePort()
getRemotePort in interface ServletRequestpublic java.lang.String getRemoteUser()
getRemoteUser in interface HttpServletRequestpublic RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher in interface ServletRequestpublic java.lang.String getRequestedSessionId()
getRequestedSessionId in interface HttpServletRequestpublic java.lang.String getRequestURI()
getRequestURI in interface HttpServletRequestpublic java.lang.StringBuffer getRequestURL()
getRequestURL in interface HttpServletRequestpublic java.lang.String getScheme()
getScheme in interface ServletRequestpublic java.lang.String getServerName()
getServerName in interface ServletRequestpublic int getServerPort()
getServerPort in interface ServletRequestpublic java.lang.String getServletPath()
getServletPath in interface HttpServletRequestpublic java.lang.String getServletName()
public HttpSession getSession()
getSession in interface HttpServletRequestpublic HttpSession getSession(boolean create)
getSession in interface HttpServletRequestpublic java.security.Principal getUserPrincipal()
getUserPrincipal in interface HttpServletRequestpublic java.lang.String getQueryString()
getQueryString in interface HttpServletRequestpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface HttpServletRequestpublic boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl in interface HttpServletRequestpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface HttpServletRequestpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface HttpServletRequestpublic boolean isSecure()
isSecure in interface ServletRequestpublic boolean isUserInRole(java.lang.String role)
isUserInRole in interface HttpServletRequestpublic void removeAttribute(java.lang.String name)
removeAttribute in interface ServletRequestpublic void setAttribute(java.lang.String name,
java.lang.Object value)
setAttribute in interface ServletRequestpublic void setCharacterEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface ServletRequestjava.io.UnsupportedEncodingExceptionpublic 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(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(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 org.mortbay.util.Attributes getAttributes()
public void setAttributes(org.mortbay.util.Attributes attributes)
public org.mortbay.util.ajax.Continuation getContinuation()
public org.mortbay.util.ajax.Continuation getContinuation(boolean create)
public org.mortbay.util.MultiMap getParameters()
public void setParameters(org.mortbay.util.MultiMap parameters)
parameters - The parameters to set.public java.lang.String toString()
toString in class java.lang.Objectpublic static Request getRequest(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 ServletRequestListenerspublic java.lang.Object takeRequestListeners()
LazyList of ServletRequestListenerspublic void saveNewSession(java.lang.Object key,
HttpSession session)
public 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 ServletContext getServletContext()
public ServletResponse getServletResponse()
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.