com.cafesoft.cams.agent.http
Interface CamsHttpAgentResponse

All Known Implementing Classes:
AbstractCamsHttpAgentResponse

public interface CamsHttpAgentResponse

Defines an interface that normalizes a container-specific HTTP response into an HTTP container-independent form that can be used by a Cafesoft AccessControlAgent.

Since:
1/22/02

Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Adds the specified cookie to the response.
 void destroy()
          Destroy the CamsHttpAgentResponse.
 String getMessage()
          Get a context sensitive response message.
 RemoteSession getSession()
          Returns the Cams session.
 CamsHttpAgentStatusCode getStatus()
          Gets the current status code for this response.
 void recycle()
          Recycle the CamsHttpAgentResponse for reuse.
 void redirectToLoginPage(String camsLoginUrl, Map queryParameters)
          Redirects the user to the Cams login page.
 void sendRedirect(String location)
          Sends a temporary redirect response to the client using the specified redirect location URL.
 void setAccessDenied(String message)
          Set an access denied response status and a context-sensitive message.
 void setContentType(String contentType)
          Sets the content type of this response.
 void setError(String message)
          Set an error response status and a context-sensitive error message.
 void setSession(RemoteSession session)
          Sets the Cams session.
 void setStatus(CamsHttpAgentStatusCode status)
          Sets the status code for this response.
 

Method Detail

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.

Parameters:
cookie - the Cookie to return to the client

sendRedirect

public void sendRedirect(String location)
Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the HTTP container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as * relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the HTTP container root. If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.

Parameters:
location - the redirect location URL

setStatus

public void setStatus(CamsHttpAgentStatusCode status)
Sets the status code for this response.

Parameters:
status - the new status code

getStatus

public CamsHttpAgentStatusCode getStatus()
Gets the current status code for this response. This method is used to set the return status code when there is no error (for example, for the status codes SC_SUCCESS or SC_FAILED). If there is an error, the sendError method should be used instead.

Returns:
the current status code

setError

public void setError(String message)
Set an error response status and a context-sensitive error message.

Parameters:
message - the error message.

setAccessDenied

public void setAccessDenied(String message)
Set an access denied response status and a context-sensitive message.

Parameters:
message - the access denied message.

getMessage

public String getMessage()
Get a context sensitive response message.

Returns:
the context-sensitive error or access denied message or null if no message.

setSession

public void setSession(RemoteSession session)
Sets the Cams session.

Parameters:
session - Contains information about a user that has logged into Cams

getSession

public RemoteSession getSession()
Returns the Cams session.

Returns:
the session associated with the authenticated user

setContentType

public void setContentType(String contentType)
Sets the content type of this response.

Parameters:
contentType - the content type of this response

redirectToLoginPage

public void redirectToLoginPage(String camsLoginUrl,
                                Map queryParameters)
Redirects the user to the Cams login page.

Parameters:
camsLoginUrl - the Url of the Cams login page
queryParameters - a Map of query parameters to be appended to the camsLoginUrl.

recycle

public void recycle()
Recycle the CamsHttpAgentResponse for reuse.

This method will return the CamsHttpAgentResponse object back to it's original creation state. That means any underlying collections should be cleared and not destroyed.


destroy

public void destroy()
Destroy the CamsHttpAgentResponse.

This method will destroy the CamsHttpAgentResponse object. This method should be used when the CamsHttpAgentResponse will no longer be used. This method should destroy everything including underlying collections.



Generated on 5:16:42 PM May 12, 2008, © 1996-2005 Cafésoft LLC. All rights reserved.