public class MockRequest extends StRequest
RECENT_POSTBACK_COOKIE
Constructor and Description |
---|
MockRequest(String path) |
MockRequest(String path,
String method) |
Modifier and Type | Method and Description |
---|---|
MockRequest |
addData(String key,
Object value) |
MockRequest |
addHeader(String name,
String value) |
protected BufferedReader |
contentToReader() |
protected String |
dataObjectToString() |
protected String |
dataToString() |
String |
getActualIp()
Tries to guess the actual IP address of the end-user, by looking at the
IP address header as defined in settings.ipHeaderName (x-real-ip by default) and
then getRemoteAddr() if the header does not exist.
|
String |
getContent()
Gets the request body as a string
|
javax.servlet.http.Cookie |
getCookie(String name) |
javax.servlet.http.Cookie[] |
getCookies() |
String |
getHeader(String name)
Get the given request header, case insensitive
|
String |
getMethod()
Gets the HTTP method - GET, POST, PUT, DELETE, etc.
|
String |
getParameter(String paramName)
Gets the parameter from either the query string or the request body
|
String |
getPath()
Get the request path
|
Map<String,String> |
getQueryParams()
Parses the query string into a map
|
String |
getQueryString()
Get the request query string, everything after the ? in the URL
|
BufferedReader |
getReader()
Get a Reader that reads the request body
|
MockRequest |
setContent(String content) |
StRequest |
setCookies(javax.servlet.http.Cookie... cookies) |
MockRequest |
setData(Map<String,Object> data) |
MockRequest |
setDataObject(Object dataObject) |
StRequest |
setHandled(Boolean val) |
void |
setPath(String path) |
void |
setQuery(String q) |
static Map<String,String> |
splitQuery(URL url) |
getBodyMap, getBodyObject, getBodyParam, getHeaderNames, getHost, getHttpServletRequest, getIsJsonRequest, getItems, getOrg, getPart, getRemoteAddr, getSandboxedRequest, getScheme, getScopes, getUser, getValetEmail, getValetUserId, isScoped, requestUrl, setAsMultiPartRequest, setIsJsonRequest, setItems, setOrg, setScoped, setScopes, setUser, setValetEmail, setValetUserId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getQueryParamAsList, getRequestUri, getRequestUrl, getRequestUrlWithQuery
public MockRequest(String path)
public MockRequest(String path, String method)
public static Map<String,String> splitQuery(URL url)
public MockRequest addHeader(String name, String value)
public MockRequest addData(String key, Object value)
public MockRequest setData(Map<String,Object> data)
public MockRequest setDataObject(Object dataObject)
public MockRequest setContent(String content)
public String getContent()
IRequest
getContent
in interface IRequest
getContent
in class StRequest
public BufferedReader getReader()
IRequest
public StRequest setHandled(Boolean val)
public String getHeader(String name)
IRequest
public String getParameter(String paramName)
IRequest
getParameter
in interface IRequest
getParameter
in class StRequest
public String getMethod()
IRequest
public Map<String,String> getQueryParams()
IRequest
getQueryParams
in interface IRequest
getQueryParams
in class StRequest
public String getActualIp()
IRequest
getActualIp
in interface IRequest
getActualIp
in class StRequest
protected String dataToString()
protected String dataObjectToString()
protected BufferedReader contentToReader()
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface IRequest
getCookies
in class StRequest
public StRequest setCookies(javax.servlet.http.Cookie... cookies)
public String getQueryString()
IRequest
getQueryString
in interface IRequest
getQueryString
in class StRequest
Copyright © 2016. All rights reserved.