Class ServletRequestContext

java.lang.Object
io.undertow.servlet.handlers.ServletRequestContext

public class ServletRequestContext extends 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 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 Details

    • ATTACHMENT_KEY

      public static final io.undertow.util.AttachmentKey<ServletRequestContext> ATTACHMENT_KEY
  • Constructor Details

  • Method Details

    • setCurrentRequestContext

      public static void setCurrentRequestContext(ServletRequestContext servletRequestContext)
    • clearCurrentServletAttachments

      public static void clearCurrentServletAttachments()
    • requireCurrent

      public static ServletRequestContext requireCurrent()
      Gets the ServletRequestContext assigned to the current thread.
      Returns:
      The current ServletRequestContext based on the calling thread
      Throws:
      IllegalStateException - if the calling thread does not have a ServletRequestContext set
      See Also:
    • current

      public static ServletRequestContext current()
      Gets the current threads ServletRequestContext 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 List<SingleConstraintMatch> getRequiredConstrains()
    • setRequiredConstrains

      public void setRequiredConstrains(List<SingleConstraintMatch> requiredConstrains)
    • getTransportGuarenteeType

      public TransportGuaranteeType getTransportGuarenteeType()
    • setTransportGuarenteeType

      public void setTransportGuarenteeType(TransportGuaranteeType transportGuarenteeType)
    • 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

      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, String msg)
    • getErrorCode

      public int getErrorCode()
    • getErrorMessage

      public String getErrorMessage()
    • isRunningInsideHandler

      public boolean isRunningInsideHandler()
    • setRunningInsideHandler

      public void setRunningInsideHandler(boolean runningInsideHandler)
    • isAsyncSupported

      public boolean isAsyncSupported()
    • getOverridenSessionId

      public String getOverridenSessionId()
    • setOverridenSessionId

      public void setOverridenSessionId(String overridenSessionId)
    • setAsyncSupported

      public void setAsyncSupported(boolean asyncSupported)