Java javax.servlet.http HttpServletRequest fields, constructors, methods, implement or subclass

Example usage for Java javax.servlet.http HttpServletRequest fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.servlet.http HttpServletRequest.

The text is from its open source code.

Implementation

javax.servlet.http.HttpServletRequest has the following implementations.
Click this link to see all its implementation.

Field

StringBASIC_AUTH
String identifier for Basic authentication.
StringFORM_AUTH
String identifier for Form authentication.
StringCLIENT_CERT_AUTH
String identifier for Client Certificate authentication.
StringDIGEST_AUTH
String identifier for Digest authentication.

Constructor

Method

booleanauthenticate(HttpServletResponse response)
Use the container login mechanism configured for the ServletContext to authenticate the user making this request.
StringchangeSessionId()
Change the session id of the current session associated with this request and return the new session id.
booleanequals(Object obj)
Indicates whether some other object is "equal to" this one.
AsyncContextgetAsyncContext()
Gets the AsyncContext that was created or reinitialized by the most recent invocation of #startAsync or #startAsync(ServletRequest,ServletResponse) on this request.
ObjectgetAttribute(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
EnumerationgetAttributeNames()
Returns an Enumeration containing the names of the attributes available to this request.
StringgetAuthType()
Returns the name of the authentication scheme used to protect the servlet.
StringgetCharacterEncoding()
Returns the name of the character encoding used in the body of this request.
ClassgetClass()
Returns the runtime class of this Object .
intgetContentLength()
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.
longgetContentLengthLong()
Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known.
StringgetContentType()
Returns the MIME type of the body of the request, or null if the type is not known.
StringgetContextPath()
Returns the portion of the request URI that indicates the context of the request.
Cookie[]getCookies()
Returns an array containing all of the Cookie objects the client sent with this request.
longgetDateHeader(String name)
Returns the value of the specified request header as a long value that represents a Date object.
DispatcherTypegetDispatcherType()
Gets the dispatcher type of this request.
StringgetHeader(String name)
Returns the value of the specified request header as a String.
EnumerationgetHeaderNames()
Returns an enumeration of all the header names this request contains.
EnumerationgetHeaders(String name)
Returns all the values of the specified request header as an Enumeration of String objects.
HttpServletMappinggetHttpServletMapping()

Return the HttpServletMapping by which the HttpServlet for this HttpServletRequest was invoked.

ServletInputStreamgetInputStream()
Retrieves the body of the request as binary data using a ServletInputStream .
intgetIntHeader(String name)
Returns the value of the specified request header as an int.
StringgetLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.
LocalegetLocale()
Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
EnumerationgetLocales()
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.
StringgetLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
intgetLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
StringgetMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
StringgetParameter(String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist.
MapgetParameterMap()
Returns a java.util.Map of the parameters of this request.
EnumerationgetParameterNames()
Returns an Enumeration of String objects containing the names of the parameters contained in this request.
String[]getParameterValues(String name)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
PartgetPart(String name)
Gets the Part with the given name.
CollectiongetParts()
Gets all the Part components of this request, provided that it is of type multipart/form-data.
StringgetPathInfo()
Returns any extra path information associated with the URL the client sent when it made this request.
StringgetPathTranslated()
Returns any extra path information after the servlet name but before the query string, and translates it to a real path.
StringgetProtocol()
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
StringgetQueryString()
Returns the query string that is contained in the request URL after the path.
BufferedReadergetReader()
Retrieves the body of the request as character data using a BufferedReader.
StringgetRealPath(String path)
StringgetRemoteAddr()
Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
StringgetRemoteHost()
Returns the fully qualified name of the client or the last proxy that sent the request.
intgetRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
StringgetRemoteUser()
Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.
RequestDispatchergetRequestDispatcher(String path)
Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.
StringgetRequestedSessionId()
Returns the session ID specified by the client.
StringgetRequestURI()
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.
StringBuffergetRequestURL()
Reconstructs the URL the client used to make the request.
StringgetScheme()
Returns the name of the scheme used to make this request, for example, http, https, or ftp.
StringgetServerName()
Returns the host name of the server to which the request was sent.
intgetServerPort()
Returns the port number to which the request was sent.
ServletContextgetServletContext()
Gets the servlet context to which this ServletRequest was last dispatched.
StringgetServletPath()
Returns the part of this request's URL that calls the servlet.
HttpSessiongetSession()
Returns the current session associated with this request, or if the request does not have a session, creates one.
HttpSessiongetSession(boolean create)
Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.
java.security.PrincipalgetUserPrincipal()
Returns a java.security.Principal object containing the name of the current authenticated user.
inthashCode()
Returns a hash code value for the object.
booleanisAsyncStarted()
Checks if this request has been put into asynchronous mode.
booleanisAsyncSupported()
Checks if this request supports asynchronous operation.
booleanisRequestedSessionIdFromCookie()

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

booleanisRequestedSessionIdFromURL()

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

booleanisRequestedSessionIdFromUrl()
booleanisRequestedSessionIdValid()
Checks whether the requested session ID is still valid.
booleanisSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
booleanisUserInRole(String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
voidlogin(String username, String password)
Validate the provided username and password in the password validation realm used by the web container login mechanism configured for the ServletContext.
voidlogout()
Establish null as the value returned when getUserPrincipal, getRemoteUser, and getAuthType is called on the request.
voidremoveAttribute(String name)
Removes an attribute from this request.
voidsetAttribute(String name, Object o)
Stores an attribute in this request.
voidsetCharacterEncoding(String env)
Overrides the name of the character encoding used in the body of this request.
AsyncContextstartAsync()
Puts this request into asynchronous mode, and initializes its AsyncContext with the original (unwrapped) ServletRequest and ServletResponse objects.
AsyncContextstartAsync(ServletRequest servletRequest, ServletResponse servletResponse)
Puts this request into asynchronous mode, and initializes its AsyncContext with the given request and response objects.
StringtoString()
Returns a string representation of the object.
Tupgrade(Class handlerClass)
Creates an instance of HttpUpgradeHandler for a given class and uses it for the http protocol upgrade processing.