com.adobe.flashaccess.sdk.protocol
Class MessageHandlerBase

java.lang.Object
  extended by com.adobe.flashaccess.sdk.protocol.AbstractHandler
      extended by com.adobe.flashaccess.sdk.protocol.AbstractMessageHandler
          extended by com.adobe.flashaccess.sdk.protocol.MessageHandlerBase
All Implemented Interfaces:
HandlerInterface
Direct Known Subclasses:
AuthenticationHandler

public abstract class MessageHandlerBase
extends AbstractMessageHandler

Base class for Flash Access request/response handlers which handle a single request/response. The handler reads the request data and parses the request. The caller can examine the information in the request and decide whether to return an error or a successful response (subclasses of RequestMessageBase provide a method for setting response data).

Handlers should be invoked as follows (imagine a concrete instance of MessageHandlerBase called ConcreteHandler):

                ConcreteHandler handler = new ConcreteHandler(handlerConfig, inputStream, outputStream);
try {
handler.parseRequest();
RequestMessageBase request = handler.getRequest();
// Use request's getters to examine request info and evaluate request
// If successful, construct appropriate responseData and use request's methods to set response
// If an error occurs, construct errorData and call request.setErrorData(errorData);
} catch (HandlerParsingException e) {
// Use e.getErrorData() for info on the error which will be sent to the user
// Do not attempt to call any handler methods except close()
} finally {
// Always call close in a finally statement to ensure a response is sent to the client
handler.close();
}


Method Summary
 void close()
          Sends the signed and encrypted response (success or error) to the client.
abstract  RequestMessageBase getRequest()
          Retrieves the request message sent by the client.
 
Methods inherited from class com.adobe.flashaccess.sdk.protocol.AbstractHandler
parseRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRequest

public abstract RequestMessageBase getRequest()
Retrieves the request message sent by the client.

Specified by:
getRequest in class AbstractMessageHandler
Returns:
The request message sent by the client.

close

public void close()
           throws java.io.IOException
Sends the signed and encrypted response (success or error) to the client. In some cases, error data will not be encrypted (for example, the request could not be decrypted). close() must be the last method called for this object; it is recommended this be part of a finally block to ensure a response is always sent to the client.

Specified by:
close in interface HandlerInterface
Overrides:
close in class AbstractMessageHandler
Throws:
java.lang.IllegalStateException - if neither the response or error data has been set, or if close() has already been called.
java.io.IOException


[an error occurred while processing this directive] [an error occurred while processing this directive]