Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.servlet

public Class HttpServletRequestImpl

extends Object
implements HttpServletRequest, RequestHolder
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.servlet.Holders.RequestHolder, jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest
Static Imports
java.util.concurrent.TimeUnit.MILLISECONDS, .TimeUnit.SECONDS

Facade class that wraps a Request request object. All methods are delegated to the wrapped request.
Authors
Craig R. McClanahan, Remy Maucherat, Jean-Francois Arcand
Version
$Revision: 1.7 $ $Date: 2007/08/01 19:04:28 $

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private class
private static class
pack-priv static class
HttpServletRequestImpl.WebConnectionFactory

The static factory is required to avoid NoClassDefFoundError when running w/ Servlet 3.0 API and JDK6

Field Summary

Modifier and TypeField and Description
private AsyncContextImpl
private final AtomicBoolean
private Thread
private static final ThreadCache.CachedTypeIndex<HttpServletRequestImpl>
private WebappContext
private String
private HttpServletMapping
httpServletMapping

Mapping that invoked this request.

private HttpSessionImpl
private HttpUpgradeHandler
private final ServletInputStreamImpl
private boolean
private boolean
isAsyncSupported

Async operation

private static final Logger
private String
private ServletReaderImpl
protected Request
request

The wrapped request.

private String
protected HttpServletResponseImpl
servletResponse

The corresponding servlet response

private boolean
protected boolean
usingInputStream

Using stream flag.

protected boolean
usingReader

Using writer flag.

Constructor Summary

AccessConstructor and Description
protected
HttpServletRequestImpl()

Construct a wrapper for the specified request.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
public boolean
authenticate(HttpServletResponse hsr)

Implements jakarta.servlet.http.HttpServletRequest.authenticate.

Use the container login mechanism configured for the ServletContext to authenticate the user making this request.

public String
changeSessionId()

Implements jakarta.servlet.http.HttpServletRequest.changeSessionId.

Change the session id of the current session associated with this request and return the new session id.

protected Object
clone()

Overrides java.lang.Object.clone.

Prevent cloning the facade.

public static HttpServletRequestImpl
public void
disableAsyncSupport()

Disables async support for this request.

pack-priv void
public AsyncContext
getAsyncContext()

Implements jakarta.servlet.ServletRequest.getAsyncContext.

Gets the AsyncContext that was created or reinitialized by the most recent invocation of startAsync or startAsync(ServletRequest, ServletResponse) on this request.

public Object
getAttribute(String name)

Implements jakarta.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<String>
getAttributeNames()

Implements jakarta.servlet.ServletRequest.getAttributeNames.

Returns an Enumeration containing the names of the attributes available to this request.

public String
getAuthType()

Implements jakarta.servlet.http.HttpServletRequest.getAuthType.

Returns the name of the authentication scheme used to protect the servlet.

public String
getCharacterEncoding()

Implements jakarta.servlet.ServletRequest.getCharacterEncoding.

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

public int
getContentLength()

Implements jakarta.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 or is greater than Integer.MAX_VALUE.

public long
getContentLengthLong()

Implements jakarta.servlet.ServletRequest.getContentLengthLong.

Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.

public String
getContentType()

Implements jakarta.servlet.ServletRequest.getContentType.

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

protected WebappContext

Returns:

Return the underlying WebappContext
getContextImpl
()

Return the underlying WebappContext

public String
getContextPath()

Implements jakarta.servlet.http.HttpServletRequest.getContextPath.

Returns the portion of the request URI that indicates the context of the request.

public Cookie[]
getCookies()

Implements jakarta.servlet.http.HttpServletRequest.getCookies.

Returns an array containing all of the Cookie objects the client sent with this request.

public long
getDateHeader(String name)

Implements jakarta.servlet.http.HttpServletRequest.getDateHeader.

Returns the value of the specified request header as a long value that represents a Date object.

public DispatcherType
getDispatcherType()

Implements jakarta.servlet.ServletRequest.getDispatcherType.

Gets the dispatcher type of this request.

public Cookie[]
public String
getHeader(String name)

Implements jakarta.servlet.http.HttpServletRequest.getHeader.

Returns the value of the specified request header as a String.

public Enumeration<String>
getHeaderNames()

Implements jakarta.servlet.http.HttpServletRequest.getHeaderNames.

Returns an enumeration of all the header names this request contains.

public Enumeration<String>
getHeaders(String name)

Implements jakarta.servlet.http.HttpServletRequest.getHeaders.

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

public HttpServletMapping
getHttpServletMapping()

Overrides default jakarta.servlet.http.HttpServletRequest.getHttpServletMapping.

Return the HttpServletMapping of the request.

public HttpUpgradeHandler
public ServletInputStream
getInputStream()

