com.iplanet.jato
Interface RequestContext

All Known Implementing Classes:
RequestContextImpl

public interface RequestContext

Encapsulates several critical request-related resources that are accessed frequently throughout the JATO infrastructure and JATO applications. Most importantly, the RequestContext encapsulates the current request's HttpServletRequest and HttpServletResponse objects. Without a container like RequestContext, the JATO framework and JATO developers would have to independently pass the encapsulated resources into every method that might need them. By aggregating the resources into one logical container, we have simplified access to these objects, and guaranteed that all objects in the request have easy and predictable access to these vital resources.

JATO creates a new instance of RequestContext for each request. Requests that attempt to bypass the JATO request handling infrastructure (contained in ApplicationServletBase) and directly invoke a JATO application's JSP pages directly will fail due to the lack of properly initialized RequestContext. This represents a desirable security model.

It is entirely possible for developers to provide an implementation of the RequestContext interface to make other application- or enterprise- critical resources available wherever the request context is available. Examples of such a use might be to provide security context or user profile objects.

Version:
JATO/1.2.2 $Id: RequestContext.java,v 1.25 2002/03/16 03:26:28 todd Exp $
See Also:
RequestContextImpl

Field Summary
static int DISPLAY_PHASE
          Indicates the display portion of a request, after the request has been forwarded to a resource for output to the client
static int SUBMIT_PHASE
          Indicates the request handling portion of a request, before the request has been forwarded to a resource for output to the client
 
Method Summary
 void addRequestCompletionListener(RequestCompletionListener listener)
          Adds a request completion listener to the current request.
 java.lang.StringBuffer getMessageBuffer()
          Returns the buffer of accumulated messages.
 java.io.PrintWriter getMessageWriter()
          Returns a PrintWriter that can be used to output application information to the bottom of the rendered HTML resonse.
 ModelManager getModelManager()
          Returns the request's ModelManager
 javax.servlet.http.HttpServletRequest getRequest()
          Returns the request object for the current request
 int getRequestPhase()
          Returns a code for the current phase the request is in.
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the response object for the current request
 javax.servlet.ServletContext getServletContext()
          Returns the request handling servlet's ServletContext
 java.lang.String getServletName()
          Returns the request handling servlet's logical name
 SQLConnectionManager getSQLConnectionManager()
          Returns the request's SQLConnectionManager
 ViewBeanManager getViewBeanManager()
          Returns the request's ViewBeanManager
 boolean hasMessages()
          Returns true if any messages have been written to the message buffer
 void removeRequestCompletionListener(RequestCompletionListener listener)
          Removes a request completion listener from the request context.
 

Field Detail

SUBMIT_PHASE

public static final int SUBMIT_PHASE
Indicates the request handling portion of a request, before the request has been forwarded to a resource for output to the client

DISPLAY_PHASE

public static final int DISPLAY_PHASE
Indicates the display portion of a request, after the request has been forwarded to a resource for output to the client
Method Detail

getServletName

public java.lang.String getServletName()
Returns the request handling servlet's logical name

getServletContext

public javax.servlet.ServletContext getServletContext()
Returns the request handling servlet's ServletContext

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Returns the request object for the current request

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Returns the response object for the current request

getViewBeanManager

public ViewBeanManager getViewBeanManager()
Returns the request's ViewBeanManager

getModelManager

public ModelManager getModelManager()
Returns the request's ModelManager

getMessageWriter

public java.io.PrintWriter getMessageWriter()
Returns a PrintWriter that can be used to output application information to the bottom of the rendered HTML resonse. Anything printed through this object will be buffered and then appended in a block following the flushing of the response. This mechanism is intended as a development time aid, a means of attaching application information to the relevant page.

hasMessages

public boolean hasMessages()
Returns true if any messages have been written to the message buffer

getMessageBuffer

public java.lang.StringBuffer getMessageBuffer()
Returns the buffer of accumulated messages. Applications should write messages to this buffer using the getMessageWriter() method.

getSQLConnectionManager

public SQLConnectionManager getSQLConnectionManager()
Returns the request's SQLConnectionManager

addRequestCompletionListener

public void addRequestCompletionListener(RequestCompletionListener listener)
Adds a request completion listener to the current request. All registered listeners will be notified when the request is complete, in no particular order. Listener registrations are per request; they do not persist between requests.
Parameters:
listener - The object wishing to be notified of the end of the request

removeRequestCompletionListener

public void removeRequestCompletionListener(RequestCompletionListener listener)
Removes a request completion listener from the request context. The removed listener will not be notified of the end of the request. Listener registrations are per request; they do not persist between requests.
Parameters:
listener - The object wishing to be removed from the notification list

getRequestPhase

public int getRequestPhase()
Returns a code for the current phase the request is in.