Package io.undertow.servlet.handlers
Class ServletRequestContext
java.lang.Object
io.undertow.servlet.handlers.ServletRequestContext
All the information that servlet needs to attach to the exchange.
This is all stored under this class, rather than using individual attachments, as this approach has significant performance advantages.
The ServletInitialHandler
also pushed this information to the CURRENT
thread local, which allows it to be access even if the request or response have been
wrapped with non-compliant wrapper classes.
- Author:
- Stuart Douglas
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.undertow.util.AttachmentKey<ServletRequestContext>
-
Constructor Summary
ConstructorsConstructorDescriptionServletRequestContext
(Deployment deployment, HttpServletRequestImpl originalRequest, HttpServletResponseImpl originalResponse, ServletPathMatch originalServletPathMatch) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static ServletRequestContext
current()
Gets the current threadsServletRequestContext
if set, otherwise null.boolean
javax.servlet.DispatcherType
int
io.undertow.server.HttpServerExchange
javax.servlet.ServletRequest
javax.servlet.ServletResponse
boolean
boolean
static ServletRequestContext
Gets theServletRequestContext
assigned to the current thread.void
setAsyncSupported
(boolean asyncSupported) static void
setCurrentRequestContext
(ServletRequestContext servletRequestContext) void
setCurrentServlet
(ServletChain currentServlet) void
setCurrentServletContext
(ServletContextImpl currentServletContext) void
setDispatcherType
(javax.servlet.DispatcherType dispatcherType) void
void
setOverridenSessionId
(String overridenSessionId) void
setRequiredConstrains
(List<SingleConstraintMatch> requiredConstrains) void
setRunningInsideHandler
(boolean runningInsideHandler) void
setServletPathMatch
(ServletPathMatch servletPathMatch) void
setServletRequest
(javax.servlet.ServletRequest servletRequest) void
setServletResponse
(javax.servlet.ServletResponse servletResponse) void
setSession
(HttpSessionImpl session) void
setTransportGuarenteeType
(TransportGuaranteeType transportGuarenteeType)
-
Field Details
-
ATTACHMENT_KEY
-
-
Constructor Details
-
ServletRequestContext
public ServletRequestContext(Deployment deployment, HttpServletRequestImpl originalRequest, HttpServletResponseImpl originalResponse, ServletPathMatch originalServletPathMatch)
-
-
Method Details
-
setCurrentRequestContext
-
clearCurrentServletAttachments
public static void clearCurrentServletAttachments() -
requireCurrent
Gets theServletRequestContext
assigned to the current thread.- Returns:
- The current
ServletRequestContext
based on the calling thread - Throws:
IllegalStateException
- if the calling thread does not have aServletRequestContext
set- See Also:
-
current
Gets the current threadsServletRequestContext
if set, otherwise null.- Returns:
- The current
ServletRequestContext
based on the calling thread, or null if unavailable
-
getDeployment
-
getCurrentServlet
-
setCurrentServlet
-
getServletPathMatch
-
setServletPathMatch
-
getRequiredConstrains
-
setRequiredConstrains
-
getTransportGuarenteeType
-
setTransportGuarenteeType
-
getServletResponse
public javax.servlet.ServletResponse getServletResponse() -
setServletResponse
public void setServletResponse(javax.servlet.ServletResponse servletResponse) -
getServletRequest
public javax.servlet.ServletRequest getServletRequest() -
setServletRequest
public void setServletRequest(javax.servlet.ServletRequest servletRequest) -
getDispatcherType
public javax.servlet.DispatcherType getDispatcherType() -
setDispatcherType
public void setDispatcherType(javax.servlet.DispatcherType dispatcherType) -
getOriginalRequest
-
getOriginalResponse
-
getSession
-
setSession
-
getExchange
public io.undertow.server.HttpServerExchange getExchange() -
getOriginalServletPathMatch
-
getCurrentServletContext
-
setCurrentServletContext
-
displayStackTraces
public boolean displayStackTraces() -
setError
-
getErrorCode
public int getErrorCode() -
getErrorMessage
-
isRunningInsideHandler
public boolean isRunningInsideHandler() -
setRunningInsideHandler
public void setRunningInsideHandler(boolean runningInsideHandler) -
isAsyncSupported
public boolean isAsyncSupported() -
getOverridenSessionId
-
setOverridenSessionId
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)
-