Web Server Plugin
Try It Out
What It Does
The WebServerPlugin provides a simple web server that can be set up from configuration files. It is set up to serve the WBI documentation by default. You can change this by modifying the server configuration file. Note that the server can serve files from the file system and it can process CGIs. In addition, it can be addressed as a proxy (when WBI is set to be your browser's proxy) and it can also be addressed simply as a server (i.e., you can treat it like any web server and obtain files by typing in URLs).
Setting up the serverSee the file etc/plugins/ibm/webserver/home.prop for sample set up file. For each server root/file system root pair, simply add another line to the file that contains settings. The configuration file format is as follows:
ProxyServerName = _wbi
Note that the "ProxyServerName" can be left out, and this web server will only respond to direct requests (not proxy requests). Note also that you can specify cgi's by adding a ",true" of the end of the line. Thus, in this case you can get files from the server (if it is running on localhost on port 8088) by asking for:
and you can get the "doit" script executed by asking for:
and with the "doit" case, you can also pass query args in the URL, such as:
http://localhost:8088/doit?foo=foo&bar=bar+bazOr if you're set up to use WBI as a proxy, then you can also ask for:
How It Works
The WebServerPlugin is rather straightforward. It simply sets up a file generator and a cgi generator based on settings found in the configuration file. More precisely, the plugin's initialize method loops through lines in the cofiguration file, instantiating and setting the rule condition for either a ServerFileGenerator or a CgiGenerator based on the settings contained in the line. The CgiGenerator is a simply a bean in the beans package. The ServerFileGenerator simply wrappers a bean.
Some key WBI classes that were used: