public class RhnMockHttpServletRequest
extends com.mockobjects.servlet.MockHttpServletRequest
Constructor and Description |
---|
RhnMockHttpServletRequest()
default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(java.lang.String name,
java.lang.Object value)
Adds a new attribute the Request.
|
void |
addCookie(javax.servlet.http.Cookie cookie)
Allows you to add a Cookie to the request to simulate receiving
a cookie from the browser.
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the attribute bound to the given name.
|
java.lang.String |
getCharacterEncoding() |
javax.servlet.http.Cookie[] |
getCookies() |
java.lang.String |
getHeader(java.lang.String name) |
java.util.Enumeration |
getHeaderNames() |
java.util.Locale |
getLocale() |
java.util.Enumeration |
getLocales() |
java.lang.String |
getMethod() |
java.lang.String |
getParameter(java.lang.String paramName)
Override to return 'null' if the requested param doesn't exist
(Mock throws an AssertionError in this case :(
|
java.util.Map |
getParameterMap() |
java.lang.String |
getRemoteUser() |
java.lang.StringBuffer |
getRequestURL()
Overrides the MockHttpServletRequest to actually return a value.
|
int |
getServerPort() |
boolean |
isSecure() |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets an attribute the Request.
|
void |
setCharacterEncoding(java.lang.String encodingIn) |
void |
setLocale(java.util.Locale lcl)
Set the primary locale of this Request.
|
void |
setLocales(java.util.List lcls)
Set the list of Locales.
|
void |
setMethod(java.lang.String methodIn) |
void |
setRequestURL(java.lang.String pathIn)
Added the ability to specify a context path for testing.
|
void |
setupGetHeader(java.lang.String headerName,
java.lang.String value)
Add a GET header to the request.
|
void |
setupGetHeaderNames(java.util.Enumeration headerNamesIn)
Header Names
|
void |
setupGetParameterMap(java.util.Map map) |
void |
setupGetServerPort(int p)
Sets the server port for this request.
|
void |
setupIsSecure(boolean s)
Configures whether this request is secure.
|
addExpectedGetAttributeName, addExpectedSetAttribute, getAttributeNames, getAuthType, getContentLength, getContentType, getContextPath, getDateHeader, getHeaders, getInputStream, getIntHeader, getParameterNames, getParameterValues, getPathInfo, getPathTranslated, getProtocol, getQueryString, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getRequestedSessionId, getRequestURI, getScheme, getServerName, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, removeAttribute, setContentType, setExpectedContentType, setExpectedCreateSession, setExpectedRequestDispatcherURI, setSession, setupAddHeader, setupAddParameter, setupAddParameter, setupGetAttribute, setupGetAttrubuteNames, setupGetContentType, setupGetContextPath, setupGetInputStream, setupGetMethod, setupGetParameterNames, setupGetProtocol, setupGetReader, setupGetRemoteAddr, setupGetRequestDispatcher, setupGetRequestURI, setupGetServletPath, setupGetUserPrincipal, setupPathInfo, setupQueryString, setupRemoveAttribute, setupScheme, setupServerName
assertEquals, assertEquals, assertTrue, fail, notImplemented, notYetImplemented, notYetImplemented, verify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public java.lang.StringBuffer getRequestURL()
getRequestURL
in interface javax.servlet.http.HttpServletRequest
getRequestURL
in class com.mockobjects.servlet.MockHttpServletRequest
public void setRequestURL(java.lang.String pathIn)
pathIn
- Request url path.public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.servlet.ServletRequest
getAttribute
in class com.mockobjects.servlet.MockHttpServletRequest
name
- Name of attribute whose value is sought.public void addAttribute(java.lang.String name, java.lang.Object value)
name
- attribute namevalue
- attribute valuepublic void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface javax.servlet.ServletRequest
setAttribute
in class com.mockobjects.servlet.MockHttpServletRequest
name
- attribute namevalue
- attribute valuepublic java.lang.String getHeader(java.lang.String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
getHeader
in class com.mockobjects.servlet.MockHttpServletRequest
public java.util.Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
getHeaderNames
in class com.mockobjects.servlet.MockHttpServletRequest
public void setupGetHeaderNames(java.util.Enumeration headerNamesIn)
headerNamesIn
- attribute headerNamespublic java.lang.String getParameter(java.lang.String paramName)
getParameter
in interface javax.servlet.ServletRequest
getParameter
in class com.mockobjects.servlet.MockHttpServletRequest
paramName
- name of param to look uppublic java.util.Map getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
getParameterMap
in class com.mockobjects.servlet.MockHttpServletRequest
public void setupGetParameterMap(java.util.Map map)
setupGetParameterMap
in class com.mockobjects.servlet.MockHttpServletRequest
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
getLocale
in class com.mockobjects.servlet.MockHttpServletRequest
public void setLocale(java.util.Locale lcl)
lcl
- The primary Local of this Request.public void setLocales(java.util.List lcls)
lcls
- List of Locales.public java.util.Enumeration getLocales()
getLocales
in interface javax.servlet.ServletRequest
getLocales
in class com.mockobjects.servlet.MockHttpServletRequest
public void addCookie(javax.servlet.http.Cookie cookie)
cookie
- Cookie to added.public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
getCookies
in class com.mockobjects.servlet.MockHttpServletRequest
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
getServerPort
in class com.mockobjects.servlet.MockHttpServletRequest
public void setupGetServerPort(int p)
p
- Portpublic void setupGetHeader(java.lang.String headerName, java.lang.String value)
headerName
- name of header to be addedvalue
- value of header to be added.public void setupIsSecure(boolean s)
s
- Flag indicating whether request is secure.public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
isSecure
in class com.mockobjects.servlet.MockHttpServletRequest
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
getCharacterEncoding
in class com.mockobjects.servlet.MockHttpServletRequest
public void setCharacterEncoding(java.lang.String encodingIn)
setCharacterEncoding
in interface javax.servlet.ServletRequest
setCharacterEncoding
in class com.mockobjects.servlet.MockHttpServletRequest
public java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
getMethod
in class com.mockobjects.servlet.MockHttpServletRequest
public void setMethod(java.lang.String methodIn)
methodIn
- The method to set.public java.lang.String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
getRemoteUser
in class com.mockobjects.servlet.MockHttpServletRequest