Top Description Fields Constructors Methods
org.mortbay.jetty

public Class Request

extends Suspendable
implements HttpServletRequest
Class Inheritance
All Implemented Interfaces
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, .UnsupportedEncodingException, java.net.InetAddress, java.nio.ByteBuffer, java.security.Principal, java.util.Collection, .Collections, .Enumeration, .EventListener, .HashMap, .Iterator, .List, .Locale, .Map, javax.servlet.RequestDispatcher, .ServletContext, .ServletInputStream, .ServletRequestAttributeEvent, .ServletRequestAttributeListener, .ServletRequestWrapper, .ServletResponse, javax.servlet.http.Cookie, .HttpServletRequest, .HttpSession, org.mortbay.io.Buffer, .BufferUtil, .EndPoint, org.mortbay.io.nio.DirectNIOBuffer, .IndirectNIOBuffer, .NIOBuffer, org.mortbay.jetty.handler.CompleteHandler, .ContextHandler, .SecurityHandler, .ContextHandler.SContext, org.mortbay.log.Log, org.mortbay.util.Attributes, .AttributesMap, .LazyList, .MultiMap, .StringUtil, .URIUtil, .UrlEncoded, org.mortbay.util.ajax.Continuation

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

A request instance is created for each 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.
Author
gregw

Field Summary

Modifier and TypeField and Description
private static final Collection<E>
private static final int
private static final int
private Attributes
private String
private MultiMap<K>
private String
private ContextHandler.SContext
private String
private Continuation
_continuation

Deprecated as a consequence of Continuation being deprecated.
private CookieCutter
private boolean
private boolean
private EndPoint
private boolean
private int
private String
private MultiMap<K>
private boolean
private String
private int
private String
private String
private String
private BufferedReader
private String
private String
private String
private Object
private String
private boolean
private String
private Map<K, V>
private Map<K, V>
private String
private String
private String
private String
private HttpSession
private SessionManager
private static final int
private long
private Buffer
private HttpURI
private Principal
private UserRealm
Inherited from org.mortbay.jetty.Suspendable:
_connection_initial_resumed_state_timeout_timeoutMs_timeoutTask

Constructor Summary

AccessConstructor and Description
public
public
Request(HttpConnection connection)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
public void
private void
public Object
getAttribute(String
a String specifying the name of the attribute
name
)

Implements javax.servlet.ServletRequest.getAttribute.

Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
public Enumeration<E>
getAttributeNames()

Implements javax.servlet.ServletRequest.getAttributeNames.

Returns an Enumeration containing the names of the attributes available to this request.
public Attributes
public String
getAuthType()

Implements javax.servlet.http.HttpServletRequest.getAuthType.

Returns the name of the authentication scheme used to protect the servlet.
public String
getCharacterEncoding()

Implements javax.servlet.ServletRequest.getCharacterEncoding.

Returns the name of the character encoding used in the body of this request.
public HttpConnection

Returns:

Returns the connection.
getConnection
()

public int
getContentLength()

Implements javax.servlet.ServletRequest.getContentLength.

Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known ir is greater than Integer.MAX_VALUE.
public String
getContentType()

Implements javax.servlet.ServletRequest.getContentType.

Returns the MIME type of the body of the request, or null if the type is not known.
public ContextHandler.SContext

Returns:

The current context used for this request, or null if setContext has not yet been called.
getContext
()

public String
getContextPath()

Implements javax.servlet.http.HttpServletRequest.getContextPath.

Returns the portion of the request URI that indicates the context of the request.
public Continuation
getContinuation()

Deprecated
public Continuation
getContinuation(boolean create)

Deprecated
public Cookie[]
getCookies()

Implements javax.servlet.http.HttpServletRequest.getCookies.

Returns an array containing all of the Cookie objects the client sent with this request.
public long
getDateHeader(String
a String specifying the name of the header
name
)

Implements javax.servlet.http.HttpServletRequest.getDateHeader.

Returns the value of the specified request header as a long value that represents a Date object.
public String
getHeader(String
a String specifying the header name
name
)

Implements javax.servlet.http.HttpServletRequest.getHeader.

Returns the value of the specified request header as a String.
public Enumeration<E>
getHeaderNames()

Implements javax.servlet.http.HttpServletRequest.getHeaderNames.

Returns an enumeration of all the header names this request contains.
public Enumeration<E>
getHeaders(String
a String specifying the header name
name
)

Implements javax.servlet.http.HttpServletRequest.getHeaders.

Returns all the values of the specified request header as an Enumeration of String objects.
public int

Returns:

Returns the inputState.
getInputState
()

public ServletInputStream
getInputStream()

Implements javax.servlet.ServletRequest.getInputStream.

