Class SimpleHttpRequest

java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
waffle.mock.http.SimpleHttpRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class SimpleHttpRequest extends javax.servlet.http.HttpServletRequestWrapper
The Class SimpleHttpRequest.
  • Field Summary

    Fields inherited from interface javax.servlet.http.HttpServletRequest

    BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new simple http request.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addHeader(String headerName, String headerValue)
    Adds the header.
    void
    addParameter(String parameterName, String parameterValue)
    Adds the parameter.
    int
     
    getHeader(String headerName)
     
     
     
    getParameter(String parameterName)
     
     
     
     
    int
     
     
     
    javax.servlet.http.HttpSession
     
    javax.servlet.http.HttpSession
    getSession(boolean create)
     
     
    static int
    Next remote port.
    static void
    Reset remote port.
    void
    setContentLength(int length)
    Sets the content length.
    void
    setMethod(String methodName)
    Sets the method.
    void
    Sets the query string.
    void
    Sets the remote addr.
    void
    Sets the remote host.
    void
    Sets the remote user.
    void
    Sets the request uri.
    void
    Sets the user principal.

    Methods inherited from class javax.servlet.http.HttpServletRequestWrapper

    authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeaders, getHttpServletMapping, getIntHeader, getPart, getParts, getPathInfo, getPathTranslated, getRequestedSessionId, getRequestURL, getServletPath, getTrailerFields, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade

    Methods inherited from class javax.servlet.ServletRequestWrapper

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface javax.servlet.ServletRequest

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
  • Constructor Details

    • SimpleHttpRequest

      public SimpleHttpRequest()
      Instantiates a new simple http request.
  • Method Details

    • nextRemotePort

      public static int nextRemotePort()
      Next remote port.
      Returns:
      the int
    • resetRemotePort

      public static void resetRemotePort()
      Reset remote port.
    • addHeader

      public void addHeader(String headerName, String headerValue)
      Adds the header.
      Parameters:
      headerName - the header name
      headerValue - the header value
    • getHeader

      public String getHeader(String headerName)
      Specified by:
      getHeader in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getHeader in class javax.servlet.http.HttpServletRequestWrapper
    • getHeaderNames

      public Enumeration<String> getHeaderNames()
      Specified by:
      getHeaderNames in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getHeaderNames in class javax.servlet.http.HttpServletRequestWrapper
    • getMethod

      public String getMethod()
      Specified by:
      getMethod in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getMethod in class javax.servlet.http.HttpServletRequestWrapper
    • getContentLength

      public int getContentLength()
      Specified by:
      getContentLength in interface javax.servlet.ServletRequest
      Overrides:
      getContentLength in class javax.servlet.ServletRequestWrapper
    • getRemotePort

      public int getRemotePort()
      Specified by:
      getRemotePort in interface javax.servlet.ServletRequest
      Overrides:
      getRemotePort in class javax.servlet.ServletRequestWrapper
    • setMethod

      public void setMethod(String methodName)
      Sets the method.
      Parameters:
      methodName - the new method
    • setContentLength

      public void setContentLength(int length)
      Sets the content length.
      Parameters:
      length - the new content length
    • setRemoteUser

      public void setRemoteUser(String username)
      Sets the remote user.
      Parameters:
      username - the new remote user
    • getRemoteUser

      public String getRemoteUser()
      Specified by:
      getRemoteUser in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getRemoteUser in class javax.servlet.http.HttpServletRequestWrapper
    • getSession

      public javax.servlet.http.HttpSession getSession()
      Specified by:
      getSession in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getSession in class javax.servlet.http.HttpServletRequestWrapper
    • getSession

      public javax.servlet.http.HttpSession getSession(boolean create)
      Specified by:
      getSession in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getSession in class javax.servlet.http.HttpServletRequestWrapper
    • getQueryString

      public String getQueryString()
      Specified by:
      getQueryString in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getQueryString in class javax.servlet.http.HttpServletRequestWrapper
    • setQueryString

      public void setQueryString(String query)
      Sets the query string.
      Parameters:
      query - the new query string
    • setRequestURI

      public void setRequestURI(String uri)
      Sets the request uri.
      Parameters:
      uri - the new request uri
    • getRequestURI

      public String getRequestURI()
      Specified by:
      getRequestURI in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getRequestURI in class javax.servlet.http.HttpServletRequestWrapper
    • getParameter

      public String getParameter(String parameterName)
      Specified by:
      getParameter in interface javax.servlet.ServletRequest
      Overrides:
      getParameter in class javax.servlet.ServletRequestWrapper
    • addParameter

      public void addParameter(String parameterName, String parameterValue)
      Adds the parameter.
      Parameters:
      parameterName - the parameter name
      parameterValue - the parameter value
    • getRemoteHost

      public String getRemoteHost()
      Specified by:
      getRemoteHost in interface javax.servlet.ServletRequest
      Overrides:
      getRemoteHost in class javax.servlet.ServletRequestWrapper
    • setRemoteHost

      public void setRemoteHost(String value)
      Sets the remote host.
      Parameters:
      value - the new remote host
    • getRemoteAddr

      public String getRemoteAddr()
      Specified by:
      getRemoteAddr in interface javax.servlet.ServletRequest
      Overrides:
      getRemoteAddr in class javax.servlet.ServletRequestWrapper
    • setRemoteAddr

      public void setRemoteAddr(String value)
      Sets the remote addr.
      Parameters:
      value - the new remote addr
    • getUserPrincipal

      public Principal getUserPrincipal()
      Specified by:
      getUserPrincipal in interface javax.servlet.http.HttpServletRequest
      Overrides:
      getUserPrincipal in class javax.servlet.http.HttpServletRequestWrapper
    • setUserPrincipal

      public void setUserPrincipal(Principal value)
      Sets the user principal.
      Parameters:
      value - the new user principal