public interface AgreementResponse
An Agreement Response is passed to the AgreementHandler#service
,
which may exhert a certain amount of control towards the page content.
If the handler can't validate its agreement, it should abort the request.
To abort a request, the handler must define what should happen to the
response; wether it should be redirected, forwaded, or authenticated.
This is done by invoking the setRedirect, setLocalRedirect, setForward
or setBasicAuthenticationRealm methods. These methods inform the
Agreement system that the request should not continue as normal.
In any case, the response may include cookies; and request and session attributes may be made available as well. These may be set both when the request is aborted, and when it is not aborted. To allow a request to go through, it is enough simply to not call any of the redirect, forward or authenticate methods.
Modifier and Type | Method and Description |
---|---|
void |
addCookie(String name,
String value)
Add a cookie to the response stream.
|
String |
getBasicAuthenticationRealm() |
String |
getCookie(String name)
Return a specific cookie.
|
Set |
getCookieNames()
Return the names of the cookies which agreements have requested to be set on the
response.
|
int |
getError()
Return the error code, or 0 for no error code
|
String |
getForward() |
String |
getHeader(String name)
Return a specific header.
|
Set |
getHeaderNames()
Return the names of the headers which agreements have requested to be set on the
response.
|
String |
getLocalRedirect() |
String |
getRedirect() |
Object |
getRequestAttribute(String name)
Return a specific request attribute which is to be placed in the request scope
|
Set |
getRequestAttributeNames()
return the names of the request attributes which an agreement has requested
to be set in the request scope.
|
Object |
getSessionAttribute(String name)
Return a specific Session attribute which is to be placed in the Session scope
|
Set |
getSessionAttributeNames()
return the names of the Session attributes which an agreement has requested
to be set in the Session scope.
|
int |
getStatus()
Return the error code, or 0 for no error code
|
void |
setBasicAuthenticationRealm(String realm)
Specify that the agreement requires HTTP authentication using the realm
realm . |
void |
setError(int code)
Send a specific error on the HTTP response.
|
void |
setForward(String URI)
Forward the request to a JSP or servlet, without using HTTP Redirects, but
rather, using
RequestDispatcher.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse) . |
void |
setHeader(String name,
String value)
Specify that a header should be set using the given name and value.
|
void |
setLocalRedirect(String URI)
Redirect the response to a local (context relative) URI.
|
void |
setRedirect(String URL)
Redirect the response using HTTP 302 to a specific URL, as defined in the
HTTP RFC.
|
void |
setRequestAttribute(String name,
Object object)
Specify that an attribute be added to the request scope.
|
void |
setSessionAttribute(String name,
Object object)
Specify that an attribute be added to the session scope.
|
void |
setStatus(int code)
Set a specific status on the HTTP response.
|
void setRedirect(String URL)
String getRedirect()
void setLocalRedirect(String URI)
URI
- The context relative path of the servlet, or JSP which will
handle the remainder of the request.String getLocalRedirect()
void setStatus(int code)
code
- The acutal status code (302, 304, and so on)int getStatus()
void setError(int code)
code
- The acutal error code (404, 403, and so on)int getError()
void setForward(String URI)
RequestDispatcher.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
.URI
- String getForward()
void setBasicAuthenticationRealm(String realm)
realm
.realm
- The name of the realm in which to perform the loginString getBasicAuthenticationRealm()
void addCookie(String name, String value)
name
- The name of the cookievalue
- The value of the cookieSet getCookieNames()
String getCookie(String name)
name
- the name of the cookie to be retrievedvoid setHeader(String name, String value)
name
- The name of the headervalue
- The value of the headerSet getHeaderNames()
String getHeader(String name)
name
- the name of the header to be retrievedvoid setRequestAttribute(String name, Object object)
name
- The name of the request attributeobject
- The actual request attribute value.Set getRequestAttributeNames()
Object getRequestAttribute(String name)
name
- The name of the request attribute.void setSessionAttribute(String name, Object object)
name
- The name of the session attributeobject
- The actual session attribute value.Set getSessionAttributeNames()
© 1998- 2021 Escenic AS