com.sapportals.wcm.service.ice

Interface IICEHttpConnection


public interface IICEHttpConnection

A helper class representing a HTTP connection to an ICE server.

This class is used to transport an ICE payload via the HTTP protocol to an ICE server. The ICE payload will be encapsulated in the body of the HTTP request.

When calling methods of this interface, a certain order has to be observed.

Note: An connection object is only valid for sending one ICE payload. If another ICE payload needs to be transferred, a new connection object has to be created.

The code sample shows how to setup the connection and send an ICE payload.

 // create connection
 IICEHttpConnection connection = buildConnection(...);

 // initialize connection
 HashMap map = new HashMap();
 map.put(IICEHttpConnection.USER_KEY,     user);
 map.put(IICEHttpConnection.PASSWORD_KEY, password);
 connection.setResponseHandler(responseHandler);
 connection.setLogonData(map);
 connection.setMethod("POST");

 // build the ICE payload and send it
 IICERequestElement  request = buildRequest(...);
 ICEOutput  output = connection.getOutput(true);
 String  requestID = output.addRequest(request);
 connection.perform(null);
 
Copyright (c) SAP AG


Field Summary
static String PASSWORD_KEY
          key to use when specifying the password in the logon data map
static String USER_KEY
          key to use when specifying the user in the logon data map
 
Method Summary
 IAbortCondition getAbortCondition()
          Gets the abort condition for this connection consisting of the maximum number of bytes written to the pipe as well as an expiration date/time.
 ICEOutput getOutput(boolean chunked)
          Gets the ICEOutput object that builds the ICE payload for sending to the server.
 void perform(ICEOutput output)
          Sends the ICE payload to the server and sends the response to the registered response handler.
 void setAbortCondition(long maxBytes, Date expiration)
          Sets the maximum number of bytes written to the pipe as well as an expiration date/time.
 void setLogonData(HashMap env)
          Sets the login information needed for connecting to the ICE server.
 void setMethod(String method)
          Sets the request method of the HTTP request.
 void setResponseHandler(IICEResponseHandler handler)
          Sets the response handler for this connection responsible for initiating appropriate actions in reaction to the response sent by the ICE server.
 

Field Detail

USER_KEY

static final String USER_KEY
key to use when specifying the user in the logon data map

See Also:
setLogonData(java.util.HashMap), Constant Field Values

PASSWORD_KEY

static final String PASSWORD_KEY
key to use when specifying the password in the logon data map

See Also:
setLogonData(java.util.HashMap), Constant Field Values
Method Detail

setMethod

void setMethod(String method)
Sets the request method of the HTTP request.

Passing null as an argument for method will cause an exception.

Parameters:
method - a String specifying the method to use for the HTTP request (either POST or GET)

setAbortCondition

void setAbortCondition(long maxBytes,
                       Date expiration)
Sets the maximum number of bytes written to the pipe as well as an expiration date/time.

Passing null as an argument for expiration sets the expiration to positive infinity (thus, disabling expiration checks).

Parameters:
maxBytes - the maximum number of bytes written to the pipe
expiration - the date/time specifying this connection's expiration

getAbortCondition

IAbortCondition getAbortCondition()
Gets the abort condition for this connection consisting of the maximum number of bytes written to the pipe as well as an expiration date/time.

Returns:
an IAbortCondition with the specified abort information or null if none was specified

setLogonData

void setLogonData(HashMap env)
Sets the login information needed for connecting to the ICE server.

This login information contains two Strings specifying the user and password.

Parameters:
env - a HashMap containing the user (specified with key IICEHttpConnection.USER_KEY) and password (specified with key IICEHttpConnection.PASSWORD_KEY)

setResponseHandler

void setResponseHandler(IICEResponseHandler handler)
Sets the response handler for this connection responsible for initiating appropriate actions in reaction to the response sent by the ICE server.

Passing null as an argument for handler will cause the response to be ignored completly.

Parameters:
handler - the new response handler
See Also:
IICEResponseHandler

getOutput

ICEOutput getOutput(boolean chunked)
                    throws IOException
Gets the ICEOutput object that builds the ICE payload for sending to the server.

ICE requests which should be contained in the ICE payload can be added to this ICEOutput object.

Parameters:
chunked - true if the ICEOutput should be in chunked mode, false otherwise
Returns:
an ICEOutput that builds the ICE payload
Throws:
IOException - if an initial connection attempt failed (an implementation of this interface may use this method to check theavailability of the ICE server)

perform

void perform(ICEOutput output)
             throws IOException
Sends the ICE payload to the server and sends the response to the registered response handler.

Registering no response handler will cause the response to be ignored completely. Passing null as an argument for output will result in ignoring the answers to the responses. As ICE is request/response-orientated, there is usually no need for answers to responses. Thus, this parameter will usually be null.

Parameters:
output - an ICEOutput that receives the answers to the responses from the server
Throws:
IOException - if an I/O error occurs
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice