CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.coherence.servlet
Class RequestContext

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.coherence.servlet.RequestContext
Direct Known Subclasses:
HttpRequestContext

public class RequestContext
extends Base

Request context information for a standard Servlet request.

Version:
Coherence 2.3
Author:
cp 2003.09.13

Field Summary
protected static String KEY_REQUEST
          The key used to store the original Servlet request in the map returned by saveRequestState.
protected static String KEY_RESPONSE
          The key used to store the original Servlet response in the map returned by saveRequestState.
protected static String REQ_ATTR_CONTEXT
           
protected static String REQ_ATTR_DISPATCH
           
protected static String REQ_ATTR_OK_WRAP
           
protected static String REQ_ATTR_REQUEST
           
protected static String REQ_ATTR_WRAPPED
           
 
Constructor Summary
RequestContext(SessionHelper helper, RequestContext ctxOuter, ServletRequest req)
          Construct a RequestContext object to hold the state of the request and response and the wrappers for each.
 
Method Summary
 int decReferenceCount()
          Decrement the reference count.
protected  String getDescription()
          Returns a string representation of this object's attributes.
 RequestContext getOuterRequestContext()
          Determine the RequestContext object that this RequestContext exists "within", if this request context was created by a nested request, such as by including or forwarding.
 int getReferenceCount()
          Get the current reference count.
 ServletRequest getServletRequest()
          Get the wrapped ServletRequest.
 ServletRequest getServletRequestWrapper()
          Get the ServletRequest wrapper.
 ServletResponse getServletResponse()
          Get the wrapped ServletResponse.
 ServletResponse getServletResponseWrapper()
          Get the ServletResponse wrapper.
 SessionHelper getSessionHelper()
          Get the SessionHelper.
 int incReferenceCount()
          Increment the reference count.
 boolean isNested()
          Determines if this RequestContext exists "within" an outer RequestContext.
 void restoreRequestState(Map mapState, boolean fExternal)
          Restores the underlying Servlet request back to the state it was in prior to calling saveRequestState.
 Map saveRequestState(boolean fExternal)
          Returns a map containing the state of the underlying Servlet request.
 void setServletRequestWrapper(ServletRequest req)
          Set the ServletRequest wrapper once it is known.
 void setServletResponse(ServletResponse res)
          Set the wrapped ServletResponse.
 void setServletResponseWrapper(ServletResponse res)
          Set the ServletResponse wrapper once it is known.
 String toString()
          Returns a string representation of the object.
 

Field Detail

KEY_REQUEST

protected static final String KEY_REQUEST
The key used to store the original Servlet request in the map returned by saveRequestState.

See Also:
Constant Field Values

KEY_RESPONSE

protected static final String KEY_RESPONSE
The key used to store the original Servlet response in the map returned by saveRequestState.

See Also:
Constant Field Values

REQ_ATTR_OK_WRAP

protected static final String REQ_ATTR_OK_WRAP
See Also:
Constant Field Values

REQ_ATTR_CONTEXT

protected static final String REQ_ATTR_CONTEXT
See Also:
Constant Field Values

REQ_ATTR_DISPATCH

protected static final String REQ_ATTR_DISPATCH
See Also:
Constant Field Values

REQ_ATTR_REQUEST

protected static final String REQ_ATTR_REQUEST
See Also:
Constant Field Values

REQ_ATTR_WRAPPED

protected static final String REQ_ATTR_WRAPPED
See Also:
Constant Field Values
Constructor Detail

RequestContext

public RequestContext(SessionHelper helper,
                      RequestContext ctxOuter,
                      ServletRequest req)
Construct a RequestContext object to hold the state of the request and response and the wrappers for each.

Parameters:
helper - the SessionHelper for this application
ctxOuter - the outer RequestContext object, or null if none
req - the application server's ServletRequest object
Method Detail

getSessionHelper

public SessionHelper getSessionHelper()
Get the SessionHelper.

Returns:
the SessionHelper for this app

getOuterRequestContext

public RequestContext getOuterRequestContext()
Determine the RequestContext object that this RequestContext exists "within", if this request context was created by a nested request, such as by including or forwarding.

Returns:
the RequestContext object that this RequestContext exists "within"

isNested

public boolean isNested()
Determines if this RequestContext exists "within" an outer RequestContext. This would be the case if this request context was created by a nested request, such as by including or forwarding.

Returns:
true if this RequestContext exists "within" an outer RequestContext

getServletRequest

public ServletRequest getServletRequest()
Get the wrapped ServletRequest.

Returns:
the wrapped ServletRequest

getServletResponse

public ServletResponse getServletResponse()
Get the wrapped ServletResponse.

Returns:
the wrapped ServletResponse

setServletResponse

public void setServletResponse(ServletResponse res)
Set the wrapped ServletResponse.

Parameters:
res - the wrapped ServletResponse

getServletRequestWrapper

public ServletRequest getServletRequestWrapper()
Get the ServletRequest wrapper.

Returns:
the ServletRequest wrapper, or null if it has not yet been created

setServletRequestWrapper

public void setServletRequestWrapper(ServletRequest req)
Set the ServletRequest wrapper once it is known.

Parameters:
req - the ServletRequest wrapper

getServletResponseWrapper

public ServletResponse getServletResponseWrapper()
Get the ServletResponse wrapper.

Returns:
the ServletResponse wrapper, or null if it has not yet been created

setServletResponseWrapper

public void setServletResponseWrapper(ServletResponse res)
Set the ServletResponse wrapper once it is known.

Parameters:
res - the ServletResponse wrapper

getReferenceCount

public int getReferenceCount()
Get the current reference count.

Returns:
the current reference count

incReferenceCount

public int incReferenceCount()
Increment the reference count.

Returns:
the new reference count

decReferenceCount

public int decReferenceCount()
Decrement the reference count.

Returns:
the new reference count

saveRequestState

public Map saveRequestState(boolean fExternal)
Returns a map containing the state of the underlying Servlet request. This method should be called prior to creating a nested request, such as when including or forwarding. The request can be restored to the state it was in at the time this method was called by calling restoreRequestState with the map returned from this method.

A true value of the fExternal parameter indicates that the nested request will target an external web application, that is, a web application with a different ServletContext.

Parameters:
fExternal - true if the nested request will target an external web application
Returns:
a map containing the state of the underlying Servlet request

restoreRequestState

public void restoreRequestState(Map mapState,
                                boolean fExternal)
Restores the underlying Servlet request back to the state it was in prior to calling saveRequestState.

Parameters:
mapState - the Map returned from a call to saveRequestState
fExternal - true if the nested request had targeted an external web application

toString

public String toString()
Returns a string representation of the object.

Returns:
a string representation of the object

getDescription

protected String getDescription()
Returns a string representation of this object's attributes.

Returns:
a string representation of this object's attributes

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation