public class RequestContext
extends java.lang.Object
RequestContext
aggregates state about the current request.Modifier and Type | Field and Description |
---|---|
ISCHttpServletRequest | request ISCHttpServletRequest instance for the current request. |
javax.servlet.http.HttpServletResponse | response HttpServletResponse instance associated with this request |
Modifier and Type | Method and Description |
---|---|
static RequestContext | instance(javax.servlet.jsp.PageContext pageContext) Creates a RequestContext from a JSP PageContext . |
static RequestContext | instance(javax.servlet.ServletContext servletContext, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) Creates a RequestContext from a ServletContext, ServletRequest and ServletResponse. |
static RequestContext | instance(javax.servlet.Servlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Creates a RequestContext from a Servlet , HttpServletRequest and HttpServletResponse . |
static RequestContext | instance(javax.servlet.Servlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.Writer out) Creates a RequestContext from a Servlet , HttpServletRequest , HttpServletResponse and Writer . |
static RequestContext | instance(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) Creates a RequestContext from a ServletRequest and ServletResponse . |
static void | setCacheControlHeader(javax.servlet.http.HttpServletResponse response, java.lang.String value) Sets the Cache-Control HTTP response header directly |
void | setCacheControlHeader(java.lang.String value) Sets the Cache-Control HTTP response header directly |
void | setCachePolicy(CachePolicy[] directives) Sets the Cache-Control HTTP response header |
static void | setCachePolicy(javax.servlet.http.HttpServletResponse response, CachePolicy[] directives) Sets the Cache-Control HTTP response header |
public ISCHttpServletRequest request
ISCHttpServletRequest
instance for the current request.public javax.servlet.http.HttpServletResponse response
HttpServletResponse
instance associated with this requestpublic static RequestContext instance(javax.servlet.jsp.PageContext pageContext) throws java.lang.Exception
RequestContext
from a JSP PageContext
.pageContext
- the page context to use for creating the RequestContextjava.lang.Exception
RequestContext.instance(ServletContext, ServletRequest, ServletResponse)
public static RequestContext instance(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.lang.Exception
RequestContext
from a ServletRequest
and ServletResponse
.request
- the ServletRequestresponse
- the ServletResponsejava.lang.Exception
RequestContext.instance(ServletContext, ServletRequest, ServletResponse)
public static RequestContext instance(javax.servlet.Servlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
RequestContext
from a Servlet
, HttpServletRequest
and HttpServletResponse
.servlet
- the servletrequest
- the HttpServletRequestresponse
- the HttpServletResponsejava.lang.Exception
RequestContext.instance(ServletContext, ServletRequest, ServletResponse)
public static RequestContext instance(javax.servlet.Servlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.Writer out) throws java.lang.Exception
RequestContext
from a Servlet
, HttpServletRequest
, HttpServletResponse
and Writer
.servlet
- the Servletrequest
- the HttpServletRequestresponse
- the HttpServletResponseout
- the output writerjava.lang.Exception
RequestContext.instance(ServletContext, ServletRequest, ServletResponse)
public static RequestContext instance(javax.servlet.ServletContext servletContext, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.lang.Exception
RequestContext
from a ServletContext, ServletRequest and ServletResponse. Important Note
Before we explain the benefits of creating your own RequestContext please take note that only one instance of this must be created and passed along during a requests life-cycle. In normal circumstances one will be created through the IDACall
servlet and there will be no need for you to handle this explicitly.
A typical use case for explicitly creating a RequestContext is is you've implemented your own standalone servlet which does not extend IDACall
and you require the servlet request/response to be available further down the request chain such as in a DMI call you might issue from your servlet. This could be useful when passing session related data down to your DMI implementations for instance. Once you've created a RequestContext you simply set it on your DSRequest
or RPCRequest
using setContext(requestContext)
.
servletContext
- the servlet context.request
- the servlet request.response
- the servlet response.java.lang.Exception
BaseRequest.setContext(RequestContext)
public void setCachePolicy(CachePolicy[] directives) throws java.lang.Exception
directives
- an array of CachePolicy
response directivesjava.lang.Exception
public static void setCachePolicy(javax.servlet.http.HttpServletResponse response, CachePolicy[] directives)
response
- HttpServletResponse
to set header todirectives
- an array of CachePolicy
response directivespublic void setCacheControlHeader(java.lang.String value) throws java.lang.Exception
value
- String
of response directivesjava.lang.Exception
public static void setCacheControlHeader(javax.servlet.http.HttpServletResponse response, java.lang.String value)
response
- HttpServletResponse
to set header tovalue
- String
of response directives