|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectninja.ContextImpl
public class ContextImpl
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface ninja.Context |
---|
Context.HTTP_STATUS |
Constructor Summary | |
---|---|
ContextImpl(BodyParserEngineManager bodyParserEngineManager,
FlashCookie flashCookie,
SessionCookie sessionCookie,
ResultHandler resultHandler,
Validation validation)
|
Method Summary | ||
---|---|---|
Context |
addCookie(Cookie cookie)
Add the given cookie to the response |
|
void |
asyncRequestComplete()
Indicate that processing this request is complete. |
|
Result |
controllerReturned()
Used to indicate that the controller has finished executing |
|
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()
Get the underlying HTTP servlet request |
|
javax.servlet.http.HttpServletResponse |
getHttpServletResponse()
Get the underlying HTTP servlet response |
|
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. |
|
BufferedReader |
getReader()
Get the reader to read the request. |
|
String |
getRequestContentType()
Content type of the request we got. |
|
String |
getRequestPath()
Returns the path as seen by the server. |
|
String |
getRequestUri()
Deprecated. |
|
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 |
|
void |
init(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
|
|
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. |
|
void |
setRoute(Route route)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Inject public ContextImpl(BodyParserEngineManager bodyParserEngineManager, FlashCookie flashCookie, SessionCookie sessionCookie, ResultHandler resultHandler, Validation validation)
Method Detail |
---|
public void init(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
public void setRoute(Route route)
public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Context
getHttpServletRequest
in interface Context
public javax.servlet.http.HttpServletResponse getHttpServletResponse()
Context
getHttpServletResponse
in interface Context
public String getPathParameter(String key)
Context
getPathParameter
in interface Context
key
- The key of the path parameter
public Integer getPathParameterAsInteger(String key)
Context
getPathParameterAsInteger
in interface Context
key
- the key of the path parameter
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
getParameter
in interface Context
public Integer getParameterAsInteger(String key)
Context
Context.getParameter(String)
, but converts the
parameter to Integer if found.
getParameterAsInteger
in interface Context
public Integer getParameterAsInteger(String key, Integer defaultValue)
Context
Context.getParameter(String, String)
, but converts the
parameter to Integer if found.
getParameterAsInteger
in interface Context
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 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 String getRequestUri()
Context
getRequestUri
in interface Context
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 InputStream getInputStream() throws IOException
Context
getInputStream
in interface Context
IOException
public BufferedReader getReader() throws IOException
Context
getReader
in interface Context
IOException
public ResponseStreams finalizeHeaders(Result result)
Context
finalizeHeaders
in interface Context
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |