Class RealtimeHttpServletRequestWrapper

java.lang.Object
cloud.piranha.extension.weld.RealtimeHttpServletRequestWrapper
All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest
Direct Known Subclasses:
WeldHttpServletRequest

public abstract class RealtimeHttpServletRequestWrapper extends Object implements jakarta.servlet.http.HttpServletRequest
An HttpServletRequest wrapper that consistently consults the getWrapped() method for every operation.
Author:
Arjan Tijms, Manfred Riem ([email protected])
  • Constructor Details

    • RealtimeHttpServletRequestWrapper

      public RealtimeHttpServletRequestWrapper()
  • Method Details

    • getAsyncContext

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

      public Object getAttribute(String name)
      Get the attribute.
      Specified by:
      getAttribute in interface jakarta.servlet.ServletRequest
      Parameters:
      name - the name.
      Returns:
      the value.
    • getAttributeNames

      public Enumeration<String> getAttributeNames()
      Returns the attribute names.
      Specified by:
      getAttributeNames in interface jakarta.servlet.ServletRequest
      Returns:
      the attribute names
    • getCharacterEncoding

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

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

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

      public String getContentType()
      Returns the content type.
      Specified by:
      getContentType in interface jakarta.servlet.ServletRequest
      Returns:
      the content type
    • getDispatcherType

      public jakarta.servlet.DispatcherType getDispatcherType()
      Get the dispatcher type.
      Specified by:
      getDispatcherType in interface jakarta.servlet.ServletRequest
    • getInputStream

      public jakarta.servlet.ServletInputStream getInputStream() throws IOException
      Returns the input stream.
      Specified by:
      getInputStream in interface jakarta.servlet.ServletRequest
      Returns:
      the input stream
      Throws:
      IOException - when an I/O error occurs.
    • getLocalAddr

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

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

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

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

      public Enumeration<Locale> getLocales()
      Returns the locales.
      Specified by:
      getLocales in interface jakarta.servlet.ServletRequest
      Returns:
      the locales
    • getParameter

      public String getParameter(String name)
      Get the parameter.
      Specified by:
      getParameter in interface jakarta.servlet.ServletRequest
      Parameters:
      name - the name.
      Returns:
      the value, or null if not found.
    • getParameterMap

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

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

      public String[] getParameterValues(String name)
      Get the parameter values.
      Specified by:
      getParameterValues in interface jakarta.servlet.ServletRequest
      Parameters:
      name - the name.
      Returns:
      the values.
    • getProtocol

      public String getProtocol()
      Returns the protocol.
      Specified by:
      getProtocol in interface jakarta.servlet.ServletRequest
      Returns:
      the protocol
    • getReader

      public BufferedReader getReader() throws IOException
      Get the reader.
      Specified by:
      getReader in interface jakarta.servlet.ServletRequest
      Returns:
      the reader.
      Throws:
      IOException - when an I/O error occurs.
    • getRemoteAddr

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

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

      public int getRemotePort()
      Returns the remote port.
      Specified by:
      getRemotePort in interface jakarta.servlet.ServletRequest
      Returns:
      the remote port
    • getRequest

      public jakarta.servlet.ServletRequest getRequest()
      Returns the wrapped request.
      Returns:
      the wrapped request
    • getRequestDispatcher

      public jakarta.servlet.RequestDispatcher getRequestDispatcher(String path)
      Returns the request dispatcher.
      Specified by:
      getRequestDispatcher in interface jakarta.servlet.ServletRequest
      Parameters:
      path - the path.
      Returns:
      the request dispatcher
    • getScheme

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

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

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

      public jakarta.servlet.ServletContext getServletContext()
      Returns the servlet context.
      Specified by:
      getServletContext in interface jakarta.servlet.ServletRequest
      Returns:
      the servlet context
    • isAsyncStarted

      public boolean isAsyncStarted()
      Is async started.
      Specified by:
      isAsyncStarted in interface jakarta.servlet.ServletRequest
      Returns:
      true if async started, false otherwise.
    • isAsyncSupported

      public boolean isAsyncSupported()
      Is async supported.
      Specified by:
      isAsyncSupported in interface jakarta.servlet.ServletRequest
      Returns:
      true if async is supported, false otherwise.
    • isSecure

      public boolean isSecure()
      Is secure.
      Specified by:
      isSecure in interface jakarta.servlet.ServletRequest
      Returns:
      true if it is, false otherwise.
    • isWrapperFor

      public boolean isWrapperFor(jakarta.servlet.ServletRequest wrapped)
      Is this a wrapper for the given request.
      Parameters:
      wrapped - the wrapped request.
      Returns:
      true if it is, false otherwise.
    • isWrapperFor

      public boolean isWrapperFor(Class<?> wrappedType)
      Are we a wrapper for the given type.
      Parameters:
      wrappedType - the wrapped type.
      Returns:
      true if we are, false otherwise.
    • removeAttribute

      public void removeAttribute(String name)
      Remove the attribute.
      Specified by:
      removeAttribute in interface jakarta.servlet.ServletRequest
      Parameters:
      name - the name.
    • setAttribute

      public void setAttribute(String name, Object object)
      Set the attribute.
      Specified by:
      setAttribute in interface jakarta.servlet.ServletRequest
      Parameters:
      name - the name.
      object - the object value.
    • setCharacterEncoding

      public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
      Set the character encoding.
      Specified by:
      setCharacterEncoding in interface jakarta.servlet.ServletRequest
      Parameters:
      characterEncoding - the character encoding.
      Throws:
      UnsupportedEncodingException - when trying to set an unsupported character encoding.
    • startAsync

      public jakarta.servlet.AsyncContext startAsync() throws IllegalStateException
      Start async processing.
      Specified by:
      startAsync in interface jakarta.servlet.ServletRequest
      Throws:
      IllegalStateException - when not allowed.
    • startAsync

      public jakarta.servlet.AsyncContext startAsync(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) throws IllegalStateException
      Start async processing.
      Specified by:
      startAsync in interface jakarta.servlet.ServletRequest
      Parameters:
      servletRequest - the servlet request.
      servletResponse - the servlet response.
      Throws:
      IllegalStateException
    • authenticate

      public boolean authenticate(jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Authenticate the request.
      Specified by:
      authenticate in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      response - the response.
      Throws:
      IOException - when an I/O error occurs.
      jakarta.servlet.ServletException - when a Servlet error occurs.
    • changeSessionId

      public String changeSessionId()
      Change the session id.
      Specified by:
      changeSessionId in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the new session id.
    • getAuthType

      public String getAuthType()
      Returns the auth type.
      Specified by:
      getAuthType in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the auth type
    • getContextPath

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

      public jakarta.servlet.http.Cookie[] getCookies()
      Get the cookies.
      Specified by:
      getCookies in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the cookies, or null if none.
    • getDateHeader

      public long getDateHeader(String name)
      Get the date header.
      Specified by:
      getDateHeader in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      name - the name.
      Returns:
      the date, or -1 if not found.
    • getHeader

      public String getHeader(String name)
      Get the header.
      Specified by:
      getHeader in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      name - the name.
      Returns:
      the value, or null if not found.
    • getHeaderNames

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

      public Enumeration<String> getHeaders(String name)
      Get the headers.
      Specified by:
      getHeaders in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      name - the name.
      Returns:
      the values.
    • getIntHeader

      public int getIntHeader(String name)
      Get the int header.
      Specified by:
      getIntHeader in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      name - the name.
      Returns:
      the int, or -1 if not found.
    • getMethod

      public String getMethod()
      Returns the method.
      Specified by:
      getMethod in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the method
    • getPart

      public jakarta.servlet.http.Part getPart(String name) throws IOException, jakarta.servlet.ServletException
      Get the part.
      Specified by:
      getPart in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      name - the name.
      Throws:
      IOException - when an I/O error occurs.
      jakarta.servlet.ServletException - when a Servlet error occurs.
    • getParts

      public Collection<jakarta.servlet.http.Part> getParts() throws IOException, jakarta.servlet.ServletException
      Get the parts.
      Specified by:
      getParts in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the parts.
      Throws:
      IOException - when an I/O error occurs.
      jakarta.servlet.ServletException - when a Servlet error occurs.
    • getPathInfo

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

      public String getPathTranslated()
      Returns the path translated.
      Specified by:
      getPathTranslated in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the path translated
    • getQueryString

      public String getQueryString()
      Returns the query string.
      Specified by:
      getQueryString in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the query string
    • getRemoteUser

      public String getRemoteUser()
      Returns the remote user.
      Specified by:
      getRemoteUser in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the remote user
    • getRequestURI

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

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

      public String getRequestedSessionId()
      Returns the requested session id.
      Specified by:
      getRequestedSessionId in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the requested session id
    • getServletPath

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

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

      public jakarta.servlet.http.HttpSession getSession(boolean create)
      Get the HTTP session.
      Specified by:
      getSession in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      create - the create flag.
      Returns:
      the HTTP session, or null if not able to create.
    • getUserPrincipal

      public Principal getUserPrincipal()
      Returns the user principal.
      Specified by:
      getUserPrincipal in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      the user principal
    • getWrapped

      protected abstract jakarta.servlet.http.HttpServletRequest getWrapped()
      Returns the wrapped request.
      Returns:
      the wrapped request
    • isRequestedSessionIdFromCookie

      public boolean isRequestedSessionIdFromCookie()
      Is the requested session id from a cookie.
      Specified by:
      isRequestedSessionIdFromCookie in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      true if it is, false otherwise.
    • isRequestedSessionIdFromURL

      public boolean isRequestedSessionIdFromURL()
      Is the requested session id from a URL.
      Specified by:
      isRequestedSessionIdFromURL in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      true if it is, false otherwise.
    • isRequestedSessionIdValid

      public boolean isRequestedSessionIdValid()
      Is the requested session id valid.
      Specified by:
      isRequestedSessionIdValid in interface jakarta.servlet.http.HttpServletRequest
      Returns:
      true if it is, false otherwise.
    • isUserInRole

      public boolean isUserInRole(String role)
      Is the user in the role.
      Specified by:
      isUserInRole in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      role - the role.
      Returns:
      true if the user is, false otherwise.
    • login

      public void login(String username, String password) throws jakarta.servlet.ServletException
      Login.
      Specified by:
      login in interface jakarta.servlet.http.HttpServletRequest
      Parameters:
      username - the username.
      password - the password.
      Throws:
      jakarta.servlet.ServletException - when a Servlet error occurs.
    • logout

      public void logout() throws jakarta.servlet.ServletException
      Logout.
      Specified by:
      logout in interface jakarta.servlet.http.HttpServletRequest
      Throws:
      jakarta.servlet.ServletException - when a Servlet error occurs.
    • upgrade

      public <T extends jakarta.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, jakarta.servlet.ServletException
      Upgrade the request.
      Specified by:
      upgrade in interface jakarta.servlet.http.HttpServletRequest
      Type Parameters:
      T - the type of HTTP upgrade handler class.
      Parameters:
      handlerClass - the handler class.
      Returns:
      the HTTP upgrade handler.
      Throws:
      IOException - when an I/O error occurs.
      jakarta.servlet.ServletException - when a Servlet error occurs.