This Connector is kept for legacy purposes
only. If you are setting up a new Connector, please use the HTTP Client Connector instead. It is
also deprecated, and will be removed in a future version of Tivoli® Directory
Integrator.
The Old HTTP Client Connector enables greater control on HTTP sessions
than the URL Connector provides. With the HTTP Connector you can set
HTTP headers and body using predefined attributes. Also, any request
to a server that returns data is available for the user as attributes.
The Old HTTP Client Connector can be used in three different AssemblyLine
modes. These are:
Iterator
Each call to the Connector requests the same URL configured
for the Connector. This causes the Connector to run forever requesting
the same page unless you include a Parser in the Connector's configuration.
If you include a Parser, the Parser notifies when the last entry has
been read from the connection and the Connector eventually causes
an AssemblyLine to stop.
Lookup
In this mode the Connector requests a page every time the Lookup
function is called. In your search criteria you can specify the page
or URL to request, and include any number of parameters all of which
are appended to the base URL as request parameters.
AddOnly
In this mode the Connector request is performed much like the
Iterator mode.
Lookup Mode
In Lookup mode you can dynamically change the request URL by setting
the search criteria as follows:
If you have one and only one criteria and the attribute is named url then the value specified in the criteria is
used as the request URL.
url equals $url
If you have more than one or the only criteria is anything but
url, then all attribute names and values are appended to the URL given
by the Connector configuration as the request URL.
When using the Connector in Iterator or Lookup mode the following
set of attributes or properties is returned in the Connector entry:
http.responseCode
The HTTP response code as an Integer object.
200 OK --->
200
http.responseMsg
The HTTP response message as a String object.
200 OK --->
OK
http.content-type
The content type for the returned http.body (if any).
http.content-encoding
The encoding of the returned http.body (if any).
http.content-length
The number of bytes in http.body.
http.body
This object is an instance/subclass of java.io.InputStream class
that can be used to read bytes of the returned body.
var body = conn.getObject ("http.body");
var ch;
while ( (ch = body.read()) != -1 ) {
task.logmsg ("Next character: " + ch);
}
Consult the Javadocs for the InputStream classes and their
methods.
http.text-body
If the http.content-type starts with the sequence text/,
the Connector assumes the body is textual data and reads the http.body
stream object into this attribute.
When using the Connector in AddOnly mode the Connector transmits
any attribute named http. as a header. Thus,
to set the content type for a request, name the attribute http.content-type and provide the value as usual.
One special attribute is http.body that can
contain a string or any java.io.InputStream or java.io.Reader subclass.
For all modes the Connector always sets the http.responseCode and http.responseMsg attributes. In AddOnly mode this
is a bit special since the conn object being
passed to the Connector is the object being populated with these attributes.
To access these you must obtain the value in the Connector's After Add hook.