Package org.eclipse.jetty.ee10.servlet
Class ServletContextRequest
java.lang.Object
org.eclipse.jetty.server.Request.Wrapper
org.eclipse.jetty.server.handler.ContextRequest
org.eclipse.jetty.ee10.servlet.ServletContextRequest
- All Implemented Interfaces:
ServletContextHandler.ServletRequestInfo
,Content.Source
,Request
,Request.ServeAs
,Attributes
,Invocable
public class ServletContextRequest
extends ContextRequest
implements ServletContextHandler.ServletRequestInfo, Request.ServeAs
A core request wrapper that carries the servlet related request state,
which may be used directly by the associated
ServletApiRequest
.
Non-servlet related state, is used indirectly via ServletChannel.getRequest()
which may be a wrapper of this request.
This class is single use only.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Request
Request.AttributesWrapper, Request.AuthenticationState, Request.Handler, Request.ServeAs, Request.Wrapper
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from interface org.eclipse.jetty.util.Attributes
NULL
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
Fields inherited from interface org.eclipse.jetty.server.Request
COOKIE_ATTRIBUTE, DEFAULT_LOCALES, LOG
-
Constructor Summary
ModifierConstructorDescriptionprotected
ServletContextRequest
(ServletContextHandler.ServletContextApi servletContextApi, ServletChannel servletChannel, Request request, Response response, String decodedPathInContext, MatchedResource<ServletHandler.MappedServlet> matchedResource, SessionManager sessionManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(EventListener listener) void
getAttribute
(String name) Get an attributeGet the immutable set of attribute names.jakarta.servlet.http.HttpServletResponse
List<jakarta.servlet.ServletRequestAttributeListener>
static ServletContextRequest
getServletContextRequest
(jakarta.servlet.ServletRequest request) getSession
(boolean create) Get aSession
associated with the request.getState()
boolean
isHead()
protected ServletApiRequest
protected ServletContextResponse
newServletContextResponse
(Response response) removeAttribute
(String name) Remove an attributevoid
removeEventListener
(EventListener listener) setAttribute
(String name, Object value) Set an attributevoid
setManagedSession
(ManagedSession managedSession) void
setQueryEncoding
(String queryEncoding) Set the character encoding used for the query string.void
setRequestedSession
(AbstractSessionManager.RequestedSession requestedSession) Wraps a request but changes the uri so that it can be served to a different target.Methods inherited from class org.eclipse.jetty.server.handler.ContextRequest
addFailureListener, addIdleTimeoutListener, demand, getContext
Methods inherited from class org.eclipse.jetty.server.Request.Wrapper
addHttpStreamWrapper, asAttributeMap, clearAttributes, consumeAvailable, fail, getBeginNanoTime, getComponents, getConnectionMetaData, getHeaders, getHeadersNanoTime, getHttpURI, getId, getLength, getMethod, getTunnelSupport, getWrapped, isSecure, push, read, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, clearAttributes, equals, hashCode
Methods inherited from interface org.eclipse.jetty.io.Content.Source
fail, fail, getLength, rewind
Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
Methods inherited from interface org.eclipse.jetty.server.Request
addFailureListener, addHttpStreamWrapper, addIdleTimeoutListener, consumeAvailable, demand, getBeginNanoTime, getComponents, getConnectionMetaData, getContext, getHeaders, getHeadersNanoTime, getHttpURI, getId, getMethod, getTunnelSupport, isSecure, push, read
Methods inherited from interface org.eclipse.jetty.ee10.servlet.ServletContextHandler.ServletRequestInfo
getRequest
-
Field Details
-
MULTIPART_CONFIG_ELEMENT
- See Also:
-
SSL_CIPHER_SUITE
- See Also:
-
SSL_KEY_SIZE
- See Also:
-
SSL_SESSION_ID
- See Also:
-
PEER_CERTIFICATES
- See Also:
-
-
Constructor Details
-
ServletContextRequest
protected ServletContextRequest(ServletContextHandler.ServletContextApi servletContextApi, ServletChannel servletChannel, Request request, Response response, String decodedPathInContext, MatchedResource<ServletHandler.MappedServlet> matchedResource, SessionManager sessionManager)
-
-
Method Details
-
getServletContextRequest
public static ServletContextRequest getServletContextRequest(jakarta.servlet.ServletRequest request) -
wrap
Description copied from interface:Request.ServeAs
Wraps a request but changes the uri so that it can be served to a different target.- Specified by:
wrap
in interfaceRequest.ServeAs
- Parameters:
request
- the original request.uri
- the uri of the new target.- Returns:
- the request wrapped to the new target.
-
newServletApiRequest
-
newServletContextResponse
-
getServletContextHandler
- Specified by:
getServletContextHandler
in interfaceServletContextHandler.ServletRequestInfo
-
getDecodedPathInContext
- Specified by:
getDecodedPathInContext
in interfaceServletContextHandler.ServletRequestInfo
-
getMatchedResource
- Specified by:
getMatchedResource
in interfaceServletContextHandler.ServletRequestInfo
-
getTrailers
- Specified by:
getTrailers
in interfaceRequest
- Overrides:
getTrailers
in classRequest.Wrapper
- Returns:
- the HTTP trailers of this
Request
, ornull
if they are not present
-
getState
- Specified by:
getState
in interfaceServletContextHandler.ServletRequestInfo
-
getServletContextResponse
-
getServletContext
- Specified by:
getServletContext
in interfaceServletContextHandler.ServletRequestInfo
-
getHttpInput
- Specified by:
getHttpInput
in interfaceServletContextHandler.ServletRequestInfo
-
getHttpOutput
-
errorClose
public void errorClose() -
isHead
public boolean isHead() -
setQueryEncoding
Set the character encoding used for the query string. This call will effect the return of getQueryString and getParamaters. 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.
- Specified by:
setQueryEncoding
in interfaceServletContextHandler.ServletRequestInfo
- Parameters:
queryEncoding
- the URI query character encoding
-
getQueryEncoding
- Specified by:
getQueryEncoding
in interfaceServletContextHandler.ServletRequestInfo
-
getAttribute
Description copied from interface:Attributes
Get an attribute- Specified by:
getAttribute
in interfaceAttributes
- Overrides:
getAttribute
in classRequest.Wrapper
- Parameters:
name
- the attribute to get- Returns:
- the value of the attribute, or
null
if no such attribute exists
-
removeAttribute
Description copied from interface:Attributes
Remove an attribute- Specified by:
removeAttribute
in interfaceAttributes
- Overrides:
removeAttribute
in classRequest.Wrapper
- Parameters:
name
- the attribute to remove- Returns:
- the value of the attribute if removed, else
null
-
setAttribute
Description copied from interface:Attributes
Set an attribute- Specified by:
setAttribute
in interfaceAttributes
- Overrides:
setAttribute
in classRequest.Wrapper
- Parameters:
name
- the attribute to setvalue
- the value to set. A null value is equivalent to removing the attribute.- Returns:
- the previous value of the attribute if set, else
null
-
getAttributeNameSet
Description copied from interface:Attributes
Get the immutable set of attribute names.- Specified by:
getAttributeNameSet
in interfaceAttributes
- Overrides:
getAttributeNameSet
in classRequest.Wrapper
- Returns:
- Set of attribute names, or an empty set if there are no attributes.
-
getErrorContext
- Returns:
- The current
context
used for this error handling for this request. If the request is asynchronous, then it is the context that called async. Otherwise, it is the last non-null context passed to #setContext
-
getServletRequestState
- Specified by:
getServletRequestState
in interfaceServletContextHandler.ServletRequestInfo
-
getServletChannel
- Specified by:
getServletChannel
in interfaceServletContextHandler.ServletRequestInfo
-
getServletApiRequest
-
getHttpServletResponse
public jakarta.servlet.http.HttpServletResponse getHttpServletResponse() -
getServletName
-
getRequestAttributeListeners
- Specified by:
getRequestAttributeListeners
in interfaceServletContextHandler.ServletRequestInfo
-
addEventListener
-
removeEventListener
-
getManagedSession
- Specified by:
getManagedSession
in interfaceServletContextHandler.ServletRequestInfo
-
setManagedSession
-
getSessionManager
- Specified by:
getSessionManager
in interfaceServletContextHandler.ServletRequestInfo
-
setRequestedSession
-
getRequestedSession
- Specified by:
getRequestedSession
in interfaceServletContextHandler.ServletRequestInfo
-
getSession
Description copied from interface:Request
Get a
Session
associated with the request. Sessions may not be supported by a given configuration, in which casenull
will be returned.- Specified by:
getSession
in interfaceRequest
- Overrides:
getSession
in classRequest.Wrapper
- Parameters:
create
- True if the session should be created for the request.- Returns:
- The session associated with the request or
null
.
-