Implements jakarta.servlet.ServletRequest.getInputStream.

Retrieves the body of the request as binary data using a ServletInputStream.

public Request
getInternalRequest()

Implements org.glassfish.grizzly.servlet.Holders.RequestHolder.getInternalRequest.

Returns internal Grizzly Request associated with this Holder.

public int
getIntHeader(String name)

Implements jakarta.servlet.http.HttpServletRequest.getIntHeader.

Returns the value of the specified request header as an int.

public String
getLocalAddr()

Implements jakarta.servlet.ServletRequest.getLocalAddr.

Returns the Internet Protocol (IP) address representing the interface on which the request was received.

public Locale
getLocale()

Implements jakarta.servlet.ServletRequest.getLocale.

Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.

public Enumeration<Locale>
getLocales()

Implements jakarta.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 jakarta.servlet.ServletRequest.getLocalName.

Returns the fully qualified name of the address returned by getLocalAddr().

public int
getLocalPort()

Implements jakarta.servlet.ServletRequest.getLocalPort.

Returns the Internet Protocol (IP) port number representing the interface on which the request was received.

public String
getMethod()

Implements jakarta.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 name)

Implements jakarta.servlet.ServletRequest.getParameter.

Returns the value of a request parameter as a String, or null if the parameter does not exist.

public Map<String, String[]>
getParameterMap()

Implements jakarta.servlet.ServletRequest.getParameterMap.

Returns a java.util.Map of the parameters of this request.

public Enumeration<String>
getParameterNames()

Implements jakarta.servlet.ServletRequest.getParameterNames.

Returns an Enumeration of String objects containing the names of the parameters contained in this request.

public String[]
getParameterValues(String name)

Implements jakarta.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 Part
getPart(String string)

Implements jakarta.servlet.http.HttpServletRequest.getPart.

Gets the Part with the given name.

public Collection<Part>
getParts()

Implements jakarta.servlet.http.HttpServletRequest.getParts.

Gets all the Part components of this request, provided that it is of type multipart/form-data.

public String
getPathInfo()

Implements jakarta.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 jakarta.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 jakarta.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
getProtocolRequestId()

Implements jakarta.servlet.ServletRequest.getProtocolRequestId.

Obtain the request identifier for this request as defined by the protocol in use.

public String
getQueryString()

Implements jakarta.servlet.http.HttpServletRequest.getQueryString.

Returns the query string that is contained in the request URL after the path.

public BufferedReader
getReader()

Implements jakarta.servlet.ServletRequest.getReader.

Retrieves the body of the request as character data using a BufferedReader.

public String
getRemoteAddr()

Implements jakarta.servlet.ServletRequest.getRemoteAddr.

Returns the Internet Protocol (IP) of the remote end of the connection on which the request was received.

public String
getRemoteHost()

Implements jakarta.servlet.ServletRequest.getRemoteHost.

Returns the fully qualified name of the address returned by getRemoteAddr().

public int
getRemotePort()

Implements jakarta.servlet.ServletRequest.getRemotePort.

Returns the Internet Protocol (IP) source port the remote end of the connection on which the request was received.

public String
getRemoteUser()

Implements jakarta.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 Request
public RequestDispatcher
getRequestDispatcher(String path)

Implements jakarta.servlet.ServletRequest.getRequestDispatcher.

Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.

private RequestDispatcher
public String
getRequestedSessionId()

Implements jakarta.servlet.http.HttpServletRequest.getRequestedSessionId.

Returns the session ID specified by the client.

public String
getRequestId()

Implements jakarta.servlet.ServletRequest.getRequestId.

Obtain a unique (within the lifetime of the Servlet container) identifier string for this request.

public String
getRequestURI()

Implements jakarta.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 jakarta.servlet.http.HttpServletRequest.getRequestURL.

Reconstructs the URL the client used to make the request.

public String
getScheme()

Implements jakarta.servlet.ServletRequest.getScheme.

Returns the name of the scheme used to make this request, for example, http, https, or ftp.

public String
getServerName()

Implements jakarta.servlet.ServletRequest.getServerName.

Returns the host name of the server to which the request was sent.

public int
getServerPort()

Implements jakarta.servlet.ServletRequest.getServerPort.

Returns the port number to which the request was sent.

public ServletConnection
getServletConnection()

Implements jakarta.servlet.ServletRequest.getServletConnection.

Obtain details of the network connection to the Servlet container that is being used by this request.

public ServletContext
getServletContext()

Implements jakarta.servlet.ServletRequest.getServletContext.

Gets the servlet context to which this ServletRequest was last dispatched.

public String
getServletPath()

Implements jakarta.servlet.http.HttpServletRequest.getServletPath.

Returns the part of this request's URL that calls the servlet.

public HttpSession
getSession(boolean create)

