public class Request extends 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) |
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 Object getAttribute(String name)
getAttribute in interface ServletRequestpublic Enumeration getAttributeNames()
getAttributeNames in interface ServletRequestpublic String getAuthType()
getAuthType in interface HttpServletRequestpublic String getCharacterEncoding()
getCharacterEncoding in interface ServletRequestpublic long getContentRead()
public int getContentLength()
getContentLength in interface ServletRequestpublic String getContentType()
getContentType in interface ServletRequestpublic void setContentType(String contentType)
public String getContextPath()
getContextPath in interface HttpServletRequestpublic Cookie[] getCookies()
getCookies in interface HttpServletRequestpublic long getDateHeader(String name)
getDateHeader in interface HttpServletRequestpublic String getHeader(String name)
getHeader in interface HttpServletRequestpublic Enumeration getHeaderNames()
getHeaderNames in interface HttpServletRequestpublic Enumeration getHeaders(String name)
getHeaders in interface HttpServletRequestpublic ServletInputStream getInputStream() throws IOException
getInputStream in interface ServletRequestIOExceptionpublic int getIntHeader(String name)
getIntHeader in interface HttpServletRequestpublic String getLocalAddr()
getLocalAddr in interface ServletRequestpublic Locale getLocale()
getLocale in interface ServletRequestpublic Enumeration getLocales()
getLocales in interface ServletRequestpublic String getLocalName()
getLocalName in interface ServletRequestpublic int getLocalPort()
getLocalPort in interface ServletRequestpublic String getMethod()
getMethod in interface HttpServletRequestpublic String getParameter(String name)
getParameter in interface ServletRequestpublic Map getParameterMap()
getParameterMap in interface ServletRequestpublic Enumeration getParameterNames()
getParameterNames in interface ServletRequestpublic String[] getParameterValues(String name)
getParameterValues in interface ServletRequestpublic String getPathInfo()
getPathInfo in interface HttpServletRequestpublic String getPathTranslated()
getPathTranslated in interface HttpServletRequestpublic String getProtocol()
getProtocol in interface ServletRequestpublic BufferedReader getReader() throws IOException
getReader in interface ServletRequestIOExceptionpublic String getRealPath(String path)
getRealPath in interface ServletRequestpublic String getRemoteAddr()
getRemoteAddr in interface ServletRequestpublic String getRemoteHost()
getRemoteHost in interface ServletRequestpublic int getRemotePort()
getRemotePort in interface ServletRequestpublic String getRemoteUser()
getRemoteUser in interface HttpServletRequestpublic RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface ServletRequestpublic String getRequestedSessionId()
getRequestedSessionId in interface HttpServletRequestpublic String getRequestURI()
getRequestURI in interface HttpServletRequestpublic StringBuffer getRequestURL()
getRequestURL in interface HttpServletRequestpublic String getScheme()
getScheme in interface ServletRequestpublic String getServerName()
getServerName in interface ServletRequestpublic int getServerPort()
getServerPort in interface ServletRequestpublic String getServletPath()
getServletPath in interface HttpServletRequestpublic String getServletName()
public HttpSession getSession()
getSession in interface HttpServletRequestpublic HttpSession getSession(boolean create)
getSession in interface HttpServletRequestpublic Principal getUserPrincipal()
getUserPrincipal in interface HttpServletRequestpublic 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(String role)
isUserInRole in interface HttpServletRequestpublic void removeAttribute(String name)
removeAttribute in interface ServletRequestpublic void setAttribute(String name, Object value)
setAttribute in interface ServletRequestpublic void setCharacterEncoding(String encoding) throws UnsupportedEncodingException
setCharacterEncoding in interface ServletRequestUnsupportedEncodingExceptionpublic void setCharacterEncodingUnchecked(String encoding)
public void setServerName(String host)
host - The host to set.public void setServerPort(int port)
port - The port to set.public void setRemoteAddr(String addr)
addr - The address to set.public void setRemoteHost(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(String authType)
authType - The authType to set.public void setCookies(Cookie[] cookies)
cookies - The cookies to set.public void setMethod(String method)
method - The method to set.public void setPathInfo(String pathInfo)
pathInfo - The pathInfo to set.public void setProtocol(String protocol)
protocol - The protocol to set.public void setRequestedSessionId(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(String scheme)
scheme - The scheme to set.public void setQueryString(String queryString)
queryString - The queryString to set.public void setRequestURI(String requestURI)
requestURI - The requestURI to set.public void setContextPath(String contextPath)
HttpServletRequest.getContextPath()public void setServletPath(String servletPath)
servletPath - The servletPath to set.public void setServletName(String name)
name - The servletName to set.public void setUserPrincipal(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 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 static Request getRequest(HttpServletRequest request)
public void addEventListener(EventListener listener)
public void removeEventListener(EventListener listener)
public void setRequestListeners(Object requestListeners)
requestListeners - LazyList of ServletRequestListenerspublic Object takeRequestListeners()
LazyList of ServletRequestListenerspublic void saveNewSession(Object key, HttpSession session)
public HttpSession recoverNewSession(Object key)
public UserRealm getUserRealm()
public void setUserRealm(UserRealm userRealm)
userRealm - The userRealm to set.public String getQueryEncoding()
public void setQueryEncoding(String queryEncoding)
queryEncoding - public void setRoleMap(Map map)
public Map getRoleMap()
public ServletContext getServletContext()
public ServletResponse getServletResponse()
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.