BBjServlet Overview (Deprecated)
BBjServlets are deprecated for BBj 21.00 and higher, and have been replaced by BBxServlets.
In BBj 12.00 and higher, BBjServlet allows programs to respond to web requests such as events. For additional reading about BBjServlets, read these articles from The BASIS International Advantage:
To respond to a web request, follow these three steps:
-
Create an application with BBjAppConfig
-
Obtain the servlet registry from BBjAdmin
-
Publish the BBjAppConfig with the BBjServletRegistry
Create
BBj applications can require a lot of configuration. config files, working directories, program names, just to get started. The BBjAppConfig object encapsulates environment information and stores it so the program can be run in an automatic way, much like an autorun program, or BBj task.
Obtain
The BBjServletRegistry manages all currently running servlets. The BBjServletRegistry is used to publish BBjAppConfigs at specific paths. It is obtained from BBjAdmin, so administrative rights are required to add and remove servlets from the webserver.
Publish
With both the BBjServletRegistry and your BBjAppConfig, you can publish a new servlet to the webserver. Select a path (starting with “/servlet/”) and publish your application. New interpreters will be started and pooled depending on load. When the load declines, the interpreters will be shut down. Licenses are checked out only during request handling.
|
What can servlets do?
Servlets can respond to all types of web requests such as GET and POST. In order to respond to a web request, your servlet must register for the ON_WEB_CONNECTION event. That event provides lots of information about the request, such as the request method, query parameters and http headers.
When you’re ready to respond, print to the new JSERVLET channel, the output will be redirected back to the browser with whatever configuration options you wish to set on the BBjHttpResponse, such as contentType.
Example
|
See Also
The BASIS International Advantage