Package io.undertow.servlet.handlers
Class ServletRequestContext
- java.lang.Object
-
- io.undertow.servlet.handlers.ServletRequestContext
-
public class ServletRequestContext extends java.lang.Object
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 theCURRENT
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
Fields Modifier and Type Field Description static io.undertow.util.AttachmentKey<ServletRequestContext>
ATTACHMENT_KEY
-
Constructor Summary
Constructors Constructor Description ServletRequestContext(Deployment deployment, HttpServletRequestImpl originalRequest, HttpServletResponseImpl originalResponse, ServletPathMatch originalServletPathMatch)
-
Method Summary
-
-
-
Field Detail
-
ATTACHMENT_KEY
public static final io.undertow.util.AttachmentKey<ServletRequestContext> ATTACHMENT_KEY
-
-
Constructor Detail
-
ServletRequestContext
public ServletRequestContext(Deployment deployment, HttpServletRequestImpl originalRequest, HttpServletResponseImpl originalResponse, ServletPathMatch originalServletPathMatch)
-
-
Method Detail
-
setCurrentRequestContext
public static void setCurrentRequestContext(ServletRequestContext servletRequestContext)
-
clearCurrentServletAttachments
public static void clearCurrentServletAttachments()
-
requireCurrent
public static ServletRequestContext requireCurrent()
Gets theServletRequestContext
assigned to the current thread.- Returns:
- The current
ServletRequestContext
based on the calling thread - Throws:
java.lang.IllegalStateException
- if the calling thread does not have aServletRequestContext
set- See Also:
current()
-
current
public static ServletRequestContext current()
Gets the current threadsServletRequestContext
if set, otherwise null.- Returns:
- The current
ServletRequestContext
based on the calling thread, or null if unavailable
-
getDeployment
public Deployment getDeployment()
-
getCurrentServlet
public ServletChain getCurrentServlet()
-
setCurrentServlet
public void setCurrentServlet(ServletChain currentServlet)
-
getServletPathMatch
public ServletPathMatch getServletPathMatch()
-
setServletPathMatch
public void setServletPathMatch(ServletPathMatch servletPathMatch)
-
getRequiredConstrains
public java.util.List<SingleConstraintMatch> getRequiredConstrains()
-
setRequiredConstrains
public void setRequiredConstrains(java.util.List<SingleConstraintMatch> requiredConstrains)
-
getTransportGuarenteeType
public TransportGuaranteeType getTransportGuarenteeType()
-
setTransportGuarenteeType
public void setTransportGuarenteeType(TransportGuaranteeType transportGuarenteeType)
-
getServletResponse
public jakarta.servlet.ServletResponse getServletResponse()
-
setServletResponse
public void setServletResponse(jakarta.servlet.ServletResponse servletResponse)
-
getServletRequest
public jakarta.servlet.ServletRequest getServletRequest()
-
setServletRequest
public void setServletRequest(jakarta.servlet.ServletRequest servletRequest)
-
getDispatcherType
public jakarta.servlet.DispatcherType getDispatcherType()
-
setDispatcherType
public void setDispatcherType(jakarta.servlet.DispatcherType dispatcherType)
-
getOriginalRequest
public HttpServletRequestImpl getOriginalRequest()
-
getOriginalResponse
public HttpServletResponseImpl getOriginalResponse()
-
getSession
public HttpSessionImpl getSession()
-
setSession
public void setSession(HttpSessionImpl session)
-
getExchange
public io.undertow.server.HttpServerExchange getExchange()
-
getOriginalServletPathMatch
public ServletPathMatch getOriginalServletPathMatch()
-
getCurrentServletContext
public ServletContextImpl getCurrentServletContext()
-
setCurrentServletContext
public void setCurrentServletContext(ServletContextImpl currentServletContext)
-
displayStackTraces
public boolean displayStackTraces()
-
setError
public void setError(int sc, java.lang.String msg)
-
getErrorCode
public int getErrorCode()
-
getErrorMessage
public java.lang.String getErrorMessage()
-
isRunningInsideHandler
public boolean isRunningInsideHandler()
-
setRunningInsideHandler
public void setRunningInsideHandler(boolean runningInsideHandler)
-
isAsyncSupported
public boolean isAsyncSupported()
-
getOverridenSessionId
public java.lang.String getOverridenSessionId()
-
setOverridenSessionId
public void setOverridenSessionId(java.lang.String overridenSessionId)
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)
-
-