Retrieves the body of the request as binary data using a ServletInputStream.
public int
getIntHeader(String
a String specifying the name of a request header
name
)

Implements javax.servlet.http.HttpServletRequest.getIntHeader.

Returns the value of the specified request header as an int.
public String
getLocalAddr()

Implements javax.servlet.ServletRequest.getLocalAddr.

Returns the Internet Protocol (IP) address of the interface on which the request was received.
public Locale
getLocale()

Implements javax.servlet.ServletRequest.getLocale.

Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
public Enumeration<E>
getLocales()

Implements javax.servlet.ServletRequest.getLocales.

Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the client based on the Accept-Language header.
public String
getLocalName()

Implements javax.servlet.ServletRequest.getLocalName.

Returns the host name of the Internet Protocol (IP) interface on which the request was received.
public int
getLocalPort()

Implements javax.servlet.ServletRequest.getLocalPort.

Returns the Internet Protocol (IP) port number of the interface on which the request was received.
public String
getMethod()

Implements javax.servlet.http.HttpServletRequest.getMethod.

Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
public String
getParameter(String
a String specifying the name of the parameter
name
)

Implements javax.servlet.ServletRequest.getParameter.

Returns the value of a request parameter as a String, or null if the parameter does not exist.
public Map<K, V>
getParameterMap()

Implements javax.servlet.ServletRequest.getParameterMap.

Returns a java.util.Map of the parameters of this request.
public Enumeration<E>
getParameterNames()

Implements javax.servlet.ServletRequest.getParameterNames.

Returns an Enumeration of String objects containing the names of the parameters contained in this request.
public MultiMap<K>

Returns:

Returns the parameters.
getParameters
()

public String[]
getParameterValues(String
a String containing the name of the parameter whose value is requested
name
)

Implements javax.servlet.ServletRequest.getParameterValues.

Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
public String
getPathInfo()

Implements javax.servlet.http.HttpServletRequest.getPathInfo.

Returns any extra path information associated with the URL the client sent when it made this request.
public String
getPathTranslated()

Implements javax.servlet.http.HttpServletRequest.getPathTranslated.

Returns any extra path information after the servlet name but before the query string, and translates it to a real path.
public String
getProtocol()

Implements javax.servlet.ServletRequest.getProtocol.

Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
public String
public String
getQueryString()

Implements javax.servlet.http.HttpServletRequest.getQueryString.

Returns the query string that is contained in the request URL after the path.
public BufferedReader
getReader()

Implements javax.servlet.ServletRequest.getReader.

Retrieves the body of the request as character data using a BufferedReader.
public String
getRealPath(String
the path for which the real path is to be returned.
path
)

Implements javax.servlet.ServletRequest.getRealPath.

public String
getRemoteAddr()

Implements javax.servlet.ServletRequest.getRemoteAddr.

Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
public String
getRemoteHost()

Implements javax.servlet.ServletRequest.getRemoteHost.

Returns the fully qualified name of the client or the last proxy that sent the request.
public int
getRemotePort()

Implements javax.servlet.ServletRequest.getRemotePort.

Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
public String
getRemoteUser()

Implements javax.servlet.http.HttpServletRequest.getRemoteUser.

Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
public static Request
public RequestDispatcher
getRequestDispatcher(String
a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet.
path
)

Implements javax.servlet.ServletRequest.getRequestDispatcher.

Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.
public String
getRequestedSessionId()

Implements javax.servlet.http.HttpServletRequest.getRequestedSessionId.

Returns the session ID specified by the client.
public String
getRequestURI()

Implements javax.servlet.http.HttpServletRequest.getRequestURI.

Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
public StringBuffer
getRequestURL()

Implements javax.servlet.http.HttpServletRequest.getRequestURL.

Reconstructs the URL the client used to make the request.
public Map<K, V>
public StringBuilder

Returns:

"scheme://host:port"
getRootURL
()

Reconstructs the URL the client used to make the request.

public String
getScheme()

Implements javax.servlet.ServletRequest.getScheme.

Returns the name of the scheme used to make this request, for example, http, https, or ftp.
public String
getServerName()

Implements javax.servlet.ServletRequest.getServerName.

Returns the host name of the server to which the request was sent.
public int
getServerPort()

Implements javax.servlet.ServletRequest.getServerPort.

Returns the port number to which the request was sent.
public ServletContext
getServletContext()

Implements javax.servlet.ServletRequest.getServletContext.

Gets the servlet context to which this ServletRequest was last dispatched.
public String
public String
getServletPath()

Implements javax.servlet.http.HttpServletRequest.getServletPath.

Returns the part of this request's URL that calls the servlet.
public ServletResponse
public HttpSession
getSession()

Implements javax.servlet.http.HttpServletRequest.getSession.

