Class MessageHandlerBase

  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:
Direct Known Subclasses:

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 {
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

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
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


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

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


public void close()
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
close in class AbstractMessageHandler
java.lang.IllegalStateException - if neither the response or error data has been set, or if close() has already been called.

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