public class SandboxedRequest extends Object implements IRequest
RECENT_POSTBACK_COOKIE
Constructor and Description |
---|
SandboxedRequest(Sandbox sandbox,
IRequest request) |
Modifier and Type | Method and Description |
---|---|
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.
|
Map<String,Object> |
getBodyMap()
Parse the request body based on the content-type, usually either form encoded or JSON,
and then parse it into a Map
|
Object |
getBodyObject(Class clazz)
Interpret the body of the request as JSON and parse it into the given object.
|
Object |
getBodyParam(String name)
Internally, gets the request body as Map, and then returns the value for the given key
|
String |
getContent()
Gets the request body as a string
|
javax.servlet.http.Cookie |
getCookie(String cookieName) |
javax.servlet.http.Cookie[] |
getCookies() |
String |
getHeader(String name)
Get the given request header, case insensitive
|
Enumeration<String> |
getHeaderNames() |
String |
getHost()
Gets the host by first looking for the x-forwarded-for header, and then
the Host: header.
|
Boolean |
getIsJsonRequest()
Returns true if this request is expected to produce JSON, used to determine
what kind of response to give in cases of errors.
|
Map<String,Object> |
getItems()
Get an arbitrary hashmap of data that lives the lifetime of this request,
can be used as a very short lived cache, or for any other arbitrary use.
|
String |
getMethod()
Gets the HTTP method - GET, POST, PUT, DELETE, etc.
|
IOrg |
getOrg() |
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
|
String |
getRemoteAddr()
Get the RemoteAddr field from the underlying HttpServletRequest object,
which gets it from the socket connection.
|
SandboxedRequest |
getSandboxedRequest(Sandbox box)
Get a sandboxed version of this request object.
|
String |
getScheme() |
Set<String> |
getScopes()
If this is a scoped, OAuth request, return the scopes.
|
IUser |
getUser()
Gets the user associated with the current request
|
boolean |
isScoped()
Return true if this is scope-limited OAuth request
|
String |
requestUrl()
Get the full, externally facing URL used to intiate this request.
|
void |
setIsJsonRequest(Boolean isJsonRequest) |
void |
setItems(Map<String,Object> items) |
void |
setOrg(IOrg org) |
void |
setPath(String path) |
void |
setQuery(String query) |
StRequest |
setScoped(boolean scoped) |
StRequest |
setScopes(Set<String> scopes) |
void |
setUser(IUser user) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHttpServletRequest, getPart, getQueryParamAsList, getRequestUri, getRequestUrl, getRequestUrlWithQuery, setAsMultiPartRequest
public SandboxedRequest(Sandbox sandbox, IRequest request)
public String requestUrl()
IRequest
requestUrl
in interface IRequest
public String getQueryString()
IRequest
getQueryString
in interface IRequest
public String getRemoteAddr()
IRequest
getRemoteAddr
in interface IRequest
public String getActualIp()
IRequest
getActualIp
in interface IRequest
public Object getBodyObject(Class clazz)
IRequest
getBodyObject
in interface IRequest
public Map<String,Object> getBodyMap()
IRequest
getBodyMap
in interface IRequest
public Object getBodyParam(String name)
IRequest
getBodyParam
in interface IRequest
public Map<String,String> getQueryParams()
IRequest
getQueryParams
in interface IRequest
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface IRequest
public String getHeader(String name)
IRequest
public String getHost()
IRequest
public BufferedReader getReader() throws IOException
IRequest
getReader
in interface IRequest
IOException
public String getContent()
IRequest
getContent
in interface IRequest
public Enumeration<String> getHeaderNames()
getHeaderNames
in interface IRequest
public IUser getUser()
IRequest
public String getMethod()
IRequest
public String getParameter(String paramName)
IRequest
getParameter
in interface IRequest
public Boolean getIsJsonRequest()
IRequest
getIsJsonRequest
in interface IRequest
public void setIsJsonRequest(Boolean isJsonRequest)
setIsJsonRequest
in interface IRequest
public Map<String,Object> getItems()
IRequest
public SandboxedRequest getSandboxedRequest(Sandbox box)
IRequest
getSandboxedRequest
in interface IRequest
public Set<String> getScopes()
IRequest
public boolean isScoped()
IRequest
Copyright © 2016. All rights reserved.