com.novell.sentinel.client.http.java
Class JSONHttpRequestorJava

java.lang.Object
  extended by com.novell.sentinel.client.http.java.JavaRequestorBase<T>
      extended by com.novell.sentinel.client.http.java.HttpRequestorAsyncJava<JSONParser>
          extended by com.novell.sentinel.client.http.java.JSONHttpRequestorJava
All Implemented Interfaces:
HttpRequestMethod, HttpRequestor<JSONParser>

public class JSONHttpRequestorJava
extends HttpRequestorAsyncJava<JSONParser>

An asynchronous implementation of the HttpRequestor interface that uses JSON as the transport data type.


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
 
Fields inherited from class com.novell.sentinel.client.http.java.HttpRequestorAsyncJava
QUEUE_END
 
Fields inherited from class com.novell.sentinel.client.http.java.JavaRequestorBase
CHAR_ENCODING
 
Constructor Summary
JSONHttpRequestorJava()
           
 
Method Summary
protected  String getMediaType()
          Derived classes must return the media type to use for requests/responses.
protected  JavaRequestorBase.NcacFault getNcacFault(InputStream source)
          Derived classes must attempt to return Ncac fault information found in the passed InputStream.
protected  JSONParser getParser(InputStream source)
          Get a parser (or whatever data source type is being used) that will return data from the passed InputStream.
protected  String getToken(InputStream source)
          Derived classes must return the Base64-encoded Sentinel SAML token returned in response to the POST request issued by the authenticate method.
protected  void sendData(OutputStream dest, JSONParser parser)
          Given the passed data source (parser), serialize the data from the data source to the passed OutputStream.
 
Methods inherited from class com.novell.sentinel.client.http.java.HttpRequestorAsyncJava
octetRequest, octetRequest, request, request, setMaxThreads, shutdown, shutdown
 
Methods inherited from class com.novell.sentinel.client.http.java.JavaRequestorBase
authenticate, deleteToken, getHostnameVerifier, getLocaleName, getSAMLToken, getSecureRandom, getSocketFactory, getSSLSocketFactory, getTrustManager, issueOctetRequest, issueRequest, 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
 

Constructor Detail

JSONHttpRequestorJava

public JSONHttpRequestorJava()
Method Detail

getMediaType

protected String getMediaType()
Description copied from class: JavaRequestorBase
Derived classes must return the media type to use for requests/responses. This will depend on the parameter used for (e.g., "application/json" or application/xml").

Specified by:
getMediaType in class JavaRequestorBase<JSONParser>
Returns:
The media type string.

getToken

protected String getToken(InputStream source)
                   throws IOException
Description copied from class: JavaRequestorBase
Derived classes must return the Base64-encoded Sentinel SAML token returned in response to the POST request issued by the authenticate method.

Specified by:
getToken in class JavaRequestorBase<JSONParser>
Parameters:
source - The response data from the server.
Returns:
The Base64-encoded SAML token.
Throws:
IOException - If an error occurs reading the token.

getParser

protected JSONParser getParser(InputStream source)
Description copied from class: JavaRequestorBase
Get a parser (or whatever data source type is being used) that will return data from the passed InputStream. The parser will typically be passed to an HttpResultHandler's onSuccess method.

Specified by:
getParser in class JavaRequestorBase<JSONParser>
Parameters:
source - The InputStream.
Returns:
An implementation that can be used to obtain data.

sendData

protected void sendData(OutputStream dest,
                        JSONParser parser)
                 throws IOException
Description copied from class: JavaRequestorBase
Given the passed data source (parser), serialize the data from the data source to the passed OutputStream.

Specified by:
sendData in class JavaRequestorBase<JSONParser>
Parameters:
dest - The OutputStream to which to write the data.
parser - The data source containing the data.
Throws:
IOException - If an error occurs writing the data.

getNcacFault

protected JavaRequestorBase.NcacFault getNcacFault(InputStream source)
                                            throws IOException
Description copied from class: JavaRequestorBase
Derived classes must attempt to return Ncac fault information found in the passed InputStream. If no valid Ncac fault information can be parsed, then the implementation must throw an exception.

Specified by:
getNcacFault in class JavaRequestorBase<JSONParser>
Parameters:
source - The error stream from the Http request.
Returns:
An NcacFault instance.
Throws:
IOException - If any error occurs attempting to parse Ncac fault information.