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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the header.voidaddParameter(String parameterName, String parameterValue) Adds the parameter.intgetParameter(String parameterName) intjavax.servlet.http.HttpSessionjavax.servlet.http.HttpSessiongetSession(boolean create) static intNext remote port.static voidReset remote port.voidsetContentLength(int length) Sets the content length.voidSets the method.voidsetQueryString(String query) Sets the query string.voidsetRemoteAddr(String value) Sets the remote addr.voidsetRemoteHost(String value) Sets the remote host.voidsetRemoteUser(String username) Sets the remote user.voidsetRequestURI(String uri) Sets the request uri.voidsetUserPrincipal(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, upgradeMethods 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, startAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getHeaderin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getHeaderin classjavax.servlet.http.HttpServletRequestWrapper
-
getHeaderNames
- Specified by:
getHeaderNamesin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getHeaderNamesin classjavax.servlet.http.HttpServletRequestWrapper
-
getMethod
- Specified by:
getMethodin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getMethodin classjavax.servlet.http.HttpServletRequestWrapper
-
getContentLength
public int getContentLength()- Specified by:
getContentLengthin interfacejavax.servlet.ServletRequest- Overrides:
getContentLengthin classjavax.servlet.ServletRequestWrapper
-
getRemotePort
public int getRemotePort()- Specified by:
getRemotePortin interfacejavax.servlet.ServletRequest- Overrides:
getRemotePortin 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:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRemoteUserin classjavax.servlet.http.HttpServletRequestWrapper
-
getSession
public javax.servlet.http.HttpSession getSession()- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getSessionin classjavax.servlet.http.HttpServletRequestWrapper
-
getSession
public javax.servlet.http.HttpSession getSession(boolean create) - Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getSessionin classjavax.servlet.http.HttpServletRequestWrapper
-
getQueryString
- Specified by:
getQueryStringin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getQueryStringin 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:
getRequestURIin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRequestURIin classjavax.servlet.http.HttpServletRequestWrapper
-
getParameter
- Specified by:
getParameterin interfacejavax.servlet.ServletRequest- Overrides:
getParameterin classjavax.servlet.ServletRequestWrapper
-
addParameter
Adds the parameter.- Parameters:
parameterName- the parameter nameparameterValue- the parameter value
-
getRemoteHost
- Specified by:
getRemoteHostin interfacejavax.servlet.ServletRequest- Overrides:
getRemoteHostin classjavax.servlet.ServletRequestWrapper
-
setRemoteHost
Sets the remote host.- Parameters:
value- the new remote host
-
getRemoteAddr
- Specified by:
getRemoteAddrin interfacejavax.servlet.ServletRequest- Overrides:
getRemoteAddrin classjavax.servlet.ServletRequestWrapper
-
setRemoteAddr
Sets the remote addr.- Parameters:
value- the new remote addr
-
getUserPrincipal
- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getUserPrincipalin classjavax.servlet.http.HttpServletRequestWrapper
-
setUserPrincipal
Sets the user principal.- Parameters:
value- the new user principal
-