|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.server.Request
public class Request
Jetty Request.
Implements HttpServletRequest
from the javax.servlet.http
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 behavior. For example
getContextPath()
method will return null, until the request has been
passed to a ContextHandler
which matches the getPathInfo()
with a context
path and calls setContextPath(String)
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 org.eclipse.jetty.servlet.ServletHandler
and the pathInfo matched
against the servlet URL patterns and setServletPath(String)
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 | |
---|---|
protected AsyncContinuation |
_async
|
protected HttpConnection |
_connection
|
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)
|
void |
extractParameters()
Extract Paramters from query string and/or form _content. |
AsyncContext |
getAsyncContext()
|
AsyncContinuation |
getAsyncContinuation()
|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
Attributes |
getAttributes()
|
Authentication |
getAuthentication()
Get the authentication. |
java.lang.String |
getAuthType()
|
java.lang.String |
getCharacterEncoding()
|
HttpConnection |
getConnection()
|
int |
getContentLength()
|
long |
getContentRead()
|
java.lang.String |
getContentType()
|
ContextHandler.Context |
getContext()
|
java.lang.String |
getContextPath()
|
javax.servlet.http.Cookie[] |
getCookies()
|
long |
getDateHeader(java.lang.String name)
|
DispatcherType |
getDispatcherType()
|
long |
getDispatchTime()
Get timestamp of the request dispatch |
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<java.lang.String> |
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()
|
UserIdentity |
getResolvedUserIdentity()
|
Response |
getResponse()
|
java.lang.StringBuilder |
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()
|
UserIdentity |
getUserIdentity()
|
UserIdentity.Scope |
getUserIdentityScope()
|
java.security.Principal |
getUserPrincipal()
|
boolean |
isAsyncStarted()
|
boolean |
isAsyncSupported()
|
boolean |
isHandled()
|
boolean |
isRequestedSessionIdFromCookie()
|
boolean |
isRequestedSessionIdFromUrl()
|
boolean |
isRequestedSessionIdFromURL()
|
boolean |
isRequestedSessionIdValid()
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
void |
mergeQueryString(java.lang.String query)
Merge in a new query string. |
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 |
setAsyncSupported(boolean supported)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setAttributes(Attributes attributes)
|
void |
setAuthentication(Authentication authentication)
Set the authentication. |
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.Context context)
Set request context |
void |
setContextPath(java.lang.String contextPath)
Sets the "context path" for this request |
void |
setCookies(javax.servlet.http.Cookie[] cookies)
|
void |
setDispatcherType(DispatcherType type)
|
void |
setDispatchTime(long value)
Set timetstamp of request dispatch |
void |
setHandled(boolean h)
|
void |
setMethod(java.lang.String method)
|
void |
setParameters(MultiMap<java.lang.String> 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 |
setRequestURI(java.lang.String requestURI)
|
void |
setScheme(java.lang.String scheme)
|
void |
setServerName(java.lang.String host)
|
void |
setServerPort(int port)
|
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 |
setUserIdentityScope(UserIdentity.Scope scope)
|
AsyncContext |
startAsync()
|
AsyncContext |
startAsync(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse)
|
boolean |
takeNewContext()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.servlet.http.HttpServletRequest |
---|
authenticate, getPart, getParts, login, logout |
Field Detail |
---|
protected final AsyncContinuation _async
protected HttpConnection _connection
Constructor Detail |
---|
public Request()
public Request(HttpConnection connection)
Method Detail |
---|
public static Request getRequest(javax.servlet.http.HttpServletRequest request)
public void addEventListener(java.util.EventListener listener)
public void extractParameters()
public AsyncContext getAsyncContext()
getAsyncContext
in interface javax.servlet.ServletRequest
public AsyncContinuation getAsyncContinuation()
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 Attributes getAttributes()
public Authentication getAuthentication()
public java.lang.String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
public HttpConnection getConnection()
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public long getContentRead()
public java.lang.String getContentType()
getContentType
in interface javax.servlet.ServletRequest
public ContextHandler.Context getContext()
context
used for this request, or null
if setContext(org.eclipse.jetty.server.handler.ContextHandler.Context)
has not yet
been called.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 DispatcherType getDispatcherType()
getDispatcherType
in interface javax.servlet.ServletRequest
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 int getInputState()
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 MultiMap<java.lang.String> getParameters()
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.lang.String getQueryEncoding()
public java.lang.String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
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 Response getResponse()
public java.lang.StringBuilder 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 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 javax.servlet.ServletContext getServletContext()
getServletContext
in interface javax.servlet.ServletRequest
public java.lang.String getServletName()
public java.lang.String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.ServletResponse getServletResponse()
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 SessionManager getSessionManager()
public long getTimeStamp()
public Buffer getTimeStampBuffer()
public HttpURI getUri()
public UserIdentity getUserIdentity()
public UserIdentity getResolvedUserIdentity()
Authentication
is not Authentication.User
(eg. Authentication.Deferred
).public UserIdentity.Scope getUserIdentityScope()
public java.security.Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public long getDispatchTime()
public boolean isAsyncStarted()
isAsyncStarted
in interface javax.servlet.ServletRequest
public boolean isAsyncSupported()
isAsyncSupported
in interface javax.servlet.ServletRequest
public boolean isHandled()
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 javax.servlet.http.HttpSession recoverNewSession(java.lang.Object key)
protected void recycle()
public void removeAttribute(java.lang.String name)
removeAttribute
in interface javax.servlet.ServletRequest
public void removeEventListener(java.util.EventListener listener)
public void saveNewSession(java.lang.Object key, javax.servlet.http.HttpSession session)
public void setAsyncSupported(boolean supported)
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletRequest
public void setAttributes(Attributes attributes)
public void setAuthentication(Authentication authentication)
authentication
- the authentication to setpublic 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)
protected final void setConnection(HttpConnection connection)
public void setContentType(java.lang.String contentType)
public void setContext(ContextHandler.Context context)
context
- context objectpublic boolean takeNewContext()
takeNewContext()
since the last setContext(org.eclipse.jetty.server.handler.ContextHandler.Context)
call.public void setContextPath(java.lang.String contextPath)
HttpServletRequest.getContextPath()
public void setCookies(javax.servlet.http.Cookie[] cookies)
cookies
- The cookies to set.public void setDispatcherType(DispatcherType type)
public void setHandled(boolean h)
public void setMethod(java.lang.String method)
method
- The method to set.public void setParameters(MultiMap<java.lang.String> parameters)
parameters
- The parameters 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 setQueryEncoding(java.lang.String queryEncoding)
queryEncoding
- public void setQueryString(java.lang.String queryString)
queryString
- The queryString 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 void setRequestedSessionId(java.lang.String requestedSessionId)
requestedSessionId
- The requestedSessionId to set.public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie)
requestedSessionIdCookie
- The requestedSessionIdCookie to set.public void setRequestURI(java.lang.String requestURI)
requestURI
- The requestURI to set.public void setScheme(java.lang.String scheme)
scheme
- The scheme to set.public void setServerName(java.lang.String host)
host
- The host to set.public void setServerPort(int port)
port
- The port to set.public void setServletPath(java.lang.String servletPath)
servletPath
- The servletPath to set.public void setSession(javax.servlet.http.HttpSession session)
session
- The session to set.public void setSessionManager(SessionManager sessionManager)
sessionManager
- The sessionManager to set.public void setTimeStamp(long ts)
public void setUri(HttpURI uri)
uri
- The uri to set.public void setUserIdentityScope(UserIdentity.Scope scope)
public void setDispatchTime(long value)
value
- timestamppublic AsyncContext startAsync() throws java.lang.IllegalStateException
startAsync
in interface javax.servlet.ServletRequest
java.lang.IllegalStateException
public AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws java.lang.IllegalStateException
startAsync
in interface javax.servlet.ServletRequest
java.lang.IllegalStateException
public java.lang.String toString()
toString
in class java.lang.Object
public void mergeQueryString(java.lang.String query)
setParameters(MultiMap)
and setQueryString(String)
are called with the result.
The merge is according to the rules of the servlet dispatch forward method.
query
- The query string to merge into the request.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |