public class NinjaServletContext extends AbstractContext
AbstractContext
first. For example, instead of relying on
httpServletRequest.getHeader()
you could reuse the existing
this.getHeader()
and be able to implement your feature entirely
in AbstractContext
.Context.HTTP_STATUS, Context.Impl
bodyParserEngineManager, flashScope, injector, ninjaProperties, route, session, validation
CONTENT_TYPE, NINJA_PROPERTIES_X_FORWARDED_FOR, X_FORWARD_HEADER
Constructor and Description |
---|
NinjaServletContext(BodyParserEngineManager bodyParserEngineManager,
FlashScope flashScope,
NinjaProperties ninjaProperties,
ResultHandler resultHandler,
Session session,
Validation validation,
com.google.inject.Injector injector) |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(Cookie cookie) |
void |
cleanup() |
Result |
controllerReturned()
Used to indicate that the controller has finished executing
|
protected ResponseStreams |
finalizeHeaders(Result result,
Boolean handleFlashAndSessionCookie) |
Object |
getAttribute(String name) |
Map<String,Object> |
getAttributes() |
Cookie |
getCookie(String cookieName) |
List<Cookie> |
getCookies() |
org.apache.commons.fileupload.FileItemIterator |
getFileItemIterator() |
String |
getHeader(String name) |
Map<String,List<String>> |
getHeaders() |
List<String> |
getHeaders(String name) |
String |
getHostname() |
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Convenience method to access HttpServletRequest of this context.
|
javax.servlet.http.HttpServletResponse |
getHttpServletResponse()
Convenience method to access HttpServletResponse of this context.
|
InputStream |
getInputStream() |
String |
getMethod() |
String |
getParameter(String key) |
FileItem |
getParameterAsFileItem(String key) |
List<FileItem> |
getParameterAsFileItems(String key) |
Map<String,List<FileItem>> |
getParameterFileItems() |
Map<String,String[]> |
getParameters() |
List<String> |
getParameterValues(String name) |
BufferedReader |
getReader() |
String |
getRealRemoteAddr() |
String |
getRequestContentType() |
String |
getRequestUri()
Deprecated.
|
String |
getScheme() |
javax.servlet.ServletContext |
getServletContext()
Convenience method to access ServletContext of this context.
|
void |
handleAsync() |
boolean |
hasCookie(String cookieName) |
void |
init(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse) |
boolean |
isAsync() |
boolean |
isMultipart() |
void |
returnResultAsync(Result result) |
void |
setAttribute(String name,
Object value) |
asyncRequestComplete, finalizeHeaders, finalizeHeadersWithoutFlashAndSessionCookie, getAcceptCharset, getAcceptContentType, getAcceptEncoding, getAcceptLanguage, getAttribute, getContextPath, getCookieValue, getFlashCookie, getFlashScope, getParameter, getParameterAs, getParameterAs, getParameterAsInteger, getParameterAsInteger, getPathParameter, getPathParameterAsInteger, getPathParameterEncoded, getRemoteAddr, getRequestPath, getRoute, getSession, getSessionCookie, getValidation, init, isRequestJson, isRequestXml, parseBody, setRoute, unsetCookie
@Inject public NinjaServletContext(BodyParserEngineManager bodyParserEngineManager, FlashScope flashScope, NinjaProperties ninjaProperties, ResultHandler resultHandler, Session session, Validation validation, com.google.inject.Injector injector)
public void init(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
public String getMethod()
@Deprecated public String getRequestUri()
public String getHostname()
public String getScheme()
public String getRealRemoteAddr()
getRealRemoteAddr
in class AbstractContext
public boolean hasCookie(String cookieName)
public void addCookie(Cookie cookie)
public boolean isAsync()
public void returnResultAsync(Result result)
public void handleAsync()
public Result controllerReturned()
public InputStream getInputStream() throws IOException
IOException
public BufferedReader getReader() throws IOException
IOException
protected ResponseStreams finalizeHeaders(Result result, Boolean handleFlashAndSessionCookie)
finalizeHeaders
in class AbstractContext
public String getRequestContentType()
public boolean isMultipart()
public org.apache.commons.fileupload.FileItemIterator getFileItemIterator()
public javax.servlet.ServletContext getServletContext()
public javax.servlet.http.HttpServletRequest getHttpServletRequest()
public javax.servlet.http.HttpServletResponse getHttpServletResponse()
public void cleanup()
Copyright © 2016. All Rights Reserved.