Top Description Fields Constructors Methods
io.undertow.servlet.spec

public final Class HttpServletRequestImpl

extends Object
implements HttpServletRequest
Class Inheritance
All Implemented Interfaces
jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest
Imports
io.undertow.security.api.SecurityContext, io.undertow.security.idm.Account, io.undertow.server.HttpServerExchange, .RequestTooBigException, io.undertow.server.handlers.form.FormData, .FormDataParser, .MultiPartParserDefinition, io.undertow.server.protocol.http.HttpAttachments, io.undertow.server.session.Session, .SessionConfig, io.undertow.servlet.UndertowServletLogger, .UndertowServletMessages, io.undertow.servlet.api.AuthorizationManager, .Deployment, .InstanceFactory, .InstanceHandle, io.undertow.servlet.core.ManagedServlet, .ServletUpgradeListener, io.undertow.servlet.handlers.ServletChain, .ServletPathMatch, .ServletRequestContext, io.undertow.servlet.util.EmptyEnumeration, .IteratorEnumeration, io.undertow.util.AttachmentKey, .DateUtils, .HeaderMap, .HeaderValues, .Headers, .HttpString, .LocaleUtils, jakarta.servlet.AsyncContext, .DispatcherType, .MultipartConfigElement, .RequestDispatcher, .ServletConnection, .ServletException, .ServletInputStream, .ServletRequest, .ServletRequestWrapper, .ServletResponse, .ServletResponseWrapper, jakarta.servlet.http.Cookie, .HttpServletMapping, .HttpServletRequest, .HttpServletResponse, .HttpSession, .HttpUpgradeHandler, .Part, .PushBuilder, java.io.BufferedReader, .IOException, .InputStreamReader, .UnsupportedEncodingException, java.net.InetAddress, .InetSocketAddress, java.nio.charset.Charset, .StandardCharsets, .UnsupportedCharsetException, java.security.AccessController, .Principal, java.util.ArrayList, .Collection, .Collections, .Date, .Deque, .Enumeration, .HashMap, .HashSet, .Iterator, .List, .Locale, .Map, .Set

The http servlet request implementation. This class is not thread safe
Authors
Stuart Douglas, Richard Opalka

Field Summary

Modifier and TypeField and Description
private volatile AsyncContextImpl
private volatile boolean
private Map<String, Object>
private Charset
private Cookie[]
private final HttpServerExchange
private RuntimeException
private final ServletContextImpl
private FormData
private List<Part>
private Map<String, Deque<String>>
private BufferedReader
private boolean
pack-priv static final AttachmentKey<String>
pack-priv static final AttachmentKey<Boolean>
public static final AttachmentKey<Boolean>
SECURE_REQUEST

Deprecated
private ServletContextImpl
private ServletInputStream
private SessionConfig.SessionCookieSource

Constructor Summary

AccessConstructor and Description
public
HttpServletRequestImpl(final HttpServerExchange exchange, final ServletContextImpl servletContext)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public boolean
authenticate(final HttpServletResponse
The HttpServletResponse associated with this HttpServletRequest
response
)

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.

public void
public void
public void
freeResources()

Frees any resources (namely buffers) that may be associated with this request.

public AsyncContextImpl
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 AsyncContextImpl
public Object
getAttribute(final String
a String specifying the name of the attribute
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.

private String
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.

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(final String
a String specifying the name of the header
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 HttpServerExchange
public String
getHeader(final String
a String specifying the header name
name
)

Implements jakarta.servlet.http.HttpServletRequest.getHeader.

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

public String
getHeader(final HttpString name)

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(final String
a String specifying the header name
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 ServletInputStream
getInputStream()

Implements jakarta.servlet.ServletRequest.getInputStream.

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

public int
getIntHeader(final String
a String specifying the name of a request header
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.

String java.net.InetAddress.getHostName() Gets the host name for this IP address.

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
public String
public String
public String
public String
public String
getParameter(final String
a String specifying the name of the parameter
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(final String
a String containing the name of the parameter whose value is requested
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(final String
the name of the requested Part
name
)

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 Map<String, Deque<String>>
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 RequestDispatcher
getRequestDispatcher(final String
a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet.
path
)

Implements jakarta.servlet.ServletRequest.getRequestDispatcher.

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

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 ServletContextImpl
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(final boolean
true to create a new session for this request if necessary; false to return null if there's no current session
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 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
isUserInRole(final String
a String specifying the name of the role
role
)

Implements jakarta.servlet.http.HttpServletRequest.isUserInRole.

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

private void
public void
login(final String
The String value corresponding to the login identifier of the user.
username
,
final String
The password String corresponding to the identified user.
password
)

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.

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

private FormData
public void
removeAttribute(final String
a String specifying the name of the attribute to remove
name
)

Implements jakarta.servlet.ServletRequest.removeAttribute.

Removes an attribute from this request.

private SessionConfig.SessionCookieSource
public void
setAttribute(final String
a String specifying the name of the attribute
name
,
final Object
the Object to be stored
object
)

Implements jakarta.servlet.ServletRequest.setAttribute.

Stores an attribute in this request.

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

Implements jakarta.servlet.ServletRequest.setCharacterEncoding.

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

public void
setQueryParameters(final Map<String, Deque<String>> queryParameters)

public void
setServletContext(final ServletContextImpl servletContext)

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
the ServletRequest used to initialize the AsyncContext
servletRequest
,
final ServletResponse
the ServletResponse used to initialize the AsyncContext
servletResponse
)

Implements jakarta.servlet.ServletRequest.startAsync.

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

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public <T extends HttpUpgradeHandler> T
upgrade(final Class<T>
The HttpUpgradeHandler class used for the upgrade.
handlerClass
)

Implements jakarta.servlet.http.HttpServletRequest.upgrade.

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

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait