com.novell.sentinel.client.http.java
Class HttpRequestorAsyncJava<T>

java.lang.Object
  extended by com.novell.sentinel.client.http.java.JavaRequestorBase<T>
      extended by com.novell.sentinel.client.http.java.HttpRequestorAsyncJava<T>
Type Parameters:
T - The type of data interface (e.g., JSONParser or Parser) that will be reported as the result of the HTTP request.
All Implemented Interfaces:
HttpRequestMethod, HttpRequestor<T>
Direct Known Subclasses:
JSONHttpRequestorJava

public abstract class HttpRequestorAsyncJava<T>
extends JavaRequestorBase<T>
implements HttpRequestor<T>

A base implementation class for asynchronous HttpRequestor instances used in Java (as opposed to GWT). This class implements a static thread pool (default maximum threads == 1) that is shared by all instances of this class (see setMaxThreads(int).

Derived classes are specializations that handle different transport data types (i.e., JSON or XML).


Nested Class Summary
 
Nested classes/interfaces inherited from class com.novell.sentinel.client.http.java.JavaRequestorBase
JavaRequestorBase.DefaultHostnameVerifier, JavaRequestorBase.NcacFault, JavaRequestorBase.TestTrustManager
 
Nested classes/interfaces inherited from interface com.novell.sentinel.client.http.HttpRequestMethod
HttpRequestMethod.HttpMethod
 
Field Summary
protected static com.novell.sentinel.client.http.java.HttpRequestorAsyncJava.HttpRequest<?> QUEUE_END
           
 
Fields inherited from class com.novell.sentinel.client.http.java.JavaRequestorBase
CHAR_ENCODING
 
Constructor Summary
protected HttpRequestorAsyncJava()
          Constructor for derived classes.
 
Method Summary
 void octetRequest(HttpRequestMethod.HttpMethod method, String url, byte[] data, HttpResultHandler<byte[]> resultHandler)
          Issue an HTTP request that requires and optionally returns octet-stream data (e.g., POST, PUT).
 void octetRequest(HttpRequestMethod.HttpMethod method, String url, HttpResultHandler<byte[]> resultHandler)
          Issue an HTTP request the returns octet-stream data (e.g., GET).
 void request(HttpRequestMethod.HttpMethod method, String url, HttpResultHandler<T> resultHandler)
          Issue an HTTP request that does not require request content (e.g., GET, DELETE).
 void request(HttpRequestMethod.HttpMethod method, String url, T parser, HttpResultHandler<T> resultHandler)
          Issue an HTTP request that requires request content (e.g., PUT, POST).
static void setMaxThreads(int threadCount)
          Set the maximum number of threads in the thread pool that is shared by all instances of this class.
 void shutdown()
          Clean up any resources associated with this instance.
 void shutdown(boolean wait)
          Clean up any resources associated with this instance.
 
Methods inherited from class com.novell.sentinel.client.http.java.JavaRequestorBase
authenticate, deleteToken, getHostnameVerifier, getLocaleName, getMediaType, getNcacFault, getParser, getSAMLToken, getSecureRandom, getSocketFactory, getSSLSocketFactory, getToken, getTrustManager, issueOctetRequest, issueRequest, sendData, setHostnameVerifier, setLanguageHeaders, setLocaleName, setMediaTypeHeaders, setSAMLToken, setSSLSocketFactory, setTrustManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.novell.sentinel.client.http.HttpRequestor
getLocaleName, setLocaleName
 

Field Detail

QUEUE_END

protected static final com.novell.sentinel.client.http.java.HttpRequestorAsyncJava.HttpRequest<?> QUEUE_END
Constructor Detail

HttpRequestorAsyncJava

protected HttpRequestorAsyncJava()
Constructor for derived classes.

Method Detail

setMaxThreads

public static void setMaxThreads(int threadCount)
Set the maximum number of threads in the thread pool that is shared by all instances of this class. This method must be called before the first instance is created.

Parameters:
threadCount - The maximum number of threads to allow in the thread pool (default is 1). This value must be greater than or equal to 1.

shutdown

public void shutdown()
Clean up any resources associated with this instance. If this instance is the last instance of this class, the thread pool will be emptied.

This method does not wait for the thread pool to finish shutting down.


shutdown

public void shutdown(boolean wait)
Clean up any resources associated with this instance. If this instance is the last instance of this class, the thread pool will be emptied.

This method will optionally wait for the thread pool to finish shutting down.

Parameters:
wait - If true, wait for all of the thread pool threads to exit.

request

public void request(HttpRequestMethod.HttpMethod method,
                    String url,
                    HttpResultHandler<T> resultHandler)
Description copied from interface: HttpRequestor
Issue an HTTP request that does not require request content (e.g., GET, DELETE).

Specified by:
request in interface HttpRequestor<T>
Parameters:
method - The HTTP method.
url - The target of the request.
resultHandler - The handler to be notified of the request result.

request

public void request(HttpRequestMethod.HttpMethod method,
                    String url,
                    T parser,
                    HttpResultHandler<T> resultHandler)
Description copied from interface: HttpRequestor
Issue an HTTP request that requires request content (e.g., PUT, POST).

Specified by:
request in interface HttpRequestor<T>
Parameters:
method - The HTTP method.
url - The target of the request.
parser - The source of the request content.
resultHandler - The handler to be notified of the request result.

octetRequest

public void octetRequest(HttpRequestMethod.HttpMethod method,
                         String url,
                         HttpResultHandler<byte[]> resultHandler)
Description copied from interface: HttpRequestor
Issue an HTTP request the returns octet-stream data (e.g., GET).

Specified by:
octetRequest in interface HttpRequestor<T>
Parameters:
method - The HTTP method.
url - The target of the request.
resultHandler - The handler to be notified of the request result.

octetRequest

public void octetRequest(HttpRequestMethod.HttpMethod method,
                         String url,
                         byte[] data,
                         HttpResultHandler<byte[]> resultHandler)
Description copied from interface: HttpRequestor
Issue an HTTP request that requires and optionally returns octet-stream data (e.g., POST, PUT).

Specified by:
octetRequest in interface HttpRequestor<T>
Parameters:
method - The HTTP method.
url - The target of the request.
data - The request content (may be null).
resultHandler - The handler to be notified of the request result.