HTTP Plugin

[Contents] [Prev] [Next]
Table of Contents


This plugin provides a high-level interface for accessing World-Wide Web resources. The name is somewhat misleading because the plugin can access http, ftp, and gopher URLs. To use the plugin, a KP must first lookup a connector for an HTTPAPI.Factory object and use it to create a new HTTPAPI.Requester.


This module defines the following object types:

The Factory generates new Requester objects. The plugin registers this object with the name 'http'.

The Requester loads Web resources.

Methods of Factory object

Instances of the Factory object have the following method:
Factory() : HTTPAPI.Requester
Returns a new Requester object that can be used to load URLs. A FactoryFailed exception may be raised if a system error occurs.

Methods of Requester object

Instances of the Requester object have the following methods:
Get(url : string) : FileAPI.File
Requests the resource addressed by url. Returns the resource as a file-like objects or raises a FileAPI.FileIOError exception if the request resource could not be loaded.

GetWithInfo(url : string) : list of list of string, FileAPI.File
Requests the resource address by url. Returns the headers from the HTTP response and the resource body. The headers are represented as a list of key-value pairs, where the pairs are lists with two elements. (For ftp and gopher responses, the list of headers will be empty.)

In an error occurs, a FileAPI.FileIOError will be raised.

Destroys the Requester object. If you don't call this method, the system will not be able to reclaim the resources used by the Requester.


This module defines the following exceptions:

The Factory could not create a new HTTP Requester because of a system error.


Table of Contents

[Contents] [Prev] [Next]
Copyright © 1998 by the Corporation for National Research Initiatives.