Class ServletRequestContext
- java.lang.Object
-
- org.symphonyoss.s2.canon.runtime.http.AbstractRequestContext
-
- org.symphonyoss.s2.canon.runtime.http.ServletRequestContext
-
- All Implemented Interfaces:
IAsyncRequestContext,IRequestContext
public class ServletRequestContext extends AbstractRequestContext implements IAsyncRequestContext
-
-
Field Summary
-
Fields inherited from interface org.symphonyoss.s2.canon.runtime.http.IRequestContext
FORM_CONTENT_TYPE, JSON_CONTENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description ServletRequestContext(HttpMethod method, org.symphonyoss.s2.fugue.core.trace.ITraceContext trace, IModelRegistry modelRegistry, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetCookie(String name)protected StringgetHeader(String name)javax.servlet.ServletInputStreamgetInputStream()javax.servlet.ServletOutputStreamgetOutputStream()Get an OutputStream or the response.protected StringgetParameter(String name)StringgetPathInfo()BufferedReadergetReader()PrintWritergetWriter()Get a Writer or the response.voidsendError(int sc, String msg)voidsetContentType(String type)voidsetHeader(String header, String value)voidsetStatus(int sc)javax.servlet.AsyncContextstartAsync()-
Methods inherited from class org.symphonyoss.s2.canon.runtime.http.AbstractRequestContext
asBoolean, asImmutableByteArray, asInteger, asLong, asString, error, error, error, getMethod, getParameterAsBoolean, getParameterAsImmutableByteArray, getParameterAsInteger, getParameterAsLong, getParameterAsString, getTrace, parseListPayload, parseListPayload, parsePayload, parsePayload, parsePayload, preConditionsAreMet, sendErrorResponse, sendOKResponse, sendOKResponse, sendOKResponse
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.symphonyoss.s2.canon.runtime.http.IRequestContext
asBoolean, asImmutableByteArray, asInteger, asLong, asString, error, error, error, getMethod, getParameterAsBoolean, getParameterAsImmutableByteArray, getParameterAsInteger, getParameterAsLong, getParameterAsString, getTrace, parseListPayload, parseListPayload, parsePayload, parsePayload, parsePayload, preConditionsAreMet, sendErrorResponse, sendOKResponse, sendOKResponse, sendOKResponse
-
-
-
-
Constructor Detail
-
ServletRequestContext
public ServletRequestContext(HttpMethod method, org.symphonyoss.s2.fugue.core.trace.ITraceContext trace, IModelRegistry modelRegistry, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
-
Method Detail
-
getCookie
protected String getCookie(String name)
- Specified by:
getCookiein classAbstractRequestContext
-
getHeader
protected String getHeader(String name)
- Specified by:
getHeaderin classAbstractRequestContext
-
getPathInfo
public String getPathInfo()
- Specified by:
getPathInfoin interfaceIRequestContext
-
getParameter
protected String getParameter(String name)
- Specified by:
getParameterin classAbstractRequestContext
-
getReader
public BufferedReader getReader() throws IOException
- Specified by:
getReaderin interfaceIRequestContext- Throws:
IOException
-
getWriter
public PrintWriter getWriter() throws IOException
Description copied from interface:IRequestContextGet a Writer or the response. Either a Writer or an OutputStream can be obtained, but not both.- Specified by:
getWriterin interfaceIRequestContext- Returns:
- A Writer or the response.
- Throws:
IOException- If getOutputStream() has previously been called.
-
setContentType
public void setContentType(String type)
- Specified by:
setContentTypein interfaceIRequestContext
-
setStatus
public void setStatus(int sc)
- Specified by:
setStatusin interfaceIRequestContext
-
setHeader
public void setHeader(String header, String value)
- Specified by:
setHeaderin interfaceIRequestContext
-
sendError
public void sendError(int sc, String msg) throws IOException- Specified by:
sendErrorin interfaceIRequestContext- Throws:
IOException
-
getInputStream
public javax.servlet.ServletInputStream getInputStream() throws IOException- Specified by:
getInputStreamin interfaceIAsyncRequestContext- Throws:
IOException
-
getOutputStream
public javax.servlet.ServletOutputStream getOutputStream() throws IOExceptionDescription copied from interface:IRequestContextGet an OutputStream or the response. Either a Writer or an OutputStream can be obtained, but not both.- Specified by:
getOutputStreamin interfaceIAsyncRequestContext- Specified by:
getOutputStreamin interfaceIRequestContext- Returns:
- A Writer or the response.
- Throws:
IOException- If getWriter() has previously been called.
-
startAsync
public javax.servlet.AsyncContext startAsync()
- Specified by:
startAsyncin interfaceIAsyncRequestContext
-
-