Class Request
java.lang.Object
org.eclipse.jetty.ee9.nested.Request
- All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest
Jetty Request.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.static final StringThe name of the MultiPartConfig request attributestatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface jakarta.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventListener(EventListener listener) booleanauthenticate(jakarta.servlet.http.HttpServletResponse response) voidextractFormParameters(Fields params) jakarta.servlet.AsyncContextgetAttribute(String name) Get Request Attribute.Get the authentication.static RequestgetBaseRequest(jakarta.servlet.ServletRequest request) Obtain the baseRequestinstance of aServletRequest, by coercion, unwrapping or special attribute.longGet the nanoTime at which the request arrived to a connector, obtained viaSystem.nanoTime().Deprecated, for removal: This API element is subject to removal in a future version.use core level ComplianceViolation.Listener instead. - will be removed in Jetty 12.1.0intlonglongjakarta.servlet.http.Cookie[]longgetDateHeader(String name) jakarta.servlet.DispatcherTypegetHeaders(String name) jakarta.servlet.http.HttpServletMappingintjakarta.servlet.ServletInputStreamintgetIntHeader(String name) intgetParameter(String name) String[]getParameterValues(String name) jakarta.servlet.http.PartCollection<jakarta.servlet.http.Part> getParts()Get the path relative to the context path, analogous togetServletPath()+getPathInfo().Deprecated.getRealPath(String path) Deprecated.Access the underlying RemoteInetSocketAddressfor this request.intjakarta.servlet.RequestDispatchergetRequestDispatcher(String path) Reconstructs the URL the client used to make the request.intjakarta.servlet.ServletContextjakarta.servlet.ServletResponsejakarta.servlet.http.HttpSessionjakarta.servlet.http.HttpSessiongetSession(boolean create) jakarta.servlet.http.HttpSessiongetSession(SessionManager sessionManager) Find a session that this request has already entered for the given SessionHandlerlongGet Request TimeStampbooleanbooleanbooleanbooleanbooleanisHead()booleanisPush()booleanbooleanbooleanDeprecated.booleanbooleanbooleanisSecure()booleanisUserInRole(String role) voidvoidlogout()voidmergeQueryParameters(String oldQuery, String newQuery) jakarta.servlet.http.PushBuildervoidCalled when the request is fully finished being handled.protected voidrecycle()voidremoveAttribute(String name) voidremoveEventListener(EventListener listener) voidvoidvoidsetAsyncSupported(boolean supported, Object source) voidsetAttribute(String name, Object value) Set a request attribute. if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then the value is also passed in a call tosetQueryEncoding(String).voidsetAttributes(Attributes attributes) Set the attributes for the request.voidsetAuthentication(Authentication authentication) Set the authentication.voidsetCharacterEncoding(String encoding) voidsetCharacterEncodingUnchecked(String encoding) voidsetContentFields(Fields contentParameters) voidsetContentParameters(MultiMap<String> contentParameters) Deprecated.voidsetContentType(String contentType) voidsetContext(ContextHandler.APIContext context, String pathInContext) voidsetDispatcherType(jakarta.servlet.DispatcherType type) voidsetHandled(boolean h) voidsetHttpFields(HttpFields fields) voidsetHttpURI(HttpURI uri) voidvoidsetQueryEncoding(String queryEncoding) Set the character encoding used for the query string.voidsetQueryFields(Fields queryParameters) voidsetQueryParameters(MultiMap<String> queryParameters) Deprecated.voidsetSecure(boolean secure) voidsetServletPathMapping(ServletPathMapping servletPathMapping) Set the servletPathMapping, the servletPath and the pathInfo.voidsetTimeStamp(long ts) voidsetTrailerHttpFields(HttpFields trailers) voidjakarta.servlet.AsyncContextjakarta.servlet.AsyncContextstartAsync(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) toString()static jakarta.servlet.http.HttpServletRequestunwrap(jakarta.servlet.ServletRequest servletRequest) <T extends jakarta.servlet.http.HttpUpgradeHandler>
TMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jakarta.servlet.http.HttpServletRequest
isTrailerFieldsReadyMethods inherited from interface jakarta.servlet.ServletRequest
getProtocolRequestId, getRequestId, getServletConnection
-
Field Details
-
MULTIPART_CONFIG_ELEMENT
The name of the MultiPartConfig request attribute- See Also:
-
__MULTIPART_CONFIG_ELEMENT
Deprecated.- See Also:
-
SSL_CIPHER_SUITE
- See Also:
-
SSL_KEY_SIZE
- See Also:
-
SSL_SESSION_ID
- See Also:
-
PEER_CERTIFICATES
- See Also:
-
-
Constructor Details
-
Request
-
-
Method Details
-
getBaseRequest
-
getHttpFields
-
setHttpFields
-
getTrailerFields
-
setTrailerHttpFields
-
getTrailerHttpFields
-
getHttpInput
-
isPush
public boolean isPush() -
isPushSupported
public boolean isPushSupported() -
newPushBuilder
public jakarta.servlet.http.PushBuilder newPushBuilder()- Specified by:
newPushBuilderin interfacejakarta.servlet.http.HttpServletRequest
-
addEventListener
-
extractFormParameters
-
getAsyncContext
public jakarta.servlet.AsyncContext getAsyncContext()- Specified by:
getAsyncContextin interfacejakarta.servlet.ServletRequest
-
getHttpChannelState
-
getComplianceViolationListener
@Deprecated(since="12.0.6", forRemoval=true) public ComplianceViolation.Listener getComplianceViolationListener()Deprecated, for removal: This API element is subject to removal in a future version.use core level ComplianceViolation.Listener instead. - will be removed in Jetty 12.1.0 -
getAttribute
Get Request Attribute.Also supports jetty specific attributes to gain access to Jetty APIs:
- org.eclipse.jetty.server.Server
- The Jetty Server instance
- org.eclipse.jetty.server.HttpChannel
- The HttpChannel for this request
- org.eclipse.jetty.server.HttpConnection
- The HttpConnection or null if another transport is used
- Specified by:
getAttributein interfacejakarta.servlet.ServletRequest- See Also:
-
getAttributeNames
- Specified by:
getAttributeNamesin interfacejakarta.servlet.ServletRequest
-
getAttributes
-
getAuthentication
-
getAuthType
- Specified by:
getAuthTypein interfacejakarta.servlet.http.HttpServletRequest
-
getCharacterEncoding
- Specified by:
getCharacterEncodingin interfacejakarta.servlet.ServletRequest
-
getHttpChannel
- Returns:
- Returns the connection.
-
getContentLength
public int getContentLength()- Specified by:
getContentLengthin interfacejakarta.servlet.ServletRequest
-
getContentLengthLong
public long getContentLengthLong()- Specified by:
getContentLengthLongin interfacejakarta.servlet.ServletRequest
-
getContentRead
public long getContentRead() -
getContentType
- Specified by:
getContentTypein interfacejakarta.servlet.ServletRequest
-
getContext
- Returns:
- The
contextused for this request.
-
setContext
-
getLastContext
-
getLastPathInContext
-
getContextPath
- Specified by:
getContextPathin interfacejakarta.servlet.http.HttpServletRequest
-
getPathInContext
Get the path relative to the context path, analogous togetServletPath()+getPathInfo(). If no context is set, then the path in context is the full path.- Returns:
- The decoded part of the
getRequestURI()path after anygetContextPath()up to anygetQueryString(), excluding path parameters.
-
getCookies
public jakarta.servlet.http.Cookie[] getCookies()- Specified by:
getCookiesin interfacejakarta.servlet.http.HttpServletRequest
-
getDateHeader
- Specified by:
getDateHeaderin interfacejakarta.servlet.http.HttpServletRequest
-
getDispatcherType
public jakarta.servlet.DispatcherType getDispatcherType()- Specified by:
getDispatcherTypein interfacejakarta.servlet.ServletRequest
-
getHeader
-
getHeaderNames
- Specified by:
getHeaderNamesin interfacejakarta.servlet.http.HttpServletRequest
-
getHeaders
- Specified by:
getHeadersin interfacejakarta.servlet.http.HttpServletRequest
-
getInputState
public int getInputState()- Returns:
- Returns the inputState.
-
getInputStream
- Specified by:
getInputStreamin interfacejakarta.servlet.ServletRequest- Throws:
IOException
-
getIntHeader
- Specified by:
getIntHeaderin interfacejakarta.servlet.http.HttpServletRequest
-
getLocale
- Specified by:
getLocalein interfacejakarta.servlet.ServletRequest
-
getLocales
- Specified by:
getLocalesin interfacejakarta.servlet.ServletRequest
-
getLocalAddr
- Specified by:
getLocalAddrin interfacejakarta.servlet.ServletRequest
-
getLocalName
- Specified by:
getLocalNamein interfacejakarta.servlet.ServletRequest
-
getLocalPort
public int getLocalPort()- Specified by:
getLocalPortin interfacejakarta.servlet.ServletRequest
-
getMethod
- Specified by:
getMethodin interfacejakarta.servlet.http.HttpServletRequest
-
getParameter
-
getParameterMap
-
getParameterNames
- Specified by:
getParameterNamesin interfacejakarta.servlet.ServletRequest
-
getParameterValues
-
getQueryParameters
Deprecated. -
getQueryFields
-
setQueryFields
-
setQueryParameters
Deprecated. -
setContentFields
-
setContentParameters
Deprecated. -
resetParameters
public void resetParameters() -
getPathInfo
- Specified by:
getPathInfoin interfacejakarta.servlet.http.HttpServletRequest
-
getPathTranslated
- Specified by:
getPathTranslatedin interfacejakarta.servlet.http.HttpServletRequest
-
getProtocol
- Specified by:
getProtocolin interfacejakarta.servlet.ServletRequest
-
getHttpVersion
-
getQueryEncoding
-
getQueryString
- Specified by:
getQueryStringin interfacejakarta.servlet.http.HttpServletRequest
-
getReader
- Specified by:
getReaderin interfacejakarta.servlet.ServletRequest- Throws:
IOException
-
getRealPath
Deprecated. -
getRemoteInetSocketAddress
Access the underlying RemoteInetSocketAddressfor this request.- Returns:
- the remote
InetSocketAddressfor this request, or null if the request has no remote (seeServletRequest.getRemoteAddr()for conditions that result in no remote address)
-
getRemoteAddr
- Specified by:
getRemoteAddrin interfacejakarta.servlet.ServletRequest
-
getRemoteHost
- Specified by:
getRemoteHostin interfacejakarta.servlet.ServletRequest
-
getRemotePort
public int getRemotePort()- Specified by:
getRemotePortin interfacejakarta.servlet.ServletRequest
-
getRemoteUser
- Specified by:
getRemoteUserin interfacejakarta.servlet.http.HttpServletRequest
-
getRequestDispatcher
- Specified by:
getRequestDispatcherin interfacejakarta.servlet.ServletRequest
-
getRequestedSessionId
- Specified by:
getRequestedSessionIdin interfacejakarta.servlet.http.HttpServletRequest
-
getRequestURI
- Specified by:
getRequestURIin interfacejakarta.servlet.http.HttpServletRequest
-
getRequestURL
- Specified by:
getRequestURLin interfacejakarta.servlet.http.HttpServletRequest
-
getResponse
-
getRootURL
Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and, but it does not include a path.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.
- Returns:
- "scheme://host:port"
-
getScheme
- Specified by:
getSchemein interfacejakarta.servlet.ServletRequest
-
getServerName
- Specified by:
getServerNamein interfacejakarta.servlet.ServletRequest
-
getServerPort
public int getServerPort()- Specified by:
getServerPortin interfacejakarta.servlet.ServletRequest
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()- Specified by:
getServletContextin interfacejakarta.servlet.ServletRequest
-
getServletName
-
getServletPath
- Specified by:
getServletPathin interfacejakarta.servlet.http.HttpServletRequest
-
getServletResponse
public jakarta.servlet.ServletResponse getServletResponse() -
changeSessionId
- Specified by:
changeSessionIdin interfacejakarta.servlet.http.HttpServletRequest
-
onCompleted
public void onCompleted()Called when the request is fully finished being handled. For every session in any context that the session has accessed, ensure that the session is completed. -
getSession
Find a session that this request has already entered for the given SessionHandler- Parameters:
sessionManager- the SessionHandler (ie context) to check- Returns:
- the session for the passed session handler or null
-
getSession
public jakarta.servlet.http.HttpSession getSession()- Specified by:
getSessionin interfacejakarta.servlet.http.HttpServletRequest
-
getSession
public jakarta.servlet.http.HttpSession getSession(boolean create) - Specified by:
getSessionin interfacejakarta.servlet.http.HttpServletRequest
-
getTimeStamp
public long getTimeStamp()Get Request TimeStamp- Returns:
- The time that the request was received.
-
getHttpURI
-
setHttpURI
-
getOriginalURI
- Returns:
- Returns the original uri passed in metadata before customization/rewrite
-
getUserIdentity
-
getResolvedUserIdentity
- Returns:
- The resolved user Identity, which may be null if the
Authenticationis notAuthentication.User(eg.Authentication.Deferred).
-
getUserIdentityScope
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfacejakarta.servlet.http.HttpServletRequest
-
isHandled
public boolean isHandled() -
isAsyncStarted
public boolean isAsyncStarted()- Specified by:
isAsyncStartedin interfacejakarta.servlet.ServletRequest
-
isAsyncSupported
public boolean isAsyncSupported()- Specified by:
isAsyncSupportedin interfacejakarta.servlet.ServletRequest
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()- Specified by:
isRequestedSessionIdFromCookiein interfacejakarta.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromUrl
Deprecated. -
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()- Specified by:
isRequestedSessionIdFromURLin interfacejakarta.servlet.http.HttpServletRequest
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()- Specified by:
isRequestedSessionIdValidin interfacejakarta.servlet.http.HttpServletRequest
-
isSecure
public boolean isSecure()- Specified by:
isSecurein interfacejakarta.servlet.ServletRequest
-
setSecure
public void setSecure(boolean secure) -
getBeginNanoTime
public long getBeginNanoTime()Get the nanoTime at which the request arrived to a connector, obtained via
System.nanoTime(). This method can be used when measuring latencies.- Returns:
- The nanoTime at which the request was received/created in nanoseconds
-
isUserInRole
- Specified by:
isUserInRolein interfacejakarta.servlet.http.HttpServletRequest
-
getCoreRequest
-
getMetaData
-
hasMetaData
public boolean hasMetaData() -
recycle
protected void recycle() -
removeAttribute
- Specified by:
removeAttributein interfacejakarta.servlet.ServletRequest
-
removeEventListener
-
setAsyncSupported
-
setAttribute
Set a request attribute. if the attribute name is "org.eclipse.jetty.server.server.Request.queryEncoding" then the value is also passed in a call tosetQueryEncoding(String).- Specified by:
setAttributein interfacejakarta.servlet.ServletRequest- See Also:
-
setAttributes
Set the attributes for the request.- Parameters:
attributes- The attributes, which must be aAttributes.Wrapperfor whichAttributes.unwrap(Attributes)will return the originalServletAttributes.
-
setAsyncAttributes
public void setAsyncAttributes() -
setAuthentication
Set the authentication.- Parameters:
authentication- the authentication to set
-
setCharacterEncoding
- Specified by:
setCharacterEncodingin interfacejakarta.servlet.ServletRequest- Throws:
UnsupportedEncodingException
-
setCharacterEncodingUnchecked
-
setContentType
-
setDispatcherType
public void setDispatcherType(jakarta.servlet.DispatcherType type) -
setHandled
public void setHandled(boolean h) -
setMethod
- Parameters:
method- The method to set.
-
isHead
public boolean isHead() -
setQueryEncoding
Set the character encoding used for the query string. This call will effect the return of getQueryString and getParameters. It must be called before any getParameter methods.The request attribute "org.eclipse.jetty.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding.
- Parameters:
queryEncoding- the URI query character encoding
-
setTimeStamp
public void setTimeStamp(long ts) -
setUserIdentityScope
-
startAsync
- Specified by:
startAsyncin interfacejakarta.servlet.ServletRequest- Throws:
IllegalStateException
-
startAsync
public jakarta.servlet.AsyncContext startAsync(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) throws IllegalStateException - Specified by:
startAsyncin interfacejakarta.servlet.ServletRequest- Throws:
IllegalStateException
-
unwrap
public static jakarta.servlet.http.HttpServletRequest unwrap(jakarta.servlet.ServletRequest servletRequest) -
toString
-
authenticate
public boolean authenticate(jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException - Specified by:
authenticatein interfacejakarta.servlet.http.HttpServletRequest- Throws:
IOExceptionjakarta.servlet.ServletException
-
getPart
public jakarta.servlet.http.Part getPart(String name) throws IOException, jakarta.servlet.ServletException - Specified by:
getPartin interfacejakarta.servlet.http.HttpServletRequest- Throws:
IOExceptionjakarta.servlet.ServletException
-
getParts
public Collection<jakarta.servlet.http.Part> getParts() throws IOException, jakarta.servlet.ServletException- Specified by:
getPartsin interfacejakarta.servlet.http.HttpServletRequest- Throws:
IOExceptionjakarta.servlet.ServletException
-
login
-
logout
public void logout() throws jakarta.servlet.ServletException- Specified by:
logoutin interfacejakarta.servlet.http.HttpServletRequest- Throws:
jakarta.servlet.ServletException
-
mergeQueryParameters
-
upgrade
public <T extends jakarta.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, jakarta.servlet.ServletException - Specified by:
upgradein interfacejakarta.servlet.http.HttpServletRequest- Throws:
IOExceptionjakarta.servlet.ServletException
-
setServletPathMapping
Set the servletPathMapping, the servletPath and the pathInfo.- Parameters:
servletPathMapping- The mapping used to return fromgetHttpServletMapping()
-
getServletPathMapping
- Returns:
- The mapping for the current target servlet, regardless of dispatch type.
-
getHttpServletMapping
public jakarta.servlet.http.HttpServletMapping getHttpServletMapping()- Specified by:
getHttpServletMappingin interfacejakarta.servlet.http.HttpServletRequest
-
MULTIPART_CONFIG_ELEMENT