Implements jakarta.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 HttpSession
getSession()

Implements jakarta.servlet.http.HttpServletRequest.getSession.

Returns the current session associated with this request, or if the request does not have a session, creates one.

public Map<String, String>
getTrailerFields()

Overrides default jakarta.servlet.http.HttpServletRequest.getTrailerFields.

Get the request trailer fields.

public Principal
getUserPrincipal()

Implements jakarta.servlet.http.HttpServletRequest.getUserPrincipal.

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

public void
initialize(final Request request, final HttpServletResponseImpl servletResponse, final WebappContext context)

public boolean
isAsyncStarted()

Implements jakarta.servlet.ServletRequest.isAsyncStarted.

Checks if this request has been put into asynchronous mode.

public boolean
isAsyncSupported()

Implements jakarta.servlet.ServletRequest.isAsyncSupported.

Checks if this request supports asynchronous operation.

public boolean
isRequestedSessionIdFromCookie()

Implements jakarta.servlet.http.HttpServletRequest.isRequestedSessionIdFromCookie.

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

public boolean
isRequestedSessionIdFromURL()

Implements jakarta.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 jakarta.servlet.http.HttpServletRequest.isRequestedSessionIdValid.

Checks whether the requested session ID is still valid.

public boolean
isSecure()

Implements jakarta.servlet.ServletRequest.isSecure.

Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.

public boolean
isTrailerFieldsReady()

Overrides default jakarta.servlet.http.HttpServletRequest.isTrailerFieldsReady.

Return a boolean indicating whether trailer fields are ready to read using getTrailerFields.

public boolean
public boolean
isUserInRole(String role)

Implements jakarta.servlet.http.HttpServletRequest.isUserInRole.

Returns a boolean indicating whether the authenticated user is included in the specified logical "role".

public void
login(String string, String string1)

Implements jakarta.servlet.http.HttpServletRequest.login.

Validate the provided username and password in the password validation realm used by the web container login mechanism configured for the ServletContext.

public void
logout()

Implements jakarta.servlet.http.HttpServletRequest.logout.

Establish null as the value returned when getUserPrincipal, getRemoteUser, and getAuthType is called on the request.

public PushBuilder
newPushBuilder()

Overrides default jakarta.servlet.http.HttpServletRequest.newPushBuilder.

References Deprecated PushBuilder is deprecated or references (maybe indirectly) at least one deprecated element.

Instantiates a new instance of PushBuilder for issuing server push responses from the current request.

pack-priv void
onAfterService()

Notifies this Request that the container-initiated dispatch during which ServletRequest#startAsync was called is about to return to the container

private boolean
pack-priv void
public void
removeAttribute(String name)

Implements jakarta.servlet.ServletRequest.removeAttribute.

Removes an attribute from this request.

pack-priv void
setAsyncStarted(boolean asyncStarted)

pack-priv void
setAsyncTimeout(long timeout)

public void
setAttribute(String name, Object value)

Implements jakarta.servlet.ServletRequest.setAttribute.

Stores an attribute in this request.

public void
setCharacterEncoding(String env)

Implements jakarta.servlet.ServletRequest.setCharacterEncoding.

Overrides the name of the character encoding used in the body of this request.

protected void
setContextImpl(WebappContext
the underlying WebappContext
contextImpl
)

Set the underlying WebappContext

protected void
setContextPath(String contextPath)

protected void
setPathInfo(final String pathInfo)

public void
setServletPath(final String
Servlet path to set.
servletPath
)

Programmatically set the servlet path value.

public AsyncContext
startAsync()

Implements jakarta.servlet.ServletRequest.startAsync.

Puts this request into asynchronous mode, and initializes its AsyncContext with the original (unwrapped) ServletRequest and ServletResponse objects.

public AsyncContext
startAsync(final ServletRequest servletRequest, final ServletResponse servletResponse)

Implements jakarta.servlet.ServletRequest.startAsync.

Puts this request into asynchronous mode, and initializes its AsyncContext with the given request and response objects.

private AsyncContext
startAsync(ServletRequest
the ServletRequest with which to initialize the AsyncContext
servletRequest
,
ServletResponse
the ServletResponse with which to initialize the AsyncContext
servletResponse
,
boolean
true if the zero-arg version of startAsync was called, false otherwise
isStartAsyncWithZeroArg
)

Starts async processing on this request.

public <T extends HttpUpgradeHandler> T

Returns:

an instance of the HttpUpgradeHandler
upgrade
(Class<T>
The ProtocolHandler class used for the upgrade.
handlerClass
)

Implements jakarta.servlet.http.HttpServletRequest.upgrade.

Create an instance of HttpUpgradeHandler for an given class and uses it for the http protocol upgrade processing.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait