WBI 4.5 DK API Documentation
Overview of the WBI 4.5 DK packages.
Overview of the WBI 4.5 DK packages.
The WBI Development Kit provides a convenient and flexible API for
programming intermediaries on the web. Such an intermediary is called a WBI plugin.
This document lists the classes that will help get you started
writing your own WBI plugins. This overview is not meant to be
a detailed description of the WBI architecture nor is it a WBI
programming guide. For more details on how to program with
WBI Programming, and
For information on how to use some of the classes and packages,
take a look at our sample WBI plugins:
The source code for these examples is part of the WBI DK and can be found in
Plugin is the the base class for each WBI plugin. There
are four states of a plugin, which correspond to four method calls: initialize(String), enable(),
disable() and terminate(String). HttpPlugin should be used
as the base class for your own WBI plugins as it was specifically designed for HTTP requests.
A Meg is a component within a WBI plugin that can monitor, edit, or generate requests.
WBI plugins register and initialize Megs. If a request satisfies a Meg's condition, then
that Meg is invoked by calling its handleRequest() method.
These represent the four basic types of Megs. A HttpRequestEditor can edit the
request before it gets to the Generator. A HttpGenerator can create
the response satisfying a request.
An HttpEditor can
edit the response produced by a generator. A HttpMonitor can
listen to the response at any of four points: after a specific HttpGenerator;
after a specific HttpEditor; before all HttpEditors; or after all HttpEditors.
A HttpMonitor cannot modify the request or response
in any way. Each type of Meg is invoked when WBI calls its
handleRequest() method. See also
contains a set of useful and higher-level Megs classes.
A request is responsible for dispatching the required Megs to
modify or generate a response. A request lives as long as at
least one Meg is still processing the request. A request has an
associated request event that is passed to each Meg and which
contains the input and output streams, as well as any associated
These streams contain the data of a request. A Meg can access this data by reading from
the Meg's input stream. The Meg can analyze and copy this data to the Meg's output stream,
modify the data, or simply throw away the data. Note: If an editor reads from the input
stream but does not write anything back to the output stream,
subsequent Megs in the processing chain will receive an empty
These two classes contain structure and header information about a request, such as the URL, the content type, and
the content length. Whereas a RequestInfo object is a generic object, the class
DocumentInfo was specifically designed for HTTP requests.
These classes are used to manipulate HTTP request, response, or header information from a request.
Their APIs are designed to help programmers easily manipulate HTTP requests and then write them
back to the current request through a DocumentInfo instance.
This package contains all the basic WBI classes since repackaging whereas in the old WBI version (4.1),
this package only contained
Proxy class, WBI's main class.
This package now contains the classes that represent the input/output streams associated with
a request event. A MEG uses the classes contained in this package to read/write data from/to
Furthermore, com.ibm.wbi contains the abstract base classes for plugins and the various Megs.
contains the RequestEvent class. Look at this
package to get a basic idea of the plugin-Meg
architecture and the objects the Megs work on, especially the classes that specify the objects
associated with requests, such as Request and RequestInfo.
This package contains classes specifically designed to handle HTTP-related information,
such as HTTP headers, requests, and responses. A very useful class is
FetchUrl, which contains several
static methods for using WBI to open streams to URLs on the web.
Some methods use GET, whereas others take a whole request header to open
simple connections. There are also methods that open connections through WBI, thus going through
the Megs that are registered and enabled.
The beans package holds a set of higher-level Megs that make WBI programming
a lot easier. Check out the specific Megs for local file access
or producing HTML documents
This package contains a set of Meg base classes for handling
HTTP. For example, the class HttpGenerator provides APIs to read/write HTTP responses
This package also contains the class DocumentInfo, which was specifically designed to handle
information associated with an HTTP request.
This package contains a set of classes that were specifically designed to handle HTML sources.
Using these classes, programmers can parse HTML contained in the response and modify the HTML before
it is written back to the output stream.
This package contains useful utilities for WBI programming.
This package contains classes that allow the persistent storage of information.
This replaces the database classes of previous WBI DK versions (package com/ibm/pvccommon/util).
See class Section for details.