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, waitgetHttpServletRequest, getPart, getQueryParamAsList, getRequestUri, getRequestUrl, getRequestUrlWithQuery, setAsMultiPartRequestpublic SandboxedRequest(Sandbox sandbox, IRequest request)
public String requestUrl()
IRequestrequestUrl in interface IRequestpublic String getQueryString()
IRequestgetQueryString in interface IRequestpublic String getRemoteAddr()
IRequestgetRemoteAddr in interface IRequestpublic String getActualIp()
IRequestgetActualIp in interface IRequestpublic Object getBodyObject(Class clazz)
IRequestgetBodyObject in interface IRequestpublic Map<String,Object> getBodyMap()
IRequestgetBodyMap in interface IRequestpublic Object getBodyParam(String name)
IRequestgetBodyParam in interface IRequestpublic Map<String,String> getQueryParams()
IRequestgetQueryParams in interface IRequestpublic javax.servlet.http.Cookie[] getCookies()
getCookies in interface IRequestpublic String getHeader(String name)
IRequestpublic String getHost()
IRequestpublic BufferedReader getReader() throws IOException
IRequestgetReader in interface IRequestIOExceptionpublic String getContent()
IRequestgetContent in interface IRequestpublic Enumeration<String> getHeaderNames()
getHeaderNames in interface IRequestpublic IUser getUser()
IRequestpublic String getMethod()
IRequestpublic String getParameter(String paramName)
IRequestgetParameter in interface IRequestpublic Boolean getIsJsonRequest()
IRequestgetIsJsonRequest in interface IRequestpublic void setIsJsonRequest(Boolean isJsonRequest)
setIsJsonRequest in interface IRequestpublic Map<String,Object> getItems()
IRequestpublic SandboxedRequest getSandboxedRequest(Sandbox box)
IRequestgetSandboxedRequest in interface IRequestpublic Set<String> getScopes()
IRequestpublic boolean isScoped()
IRequestCopyright © 2016. All rights reserved.