agonism.dovetail.site
Interface IRequestContext

All Known Implementing Classes:
DummyRequestContext, HttpRequestContext

public interface IRequestContext


Method Summary
 java.lang.String encodeURL(java.lang.String url)
          Encode a URL with the SessionID.
 void forward(Page page)
          Forward a request to a new Page.
 void freeConnection()
          Free the database connection obtained from the getConnection() method.
 java.sql.Connection getConnection()
          Get the database connection.
 java.lang.String getCookieValue(java.lang.String name)
          Get the value of a browser cookie.
 java.util.Collection getErrors()
          Get a Collection of all the errors that have occured in this request.
 agonism.dovetail.db.IParameterSource getParameterSource()
          Get an object that implements IParameterSource
 java.lang.String getParameterValue(java.lang.String name)
          Get the value of a request parameter.
 java.lang.String getReferer()
          Get the URL that the request was sent from
 java.lang.Object getRequestValue(java.lang.String key)
          Get a value that has been stored in the Request.
 java.lang.Object getSessionValue(java.lang.String key)
          Get a value that has been stored in the Session.
 Site getSite()
          Get the root Site object.
 java.io.PrintWriter getWriter()
          Get the PrintWriter which is writing the response.
 boolean hasBeenRedirected()
           
 void include(Page page)
          Inculde another page in the response for this page.
 void init(Site site)
          Initialize the IRequestContext with a Site.
 void reportError(RequestError error)
          Report a request processing error.
 void sendRedirect(Link link)
          Redirect the request to a new Link.
 void sendRedirect(Page page)
          Redirect the request to a new Page.
 void sendRedirect(java.lang.String url)
          Redirect the request to a new URL.
 void setRequestValue(java.lang.String key, java.lang.Object value)
          Put a value into the Request state.
 void setSessionValue(java.lang.String key, java.lang.Object value)
          Put a value into the Session state.
 

Method Detail

init

public void init(Site site)
Initialize the IRequestContext with a Site.

getConnection

public java.sql.Connection getConnection()
Get the database connection. The connection is reference-counted by the IRequestContext, so that all callers will get the same Connection and it is freed once they have all released it using the freeConnection() method.

Whenever you call this method, you must always pair it with a call to freeConnection(), otherwise the Connection will not be promptly returned to the connection pool. If you fail to free connections, the ConnectionHelper.finalize() method will write diagnostic information to the WARN log.


freeConnection

public void freeConnection()
Free the database connection obtained from the getConnection() method.

Whenever you call getConnection(), you must always pair it with a call to freeConnection(), otherwise the Connection will not be promptly returned to the connection pool. If you fail to free connections, the ConnectionHelper.finalize() method will write diagnostic information to the WARN log.


encodeURL

public java.lang.String encodeURL(java.lang.String url)
Encode a URL with the SessionID.

sendRedirect

public void sendRedirect(Page page)
Redirect the request to a new Page.

sendRedirect

public void sendRedirect(Link link)
Redirect the request to a new Link.

hasBeenRedirected

public boolean hasBeenRedirected()
Returns:
true if a sendRedirect method has been invoked on this request.

forward

public void forward(Page page)
Forward a request to a new Page.

include

public void include(Page page)
Inculde another page in the response for this page.

sendRedirect

public void sendRedirect(java.lang.String url)
Redirect the request to a new URL.

getWriter

public java.io.PrintWriter getWriter()
Get the PrintWriter which is writing the response.

getSite

public Site getSite()
Get the root Site object.

getParameterSource

public agonism.dovetail.db.IParameterSource getParameterSource()
Get an object that implements IParameterSource

getParameterValue

public java.lang.String getParameterValue(java.lang.String name)
Get the value of a request parameter.

getCookieValue

public java.lang.String getCookieValue(java.lang.String name)
Get the value of a browser cookie.

getSessionValue

public java.lang.Object getSessionValue(java.lang.String key)
Get a value that has been stored in the Session.

setSessionValue

public void setSessionValue(java.lang.String key,
                            java.lang.Object value)
Put a value into the Session state. Session state is persisted between requests, and is unique to a user.

getRequestValue

public java.lang.Object getRequestValue(java.lang.String key)
Get a value that has been stored in the Request.

setRequestValue

public void setRequestValue(java.lang.String key,
                            java.lang.Object value)
Put a value into the Request state. Request state is stored only within the context of a single request.

reportError

public void reportError(RequestError error)
Report a request processing error.

getErrors

public java.util.Collection getErrors()
Get a Collection of all the errors that have occured in this request.
Returns:
an unmodifiable Collection of RequestError objects.

getReferer

public java.lang.String getReferer()
Get the URL that the request was sent from