Sun Adapter for HTTP API

com.stc.connector.appconn.http
Interface HTTPRequest


public interface HTTPRequest

This interface represents an HTTP application request.

Version:
$Revision: 1.6 $

Method Summary
 void addContentType(java.lang.String contentTypeValue)
          Adds a value to the Content-type header.
 void addHeader(java.lang.String name, java.lang.String value)
          Adds an HTTP request header to be sent along with the next HTTP request.
 void addParameterRequest(java.lang.String name, java.lang.String value)
          Adds a parameter (name/value form-data pair).
 void clear()
          Resets the HTTP request object.
 void clearContentType()
          Removes all values from the Content-type header, essentially deleting the Content-type header.
 void clearHeader()
          Removes all HTTP request headers.
 void clearParameterRequest()
          Removes all parameters (name/value form-data pairs).
 int getStrongestAuthSchemeLevel()
          User can get the strongest authentication scheme level currently set.
 java.lang.String getURL()
          Gets the current HTTP URL.
 void removeContentType(java.lang.String contentTypeValue)
          Removes a value from the Content-type header.
 void removeHeader(java.lang.String name)
          Removes an HTTP request header.
 void removeParameterRequest(java.lang.String name)
          Removes a parameter (name/value form-data pair).
 void setByteRequestBody(byte[] requestBody)
          Sets the request body with a byte array payload.
 void setCredentials(java.lang.String userName, java.lang.String password)
          Sets the user credentials (user name and password) for the underlined URL
 void setStringRequestBody(java.lang.String requestBody)
          Sets the request body with a String payload.
 void setStrongestAuthSchemeLevel(int schemeCode)
          User can set the strongest authentication scheme level allowable; if basic level is set, then all basic challenge received will be attempted but digest challenge will be ignored; if digest level is set, then all basic and digest challenges received will be attempted; if automatic detection level is set, then it will behave the same way as for Digest Authentication but for future purpose it implies that it will attempt any supported authentication schemes.
 void setURL(java.lang.String url)
          Sets the URL for the HTTP request.
 

Method Detail

clear

void clear()
           throws HTTPApplicationException
Resets the HTTP request object. Calling this method resets the state of the request object.

Throws:
HTTPApplicationException - upon error.

setURL

void setURL(java.lang.String url)
            throws HTTPApplicationException
Sets the URL for the HTTP request. Setting the URL with this method will overwrite the default URL value set for the HTTP connection.

Parameters:
url - The HTTP URL to set.
Throws:
HTTPApplicationException - upon error.

getURL

java.lang.String getURL()
                        throws HTTPApplicationException
Gets the current HTTP URL.

Returns:
The HTTP URL or null if the HTTP URL was not set.
Throws:
HTTPApplicationException - upon error.

addHeader

void addHeader(java.lang.String name,
               java.lang.String value)
               throws HTTPApplicationException
Adds an HTTP request header to be sent along with the next HTTP request.

Parameters:
name - The name of the HTTP header.
value - The value of the HTTP header.
Throws:
HTTPApplicationException - upon error.

removeHeader

void removeHeader(java.lang.String name)
                  throws HTTPApplicationException
Removes an HTTP request header. If the request header does not exist (it was not previously added), then nothing is done.

Parameters:
name - The name of the HTTP header to remove.
Throws:
HTTPApplicationException - upon error.

clearHeader

void clearHeader()
                 throws HTTPApplicationException
Removes all HTTP request headers. If there are no request headers (none were previously added), then nothing is done.

Throws:
HTTPApplicationException - upon error.

addContentType

void addContentType(java.lang.String contentTypeValue)
                    throws HTTPApplicationException
Adds a value to the Content-type header.

Parameters:
contentTypeValue - The value to add for the Content-type header.
Throws:
HTTPApplicationException - upon error.

removeContentType

void removeContentType(java.lang.String contentTypeValue)
                       throws HTTPApplicationException
Removes a value from the Content-type header. If the value does not exist (it was not previously added), then nothing is done.

Parameters:
contentTypeValue - The value to remove from the Content-type header.
Throws:
HTTPApplicationException - upon error.

clearContentType

void clearContentType()
                      throws HTTPApplicationException
Removes all values from the Content-type header, essentially deleting the Content-type header.

Throws:
HTTPApplicationException - upon error.

addParameterRequest

void addParameterRequest(java.lang.String name,
                         java.lang.String value)
                         throws HTTPApplicationException
Adds a parameter (name/value form-data pair). The name and value will be URL encoded appropriately. For the POST method, only one of addParameterRequest, setByteRequestBody, or setStringRequestBody can be used.

Parameters:
name - The name of the parameter.
value - The value of the parameter.
Throws:
HTTPApplicationException - upon error.

removeParameterRequest

void removeParameterRequest(java.lang.String name)
                            throws HTTPApplicationException
Removes a parameter (name/value form-data pair). If the parameter does not exist (it was not previously added), then nothing is done.

Parameters:
name - The name of the parameter to remove.
Throws:
HTTPApplicationException - upon error.

clearParameterRequest

void clearParameterRequest()
                           throws HTTPApplicationException
Removes all parameters (name/value form-data pairs). If there are no parameters (none were previously added), then nothing is done.

Throws:
HTTPApplicationException - upon error.

setByteRequestBody

void setByteRequestBody(byte[] requestBody)
                        throws HTTPApplicationException
Sets the request body with a byte array payload. This is only valid for the POST method. For the POST method, only one of setByteRequestBody, addParameterRequest, or setStringRequestBody can be used.

Parameters:
requestBody - The name of the parameter to remove.
Throws:
HTTPApplicationException - upon error.

setStringRequestBody

void setStringRequestBody(java.lang.String requestBody)
                          throws HTTPApplicationException
Sets the request body with a String payload. This is only valid for the POST method. For the POST method, only one of setStringRequestBody, addParameterRequest, or setByteRequestBody can be used.

Parameters:
requestBody - The name of the parameter to remove.
Throws:
HTTPApplicationException - upon error.

setCredentials

void setCredentials(java.lang.String userName,
                    java.lang.String password)
                    throws HTTPApplicationException
Sets the user credentials (user name and password) for the underlined URL

Parameters:
userName - The user name for authenticating the URL
password - The password for authenticating the URL
Throws:
HTTPApplicationException - upon error.

setStrongestAuthSchemeLevel

void setStrongestAuthSchemeLevel(int schemeCode)
                                 throws HTTPApplicationException
User can set the strongest authentication scheme level allowable; if basic level is set, then all basic challenge received will be attempted but digest challenge will be ignored; if digest level is set, then all basic and digest challenges received will be attempted; if automatic detection level is set, then it will behave the same way as for Digest Authentication but for future purpose it implies that it will attempt any supported authentication schemes. The default is automatic detection.

Parameters:
schemeCode - The strongest level of authentication allowable; 0 -- Basic authentication will be attemnpted per rfc 2617 1 -- Digest authentication will be attemnpted per rfc 2617 999 -- Automatic detection, i.e., either basic or digest authentication will be attemnpted per rfc 2617
Throws:
HTTPApplicationException - upon error.

getStrongestAuthSchemeLevel

int getStrongestAuthSchemeLevel()
                                throws HTTPApplicationException
User can get the strongest authentication scheme level currently set.

Returns:
The strongest authentication scheme level currently set.
Throws:
HTTPApplicationException - upon error.

Sun Adapter for HTTP API

Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.