com.adobe.flashaccess.sdk.protocol
Class BatchHandlerBase

java.lang.Object
  extended by com.adobe.flashaccess.sdk.protocol.AbstractHandler
      extended by com.adobe.flashaccess.sdk.protocol.AbstractBatchHandler
          extended by com.adobe.flashaccess.sdk.protocol.BatchHandlerBase
All Implemented Interfaces:
HandlerInterface
Direct Known Subclasses:
LicenseHandler

public abstract class BatchHandlerBase
extends AbstractBatchHandler

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

Handlers should be invoked as follows (this example employs a concrete instance of BatchHandlerBase called ConcreteBatchHandler):

                ConcreteBatchHandler handler = new ConcreteBatchHandler(handlerConfig, inputStream, outputStream);
try {
handler.parseRequest();
List<? extends RequestMessageBase> requests = handler.getRequests();
for (RequestMessageBase req : requests) {
// 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);
}
} 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  java.util.List getRequests()
          Retrieves the requests.
 
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

getRequests

public abstract java.util.List getRequests()
Retrieves the requests.

Specified by:
getRequests in class AbstractBatchHandler
Returns:
List<? extends RequestMessageBase> containing the requests.

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 AbstractBatchHandler
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]