Package waffle.mock.http
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the header.void
addParameter
(String parameterName, String parameterValue) Adds the parameter.int
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
Sets the method.void
setQueryString
(String query) Sets the query string.void
setRemoteAddr
(String value) Sets the remote addr.void
setRemoteHost
(String value) Sets the remote host.void
setRemoteUser
(String username) Sets the remote user.void
setRequestURI
(String uri) Sets the request uri.void
setUserPrincipal
(Principal value) 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
Adds the header.- Parameters:
headerName
- the header nameheaderValue
- the header value
-
getHeader
- Specified by:
getHeader
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getHeader
in classjavax.servlet.http.HttpServletRequestWrapper
-
getHeaderNames
- Specified by:
getHeaderNames
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getHeaderNames
in classjavax.servlet.http.HttpServletRequestWrapper
-
getMethod
- Specified by:
getMethod
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getMethod
in classjavax.servlet.http.HttpServletRequestWrapper
-
getContentLength
public int getContentLength()- Specified by:
getContentLength
in interfacejavax.servlet.ServletRequest
- Overrides:
getContentLength
in classjavax.servlet.ServletRequestWrapper
-
getRemotePort
public int getRemotePort()- Specified by:
getRemotePort
in interfacejavax.servlet.ServletRequest
- Overrides:
getRemotePort
in classjavax.servlet.ServletRequestWrapper
-
setMethod
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
Sets the remote user.- Parameters:
username
- the new remote user
-
getRemoteUser
- Specified by:
getRemoteUser
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getRemoteUser
in classjavax.servlet.http.HttpServletRequestWrapper
-
getSession
public javax.servlet.http.HttpSession getSession()- Specified by:
getSession
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getSession
in classjavax.servlet.http.HttpServletRequestWrapper
-
getSession
public javax.servlet.http.HttpSession getSession(boolean create) - Specified by:
getSession
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getSession
in classjavax.servlet.http.HttpServletRequestWrapper
-
getQueryString
- Specified by:
getQueryString
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getQueryString
in classjavax.servlet.http.HttpServletRequestWrapper
-
setQueryString
Sets the query string.- Parameters:
query
- the new query string
-
setRequestURI
Sets the request uri.- Parameters:
uri
- the new request uri
-
getRequestURI
- Specified by:
getRequestURI
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getRequestURI
in classjavax.servlet.http.HttpServletRequestWrapper
-
getParameter
- Specified by:
getParameter
in interfacejavax.servlet.ServletRequest
- Overrides:
getParameter
in classjavax.servlet.ServletRequestWrapper
-
addParameter
Adds the parameter.- Parameters:
parameterName
- the parameter nameparameterValue
- the parameter value
-
getRemoteHost
- Specified by:
getRemoteHost
in interfacejavax.servlet.ServletRequest
- Overrides:
getRemoteHost
in classjavax.servlet.ServletRequestWrapper
-
setRemoteHost
Sets the remote host.- Parameters:
value
- the new remote host
-
getRemoteAddr
- Specified by:
getRemoteAddr
in interfacejavax.servlet.ServletRequest
- Overrides:
getRemoteAddr
in classjavax.servlet.ServletRequestWrapper
-
setRemoteAddr
Sets the remote addr.- Parameters:
value
- the new remote addr
-
getUserPrincipal
- Specified by:
getUserPrincipal
in interfacejavax.servlet.http.HttpServletRequest
- Overrides:
getUserPrincipal
in classjavax.servlet.http.HttpServletRequestWrapper
-
setUserPrincipal
Sets the user principal.- Parameters:
value
- the new user principal
-