Returns the current session associated with this request, or if the request does not have a session, creates one.
public HttpSession
getSession(boolean
true to create a new session for this request if necessary; false to return null if there's no current session
create
)

Implements javax.servlet.http.HttpServletRequest.getSession.

Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
public SessionManager

Returns:

Returns the sessionManager.
getSessionManager
()

public long

Returns:

The time that the request was received.
getTimeStamp
()

Get Request TimeStamp

public Buffer

Returns:

The time that the request was received.
getTimeStampBuffer
()

Get Request TimeStamp

public HttpURI

Returns:

Returns the uri.
getUri
()

public Principal
getUserPrincipal()

Implements javax.servlet.http.HttpServletRequest.getUserPrincipal.

Returns a java.security.Principal object containing the name of the current authenticated user.
public UserRealm

Returns:

Returns the userRealm.
getUserRealm
()

public boolean
public boolean
isRequestedSessionIdFromCookie()

Implements javax.servlet.http.HttpServletRequest.isRequestedSessionIdFromCookie.

Checks whether the requested session ID was conveyed to the server as an HTTP cookie.

public boolean
public boolean
isRequestedSessionIdFromURL()

Implements javax.servlet.http.HttpServletRequest.isRequestedSessionIdFromURL.

Checks whether the requested session ID was conveyed to the server as part of the request URL.

public boolean
isRequestedSessionIdValid()

Implements javax.servlet.http.HttpServletRequest.isRequestedSessionIdValid.

Checks whether the requested session ID is still valid.
public boolean
isSecure()

Implements javax.servlet.ServletRequest.isSecure.

Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
public boolean
isUserInRole(String
a String specifying the name of the role
role
)

Implements javax.servlet.http.HttpServletRequest.isUserInRole.

Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
public HttpSession
protected void
public void
removeAttribute(String
a String specifying the name of the attribute to remove
name
)

Implements javax.servlet.ServletRequest.removeAttribute.

Removes an attribute from this request.
public synchronized void
public void
public void
public void
setAttribute(String
a String specifying the name of the attribute
name
,
Object
the Object to be stored
value
)

Implements javax.servlet.ServletRequest.setAttribute.

Stores an attribute in this request.
public void
public void
setAuthType(String
The authType to set.
authType
)

public void
setCharacterEncoding(String
String containing the name of the character encoding.
encoding
)

Implements javax.servlet.ServletRequest.setCharacterEncoding.

Overrides the name of the character encoding used in the body of this request.
public void
protected void
public void
setContentType(String contentType)

public void
public void
setContextPath(String contextPath)

Sets the "context path" for this request

pack-priv void
setContinuation(Continuation cont)

Deprecated as a consequence of Continuation being deprecated.
public void
setCookies(Cookie[]
The cookies to set.
cookies
)

public void
setHandled(boolean h)

public void
setMethod(String
The method to set.
method
)

public void
setParameters(MultiMap<K>
The parameters to set.
parameters
)

public void
setPathInfo(String
The pathInfo to set.
pathInfo
)

public void
setProtocol(String
The protocol to set.
protocol
)

public void
setQueryEncoding(String queryEncoding)

Set the character encoding used for the query string.

public void
setQueryString(String
The queryString to set.
queryString
)

public void
setRemoteAddr(String
The address to set.
addr
)

public void
setRemoteHost(String
The host to set.
host
)

public void
setRequestedSessionId(String
The requestedSessionId to set.
requestedSessionId
)

public void
setRequestedSessionIdFromCookie(boolean
The requestedSessionIdCookie to set.
requestedSessionIdCookie
)

public void
setRequestURI(String
The requestURI to set.
requestURI
)

public void
setRoleMap(Map<K, V> map)

public void
setScheme(String
The scheme to set.
scheme
)

public void
setServerName(String
The host to set.
host
)

public void
setServerPort(int
The port to set.
port
)

public void
setServletName(String
The servletName to set.
name
)

public void
setServletPath(String
The servletPath to set.
servletPath
)

public void
setSession(HttpSession
The session to set.
session
)

public void
setSessionManager(SessionManager
The sessionManager to set.
sessionManager
)

public void
setTimeStamp(long ts)

public void
setUri(HttpURI
The uri to set.
uri
)

public void
setUserPrincipal(Principal
The userPrincipal to set.
userPrincipal
)

public void
setUserRealm(UserRealm
The userRealm to set.
userRealm
)

public void
public String
toString()

Overrides org.mortbay.jetty.Suspendable.toString.

Returns a string representation of the object.
Inherited from org.mortbay.jetty.Suspendable:
cancelTimeoutexpiregetStatusStringgetTimeouthandlingisCompletingisInitialisResumedisSuspendedisTimeoutresetscheduleDispatchscheduleTimeoutshouldCompleteshouldHandleRequestsuspendunhandling