Class DefaultWebApplicationRequest

java.lang.Object
java.io.InputStream
jakarta.servlet.ServletInputStream
cloud.piranha.core.impl.DefaultWebApplicationRequest
All Implemented Interfaces:
WebApplicationRequest, jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest, Closeable, AutoCloseable
Direct Known Subclasses:
EmbeddedRequest, HttpWebApplicationRequest

public class DefaultWebApplicationRequest extends jakarta.servlet.ServletInputStream implements WebApplicationRequest
The default WebApplicationRequest.
Author:
Manfred Riem ([email protected])
  • Field Details

    • authType

      protected String authType
      Stores the auth type.
    • asyncContext

      protected jakarta.servlet.AsyncContext asyncContext
      Stores the async context.
    • asyncStarted

      protected boolean asyncStarted
      Stores if async is started.
    • asyncSupported

      protected boolean asyncSupported
      Stores if async is supported.
    • attributeManager

      protected AttributeManager attributeManager
      Stores the attribute manager.
    • characterEncoding

      protected String characterEncoding
      Stores the character encoding.
    • contentLength

      protected long contentLength
      Stores the content length.
    • contentType

      protected String contentType
      Stores the content type.
    • contextPath

      protected String contextPath
      Stores the context path.
    • cookies

      protected jakarta.servlet.http.Cookie[] cookies
      Stores the cookies.
    • currentSessionId

      protected String currentSessionId
      Stores the current session id.
    • dispatcherType

      protected jakarta.servlet.DispatcherType dispatcherType
      Stores the dispatcher type.
    • gotInputStream

      protected boolean gotInputStream
      Stores the gotInputStream flag.
    • gotReader

      protected boolean gotReader
      Stores the gotReader flag.
    • headerManager

      protected HttpHeaderManager headerManager
      Stores the header manager.
    • httpServletMapping

      protected jakarta.servlet.http.HttpServletMapping httpServletMapping
      Stores the httpServletMapping.
    • inputStream

      protected InputStream inputStream
      Stores the input stream.
    • localAddress

      protected String localAddress
      Stores the local address.
    • localName

      protected String localName
      Stores the local name.
    • localPort

      protected int localPort
      Stores the local port.
    • method

      protected String method
      Stores the method.
    • multipartConfig

      protected jakarta.servlet.MultipartConfigElement multipartConfig
      Stores the multipart config.
    • parameters

      protected HashMap<String,String[]> parameters
      Stores the parameters.
    • parametersParsed

      protected boolean parametersParsed
      Stores the parameters parsed flag.
    • pathInfo

      protected String pathInfo
      Stores the path info.
    • protocol

      protected String protocol
      Stores the protocol.
    • queryString

      protected String queryString
      Stores the query string.
    • reader

      protected BufferedReader reader
      Stores the reader.
    • remoteAddr

      protected String remoteAddr
      Stores the remote address.
    • remoteHost

      protected String remoteHost
      Stores the remote host.
    • remotePort

      protected int remotePort
      Stores the remote port.
    • requestedSessionId

      protected String requestedSessionId
      Stores the requested session id.
    • requestedSessionIdFromCookie

      protected boolean requestedSessionIdFromCookie
      Stores the requested session id from cookie flag.
    • requestedSessionIdFromURL

      protected boolean requestedSessionIdFromURL
      Stores the requested session id from url flag.
    • scheme

      protected String scheme
      Stores the scheme.
    • serverName

      protected String serverName
      Stores the server name.
    • serverPort

      protected int serverPort
      Stores the server port.
    • servletPath

      protected String servletPath
      Stores the servlet path.
    • originalServletPath

      protected String originalServletPath
      Stores the original servlet path.
    • upgraded

      protected boolean upgraded
      Stores the upgraded flag.
    • upgradeHandler

      protected jakarta.servlet.http.HttpUpgradeHandler upgradeHandler
      Stores the upgrade handler.
    • userPrincipal

      protected Principal userPrincipal
      Stores the user principal.
    • webApplication

      protected WebApplication webApplication
      Stores the web application
  • Constructor Details

    • DefaultWebApplicationRequest

      public DefaultWebApplicationRequest()
      Constructor.
  • Method Details

    • authenticate

      public boolean authenticate(jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Specified by:
      authenticate in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      IOException
      jakarta.servlet.ServletException
    • changeSessionId

      public String changeSessionId()
      Specified by:
      changeSessionId in interface jakarta.servlet.http.HttpServletRequest
    • getAsyncContext

      public jakarta.servlet.AsyncContext getAsyncContext()
      Specified by:
      getAsyncContext in interface jakarta.servlet.ServletRequest
    • getAttribute

      public Object getAttribute(String name)
      Specified by:
      getAttribute in interface jakarta.servlet.ServletRequest
    • getAttributeNames

      public Enumeration<String> getAttributeNames()
      Specified by:
      getAttributeNames in interface jakarta.servlet.ServletRequest
    • getAuthType

      public String getAuthType()
      Specified by:
      getAuthType in interface jakarta.servlet.http.HttpServletRequest
    • getCharacterEncoding

      public String getCharacterEncoding()
      Specified by:
      getCharacterEncoding in interface jakarta.servlet.ServletRequest
    • getContentLength

      public int getContentLength()
      Specified by:
      getContentLength in interface jakarta.servlet.ServletRequest
    • getContentLengthLong

      public long getContentLengthLong()
      Specified by:
      getContentLengthLong in interface jakarta.servlet.ServletRequest
    • getContentType

      public String getContentType()
      Specified by:
      getContentType in interface jakarta.servlet.ServletRequest
    • getContextPath

      public String getContextPath()
      Specified by:
      getContextPath in interface jakarta.servlet.http.HttpServletRequest
    • getCookies

      public jakarta.servlet.http.Cookie[] getCookies()
      Specified by:
      getCookies in interface jakarta.servlet.http.HttpServletRequest
    • getCurrentSessionId

      public String getCurrentSessionId()
      Returns the current session id.
      Returns:
      the current session id
    • setCurrentSessionId

      public void setCurrentSessionId(String currentSessionId)
      Sets the current session id
      Parameters:
      currentSessionId - the current session id
    • getDateHeader

      public long getDateHeader(String name)
      Specified by:
      getDateHeader in interface jakarta.servlet.http.HttpServletRequest
    • getDispatcherType

      public jakarta.servlet.DispatcherType getDispatcherType()
      Specified by:
      getDispatcherType in interface jakarta.servlet.ServletRequest
    • getHeader

      public String getHeader(String name)
      Specified by:
      getHeader in interface jakarta.servlet.http.HttpServletRequest
    • getHeaderNames

      public Enumeration<String> getHeaderNames()
      Specified by:
      getHeaderNames in interface jakarta.servlet.http.HttpServletRequest
    • getHeaders

      public Enumeration<String> getHeaders(String name)
      Specified by:
      getHeaders in interface jakarta.servlet.http.HttpServletRequest
    • getHttpServletMapping

      public jakarta.servlet.http.HttpServletMapping getHttpServletMapping()
      Specified by:
      getHttpServletMapping in interface jakarta.servlet.http.HttpServletRequest
    • setHttpServletMapping

      public void setHttpServletMapping(jakarta.servlet.http.HttpServletMapping httpServletMapping)
      Parameters:
      httpServletMapping - the httpServletMapping to set
    • getInputStream

      public jakarta.servlet.ServletInputStream getInputStream() throws IOException
      Specified by:
      getInputStream in interface jakarta.servlet.ServletRequest
      Throws:
      IOException
    • getIntHeader

      public int getIntHeader(String name)
      Specified by:
      getIntHeader in interface jakarta.servlet.http.HttpServletRequest
    • getLocalAddr

      public String getLocalAddr()
      Specified by:
      getLocalAddr in interface jakarta.servlet.ServletRequest
    • getLocalName

      public String getLocalName()
      Specified by:
      getLocalName in interface jakarta.servlet.ServletRequest
    • getLocalPort

      public int getLocalPort()
      Specified by:
      getLocalPort in interface jakarta.servlet.ServletRequest
    • getLocale

      public Locale getLocale()
      Specified by:
      getLocale in interface jakarta.servlet.ServletRequest
    • getLocales

      public Enumeration<Locale> getLocales()
      Specified by:
      getLocales in interface jakarta.servlet.ServletRequest
    • getMethod

      public String getMethod()
      Specified by:
      getMethod in interface jakarta.servlet.http.HttpServletRequest
    • getMultipartConfig

      public jakarta.servlet.MultipartConfigElement getMultipartConfig()
      Description copied from interface: WebApplicationRequest
      Returns the multipartConfig.
      Specified by:
      getMultipartConfig in interface WebApplicationRequest
      Returns:
      the multipartConfig
    • setMultipartConfig

      public void setMultipartConfig(jakarta.servlet.MultipartConfigElement multipartConfig)
      Parameters:
      multipartConfig - the multipartConfig to set
    • getParameter

      public String getParameter(String name)
      Specified by:
      getParameter in interface jakarta.servlet.ServletRequest
    • getParameterMap

      public Map<String,String[]> getParameterMap()
      Specified by:
      getParameterMap in interface jakarta.servlet.ServletRequest
    • getParameterNames

      public Enumeration<String> getParameterNames()
      Specified by:
      getParameterNames in interface jakarta.servlet.ServletRequest
    • getParameterValues

      public String[] getParameterValues(String name)
      Specified by:
      getParameterValues in interface jakarta.servlet.ServletRequest
    • getParametersFromRequest

      protected void getParametersFromRequest()
      Get the parameters from the request.
    • getPart

      public jakarta.servlet.http.Part getPart(String name) throws IOException, jakarta.servlet.ServletException
      Specified by:
      getPart in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      IOException
      jakarta.servlet.ServletException
    • getParts

      public Collection<jakarta.servlet.http.Part> getParts() throws IOException, jakarta.servlet.ServletException
      Specified by:
      getParts in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      IOException
      jakarta.servlet.ServletException
    • getPathInfo

      public String getPathInfo()
      Specified by:
      getPathInfo in interface jakarta.servlet.http.HttpServletRequest
    • getPathTranslated

      public String getPathTranslated()
      Specified by:
      getPathTranslated in interface jakarta.servlet.http.HttpServletRequest
    • getProtocol

      public String getProtocol()
      Specified by:
      getProtocol in interface jakarta.servlet.ServletRequest
    • getQueryString

      public String getQueryString()
      Specified by:
      getQueryString in interface jakarta.servlet.http.HttpServletRequest
    • getReader

      public BufferedReader getReader() throws IOException
      Specified by:
      getReader in interface jakarta.servlet.ServletRequest
      Throws:
      IOException
    • getRemoteAddr

      public String getRemoteAddr()
      Specified by:
      getRemoteAddr in interface jakarta.servlet.ServletRequest
    • getRemoteHost

      public String getRemoteHost()
      Specified by:
      getRemoteHost in interface jakarta.servlet.ServletRequest
    • getRemotePort

      public int getRemotePort()
      Specified by:
      getRemotePort in interface jakarta.servlet.ServletRequest
    • getRemoteUser

      public String getRemoteUser()
      Specified by:
      getRemoteUser in interface jakarta.servlet.http.HttpServletRequest
    • getRequestDispatcher

      public jakarta.servlet.RequestDispatcher getRequestDispatcher(String path)
      Specified by:
      getRequestDispatcher in interface jakarta.servlet.ServletRequest
    • getRequestURI

      public String getRequestURI()
      Specified by:
      getRequestURI in interface jakarta.servlet.http.HttpServletRequest
    • getRequestURL

      public StringBuffer getRequestURL()
      Specified by:
      getRequestURL in interface jakarta.servlet.http.HttpServletRequest
    • getRequestedSessionId

      public String getRequestedSessionId()
      Specified by:
      getRequestedSessionId in interface jakarta.servlet.http.HttpServletRequest
    • getScheme

      public String getScheme()
      Specified by:
      getScheme in interface jakarta.servlet.ServletRequest
    • getServerName

      public String getServerName()
      Specified by:
      getServerName in interface jakarta.servlet.ServletRequest
    • getServerPort

      public int getServerPort()
      Specified by:
      getServerPort in interface jakarta.servlet.ServletRequest
    • getServletContext

      public WebApplication getServletContext()
      Specified by:
      getServletContext in interface jakarta.servlet.ServletRequest
    • getServletPath

      public String getServletPath()
      Specified by:
      getServletPath in interface jakarta.servlet.http.HttpServletRequest
    • getSession

      public jakarta.servlet.http.HttpSession getSession()
      Specified by:
      getSession in interface jakarta.servlet.http.HttpServletRequest
    • getSession

      public jakarta.servlet.http.HttpSession getSession(boolean create)
      Specified by:
      getSession in interface jakarta.servlet.http.HttpServletRequest
    • getUpgradeHandler

      public jakarta.servlet.http.HttpUpgradeHandler getUpgradeHandler()
      Description copied from interface: WebApplicationRequest
      Returns the upgrade handler.
      Specified by:
      getUpgradeHandler in interface WebApplicationRequest
      Returns:
      the upgrade handler
    • getUserPrincipal

      public Principal getUserPrincipal()
      Specified by:
      getUserPrincipal in interface jakarta.servlet.http.HttpServletRequest
    • isAsyncStarted

      public boolean isAsyncStarted()
      Specified by:
      isAsyncStarted in interface jakarta.servlet.ServletRequest
    • isAsyncSupported

      public boolean isAsyncSupported()
      Specified by:
      isAsyncSupported in interface jakarta.servlet.ServletRequest
    • isRequestedSessionIdFromCookie

      public boolean isRequestedSessionIdFromCookie()
      Specified by:
      isRequestedSessionIdFromCookie in interface jakarta.servlet.http.HttpServletRequest
    • isRequestedSessionIdFromURL

      public boolean isRequestedSessionIdFromURL()
      Specified by:
      isRequestedSessionIdFromURL in interface jakarta.servlet.http.HttpServletRequest
    • isRequestedSessionIdValid

      public boolean isRequestedSessionIdValid()
      Specified by:
      isRequestedSessionIdValid in interface jakarta.servlet.http.HttpServletRequest
    • isSecure

      public boolean isSecure()
      Specified by:
      isSecure in interface jakarta.servlet.ServletRequest
    • isUpgraded

      public boolean isUpgraded()
      Description copied from interface: WebApplicationRequest
      Returns true when upgraded, false otherwise.
      Specified by:
      isUpgraded in interface WebApplicationRequest
      Returns:
      true when upgraded, false otherwise
    • isUserInRole

      public boolean isUserInRole(String role)
      Specified by:
      isUserInRole in interface jakarta.servlet.http.HttpServletRequest
    • login

      public void login(String username, String password) throws jakarta.servlet.ServletException
      Specified by:
      login in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      jakarta.servlet.ServletException
    • logout

      public void logout() throws jakarta.servlet.ServletException
      Specified by:
      logout in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      jakarta.servlet.ServletException
    • removeAttribute

      public void removeAttribute(String name)
      Specified by:
      removeAttribute in interface jakarta.servlet.ServletRequest
    • setAsyncSupported

      public void setAsyncSupported(boolean asyncSupported)
      Set the async supported flag.
      Parameters:
      asyncSupported - the async supported flag.
    • setAttribute

      public void setAttribute(String name, Object value)
      Specified by:
      setAttribute in interface jakarta.servlet.ServletRequest
    • setAuthType

      public void setAuthType(String authType)
      Set the auth type.
      Specified by:
      setAuthType in interface WebApplicationRequest
      Parameters:
      authType - the auth type.
    • setCharacterEncoding

      public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
      Specified by:
      setCharacterEncoding in interface jakarta.servlet.ServletRequest
      Throws:
      UnsupportedEncodingException
    • setContentLength

      public void setContentLength(int contentLength)
      Set the content length.
      Parameters:
      contentLength - the content length.
    • setContentType

      public void setContentType(String contentType)
      Set the content type.
      Parameters:
      contentType - the content type.
    • setContextPath

      public void setContextPath(String contextPath)
      Description copied from interface: WebApplicationRequest
      Set the context path.
      Specified by:
      setContextPath in interface WebApplicationRequest
      Parameters:
      contextPath - the context path.
    • setCookies

      public void setCookies(jakarta.servlet.http.Cookie[] cookies)
      Set the cookies.
      Parameters:
      cookies - the cookies.
    • setDispatcherType

      public void setDispatcherType(jakarta.servlet.DispatcherType dispatcherType)
      Description copied from interface: WebApplicationRequest
      Set the dispatcher type.
      Specified by:
      setDispatcherType in interface WebApplicationRequest
      Parameters:
      dispatcherType - the dispatcher type.
    • setHeader

      public void setHeader(String name, String value)
      Set the header.
      Parameters:
      name - the name.
      value - the value (string).
    • addHeader

      public void addHeader(String name, String value)
      Add the header.
      Parameters:
      name - the name.
      value - the value (string).
    • setInputStream

      public void setInputStream(InputStream inputStream)
      Set the input stream.
      Parameters:
      inputStream - the input stream.
    • setLocalAddr

      public void setLocalAddr(String localAddress)
      Set the local address.
      Parameters:
      localAddress - the local address.
    • setLocalName

      public void setLocalName(String localName)
      Set the local name.
      Parameters:
      localName - the local name.
    • setLocalPort

      public void setLocalPort(int localPort)
      Set the local port.
      Parameters:
      localPort - the local port.
    • setMethod

      public void setMethod(String method)
      Set the method.
      Parameters:
      method - the method.
    • setParameter

      public void setParameter(String name, String[] values)
      Set the parameter values.
      Parameters:
      name - the parameter name.
      values - the values.
    • setPathInfo

      public void setPathInfo(String pathInfo)
      Set the path info.
      Parameters:
      pathInfo - the path info.
    • setProtocol

      public void setProtocol(String protocol)
      Set the protocol.
      Parameters:
      protocol - the protocol.
    • setQueryString

      public void setQueryString(String queryString)
      Set the query string.
      Parameters:
      queryString - the query string.
    • setRemoteAddr

      public void setRemoteAddr(String remoteAddr)
      Set the remote address.
      Parameters:
      remoteAddr - the remote address.
    • setRemoteHost

      public void setRemoteHost(String remoteHost)
      Set the remote host.
      Parameters:
      remoteHost - the remote host.
    • setRemotePort

      public void setRemotePort(int remotePort)
      Set the remote port.
      Parameters:
      remotePort - the remote port.
    • setRequestedSessionId

      public void setRequestedSessionId(String requestedSessionId)
      Set the requested session id.
      Parameters:
      requestedSessionId - the requested session id.
    • setRequestedSessionIdFromCookie

      public void setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie)
      Set the requested session id from cookie.
      Parameters:
      requestedSessionIdFromCookie - the requested session id from cookie.
    • setRequestedSessionIdFromURL

      public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
      Set the request session id from URL flag.
      Parameters:
      requestedSessionIdFromURL - the requested session if from URL flag.
    • setScheme

      public void setScheme(String scheme)
      Set the scheme.
      Parameters:
      scheme - the scheme.
    • setServerName

      public void setServerName(String serverName)
      Set the server name.
      Parameters:
      serverName - the server name.
    • setServerPort

      public void setServerPort(int serverPort)
      Set the server port.
      Parameters:
      serverPort - the server port.
    • setServletPath

      public void setServletPath(String servletPath)
      Description copied from interface: WebApplicationRequest
      Set the servlet path.
      Specified by:
      setServletPath in interface WebApplicationRequest
      Parameters:
      servletPath - the servlet path.
    • getOriginalServletPath

      public String getOriginalServletPath()
      Gets the original Servlet Path
      Returns:
      the original Servlet Path
    • setOriginalServletPath

      public void setOriginalServletPath(String originalServletPath)
      Set the original Servlet Path
      Parameters:
      originalServletPath - the original Servlet Path
    • setUpgraded

      public void setUpgraded(boolean upgraded)
      Set the upgraded flag.
      Parameters:
      upgraded - the upgraded flag.
    • setUserPrincipal

      public void setUserPrincipal(Principal userPrincipal)
      Description copied from interface: WebApplicationRequest
      Set the user principal.
      Specified by:
      setUserPrincipal in interface WebApplicationRequest
      Parameters:
      userPrincipal - the user principal.
    • setWebApplication

      public void setWebApplication(WebApplication webApplication)
      Description copied from interface: WebApplicationRequest
      Set the web application.
      Specified by:
      setWebApplication in interface WebApplicationRequest
      Parameters:
      webApplication - the web application.
    • unwrap

      public static <T> T unwrap(jakarta.servlet.ServletRequest request, Class<T> type)
      Unwrap the request.
      Type Parameters:
      T - the type to unwrap to.
      Parameters:
      request - the request.
      type - the class type of the result
      Returns:
      the unwrapped request.
    • setAsyncStarted

      public void setAsyncStarted(boolean asyncStarted)
      Set the async started flag.
      Parameters:
      asyncStarted - the async started flag.
    • startAsync

      public jakarta.servlet.AsyncContext startAsync() throws IllegalStateException
      Specified by:
      startAsync in interface jakarta.servlet.ServletRequest
      Throws:
      IllegalStateException
    • startAsync

      public jakarta.servlet.AsyncContext startAsync(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws IllegalStateException
      Specified by:
      startAsync in interface jakarta.servlet.ServletRequest
      Throws:
      IllegalStateException
    • upgrade

      public <T extends jakarta.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, jakarta.servlet.ServletException
      Specified by:
      upgrade in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      IOException
      jakarta.servlet.ServletException
    • verifyMultipartFormData

      protected void verifyMultipartFormData() throws jakarta.servlet.ServletException
      Verify the method is of type "multipart/form-data"
      Throws:
      jakarta.servlet.ServletException - the exception thrown when it is not.
    • isFinished

      public boolean isFinished()
      Specified by:
      isFinished in class jakarta.servlet.ServletInputStream
    • isReady

      public boolean isReady()
      Specified by:
      isReady in class jakarta.servlet.ServletInputStream
    • setReadListener

      public void setReadListener(jakarta.servlet.ReadListener listener)
      Specified by:
      setReadListener in class jakarta.servlet.ServletInputStream
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • getRequestURIWithQueryString

      public String getRequestURIWithQueryString()
      Returns the request URI with query string.
      Returns:
      the request URI with query string
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getRequestId

      public String getRequestId()
      Specified by:
      getRequestId in interface jakarta.servlet.ServletRequest
    • getProtocolRequestId

      public String getProtocolRequestId()
      Specified by:
      getProtocolRequestId in interface jakarta.servlet.ServletRequest
    • getServletConnection

      public jakarta.servlet.ServletConnection getServletConnection()
      Specified by:
      getServletConnection in interface jakarta.servlet.ServletRequest