|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ResponseFormatter
This interface is designed to be used by developers who wish to customise the type of
response being returned by a request for a token. An instance of this class can then be
created by the KeyMaster servlet, StandardKeyMaster
using reflection. Therefore it is possible to have many different types of ResponseFormatter
that can all be used dymanically.
In order for StandardKeyMaster
to successfully load a custom
ResponseFormatter the class implementing this interface should define ONLY a default constructor.
The developer must also add an additional entry in the servlets configuration file
(web.xml). This process is explained further in the JavaDoc overview and administration guide.
Method Summary | |
---|---|
String |
formatErrorResponse(javax.servlet.http.HttpServletRequest request,
String errorMessage)
This method can be called from the servlet if there was an error while trying to process the request or generate a token. |
String |
formatResponse(javax.servlet.http.HttpServletRequest request,
String token)
Deprecated. Use AdvancedResponseFormatter.formatResponse(HttpServletRequest, String, UserCredentialsProvider) instead. |
Method Detail |
---|
String formatResponse(javax.servlet.http.HttpServletRequest request, String token)
AdvancedResponseFormatter.formatResponse(HttpServletRequest, String, UserCredentialsProvider)
instead.
This is the main method for the interface. It is used to encode the token and return the processed response in the appropriate format. This method should try to return a token but if an error occurs then the formatErrorResponse method should be called to correctly encode the error before returning to the calling servlet.
request
- This parameter should be used to retrieve any required information from the
query string that was used to call the servlet. Any missing query strings
should result in an error being returned (using the formatErrorResponse method).token
- The token that has been created for the request. Each token will be unique. The
token should only be returned if there were no errors during processing the response.
String formatErrorResponse(javax.servlet.http.HttpServletRequest request, String errorMessage)
This method can be called from the servlet if there was an error while trying to process the request or generate a token. This method can also be called from the formatResponse method if there is an error when trying to format an appropriate response.
request
- This parameter should be used to retrieve any required information that may
be needed to format an error response. This parameter is always passed in
from the calling servlet.errorMessage
- This parameter is an explanation of what has gone wrong. It should still
be formatted into an appropriate response.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |