|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectninja.WrappedContext
public class WrappedContext
A wrapped context. Useful if filters want to modify the context before sending it on.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface ninja.Context |
---|
Context.HTTP_STATUS |
Field Summary |
---|
Fields inherited from interface ninja.Context |
---|
CONTENT_TYPE |
Constructor Summary | |
---|---|
WrappedContext(Context wrapped)
|
Method Summary | ||
---|---|---|
Context |
addCookie(Cookie cookie)
Add the given cookie to the response |
|
void |
asyncRequestComplete()
Indicate that processing this request is complete. |
|
Result |
controllerReturned()
|
|
ResponseStreams |
finalizeHeaders(Result result)
Finalizing the headers copies all stuff into the headers. |
|
String |
getCookieValue(String name)
Get the cookie value from the request, if defined |
|
org.apache.commons.fileupload.FileItemIterator |
getFileItemIterator()
Gets the FileItemIterator of the input. |
|
FlashCookie |
getFlashCookie()
Returns the flash cookie. |
|
String |
getHeader(String name)
Get the request header with the given name |
|
Map<String,String> |
getHeaders()
Get all the headers from the request |
|
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Deprecated. |
|
javax.servlet.http.HttpServletResponse |
getHttpServletResponse()
Deprecated. |
|
InputStream |
getInputStream()
Get the input stream to read the request. |
|
String |
getParameter(String key)
Get the parameter with the given key from the request. |
|
String |
getParameter(String key,
String defaultValue)
Same like Context.getParameter(String) , but returns given defaultValue
instead of null in case parameter cannot be found. |
|
Integer |
getParameterAsInteger(String key)
Same like Context.getParameter(String) , but converts the
parameter to Integer if found. |
|
Integer |
getParameterAsInteger(String key,
Integer defaultValue)
Same like Context.getParameter(String, String) , but converts the
parameter to Integer if found. |
|
Map<String,String[]> |
getParameters()
Get all the parameters from the request |
|
String |
getPathParameter(String key)
Get the path parameter for the given key. |
|
Integer |
getPathParameterAsInteger(String key)
Get the path parameter for the given key and convert it to Integer. |
|
String |
getPathParameterEncoded(String key)
Get the path parameter for the given key. |
|
BufferedReader |
getReader()
Get the reader to read the request. |
|
String |
getRequestContentType()
Content type of the request we got. |
|
String |
getRequestPath()
Returns the path that Ninja should act upon. |
|
String |
getRequestUri()
Returns the uri as seen by the server. |
|
Route |
getRoute()
Get the route for this context |
|
SessionCookie |
getSessionCookie()
Returns the client side session. |
|
Validation |
getValidation()
Get the validation context |
|
void |
handleAsync()
Indicate that this request is going to be handled asynchronously |
|
boolean |
isMultipart()
Check if request is of type multipart. |
|
|
parseBody(Class<T> classOfT)
This will give you the request body nicely parsed. |
|
void |
returnResultAsync(Result result)
Indicate that request processing of an async request is complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WrappedContext(Context wrapped)
Method Detail |
---|
public String getRequestUri()
Context
getRequestUri
in interface Context
public FlashCookie getFlashCookie()
Context
getFlashCookie
in interface Context
public SessionCookie getSessionCookie()
Context
getSessionCookie
in interface Context
public Context addCookie(Cookie cookie)
Context
addCookie
in interface Context
cookie
- The cookie to add
@Deprecated public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Context
getHttpServletRequest
in interface Context
@Deprecated public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Context
getHttpServletResponse
in interface Context
public String getParameter(String key)
Context
getParameter
in interface Context
key
- The key of the parameter
public String getParameter(String key, String defaultValue)
Context
Context.getParameter(String)
, but returns given defaultValue
instead of null in case parameter cannot be found.
The parameter is decoded by default.
getParameter
in interface Context
key
- The name of the post or query parameterdefaultValue
- A default value if parameter not found.
public Integer getParameterAsInteger(String key)
Context
Context.getParameter(String)
, but converts the
parameter to Integer if found.
The parameter is decoded by default.
getParameterAsInteger
in interface Context
key
- The name of the post or query parameter
public Integer getParameterAsInteger(String key, Integer defaultValue)
Context
Context.getParameter(String, String)
, but converts the
parameter to Integer if found.
The parameter is decoded by default.
getParameterAsInteger
in interface Context
key
- The name of the post or query parameterdefaultValue
- A default value if parameter not found.
public String getPathParameter(String key)
Context
getPathParameter
in interface Context
key
- The name of the path parameter in a route. Eg /{myName}/rest/of/url
public Integer getPathParameterAsInteger(String key)
Context
getPathParameterAsInteger
in interface Context
key
- the key of the path parameter
public Map<String,String[]> getParameters()
Context
getParameters
in interface Context
public String getHeader(String name)
Context
getHeader
in interface Context
public Map<String,String> getHeaders()
Context
getHeaders
in interface Context
public String getCookieValue(String name)
Context
getCookieValue
in interface Context
name
- The name of the cookie
public <T> T parseBody(Class<T> classOfT)
Context
BodyParserEngine
BodyParserEngineJson
and BodyParserEngineManager
parseBody
in interface Context
classOfT
- The class of the result.
public void handleAsync()
Context
handleAsync
in interface Context
public void returnResultAsync(Result result)
Context
returnResultAsync
in interface Context
public void asyncRequestComplete()
Context
asyncRequestComplete
in interface Context
public Result controllerReturned()
controllerReturned
in interface Context
public ResponseStreams finalizeHeaders(Result result)
Context
finalizeHeaders
in interface Context
public InputStream getInputStream() throws IOException
Context
getInputStream
in interface Context
IOException
public BufferedReader getReader() throws IOException
Context
getReader
in interface Context
IOException
public String getRequestContentType()
Context
getRequestContentType
in interface Context
public Route getRoute()
Context
getRoute
in interface Context
public boolean isMultipart()
Context
isMultipart
in interface Context
public org.apache.commons.fileupload.FileItemIterator getFileItemIterator()
Context
getFileItemIterator
in interface Context
public String getRequestPath()
Context
getRequestPath
in interface Context
public Validation getValidation()
Context
getValidation
in interface Context
public String getPathParameterEncoded(String key)
Context
getPathParameterEncoded
in interface Context
key
- The name of the path parameter in a route. Eg /{myName}/rest/of/url
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |