The HTTP Demo demonstrates how to use the HTTP Bundle to register servlets and resources in the HttpService. It registers a servlet with an alias "/servlet" and a folder having alias "/images".
Contents:
The bundle of the HTTP Demo is httpdemo.jar, located
in the demo/bundles folder. The other components are
in the folder demo/framework/http. It contains scripts
for installing the demo through the Kit
Manager Bundle - install.txt, and for compiling and
bundling the demo files - mk. The readme.txt file
gives a short description of the demo. The source files are
placed in a demo.http package and there is an image
file, that the demo registers as a resource, placed in the demo/framework/http/resources
folder.
To start the demo you must first install the demo bundle. You may use the following command line:
>$fw.i -s ../../../demo/bundles/httpdemo.jar
The HTTP Demo Bundle uses two methods provided by the HTTP Service - registerServlet
and registerResources. The first requires an alias string and an
instance of the servlet being registered and the second - resource path instead
of the servlet.
The HTTP Demo bundle registers two resources - a servlet and an image.
To access the servlet, type http://<mBServer_host>/servlet in
the location bar of your browser. For example, if the server is running on the
local machine, you may type http://localhost/servlet. The page that shows
up is generated by the demo.http.SimpleServlet class.
To access the registered image, type http://<mBServer_host>/images/imagination.jpg.