Using Jolt
With BEA Jolt servlet connectivity, you can use HTTP servlets to perform server-side Java tasks in response to HTTP requests. Jolt certifies servlet connectivity with the Java Web Server versions 1.1.3 and up, and supports most other standard servlet engines. Using the Jolt session pool classes, a simple HTML client can connect to any Web server that supports generic servlets. Thus, all Jolt transactions are handled by a servlet on the Web server rather than being handled by a client applet or application.
This capability enables HTML clients to invoke BEA Tuxedo services without directly connecting to BEA Tuxedo. HTML clients can instead connect to a Web server, through HTTP, where the BEA Tuxedo service request is executed by a generic servlet. Using a Jolt session, the servlet on the Web server administers the BEA Tuxedo service request by connecting to the BEA Tuxedo Server through the Jolt Server Handler (JSH) or the Jolt Server Listener (JSL), which then makes the BEA Tuxedo service request.
This capability allows many types of HTML clients to make remote BEA Tuxedo service requests. All Jolt transactions are handled on the server side without requiring any change to the original HTML client. Thus, HTML clients are allowed to be very simple and require little maintenance.
This topic includes the following sections:
A servlet is any Java class that can be invoked and executed on a server, usually on behalf of a client. A servlet works on the server, while an applet works on the client. An HTTP servlet is a Java class that handles an HTTP request and delivers an HTTP response. HTTP servlets reside on an HTTP server and must extend the JavaSoft javax.servlet.http.Http Servlet Class so that they can run in a generic servlet engine framework.
Some advantages of using HTTP servlets are:
With Jolt servlet connectivity, any generic HTTP servlet allows you to take advantage of the Jolt features. Jolt servlets handle HTTP requests using the following Jolt classes:
Following are descriptions of the Jolt servlet connectivity classes.
This class contains data elements that represent the input and output parameters of a BEA Tuxedo service. It provides a method to import the HTML field names and values from a javax.servlet.http.HttpServletRequest
object.
This class is the startup class for a Jolt Session Pool Manager and one or more associated Jolt session pools. It creates the session pool manager if needed and starts a session pool with a minimum number of sessions. Jolt Session Pool Manager internally keeps track of one or more named session pools.
This class is derived from bea.jolt.pool.PoolManagerConfig
and allows the caller to pass a Properties or Hashtable object to the static startup()
method to create a session pool and the static getSessionPoolManager()
method to get the session pool manager of bea.jolt.pool.servlet.ServletSessionPoolManager
class.
This class provides methods to retrieve each field in a ServletResult object as a String.
This class provides a session pool for use in a Java servlet. A session pool represents one or more connections (sessions) to a BEA Tuxedo system. This class provides call methods that accept input parameters for a BEA Tuxedo service as a javax.servlet.http.HttpServletRequest
object.
This class is a servlet-specific session pool manager. It manages a collection of one or more session pools of class ServletSessionPool
. This class provides methods that are used to create both the ServletSessionPoolManager itself and the session pools that it contains. These methods are part of the administrative API for a session pool.
Before writing and registering HTTP servlets, you must first import the packages that support Jolt servlet connectivity (jolt.jar
, joltjse.jar
, servlet.jar
). HTTP servlets must extend javax.servlet.http.HttpServlet. After you write your HTTP servlets, you register them with a Web server that supports generic servlets. Your custom servlets are treated exactly like the standard HTTP servlets that provide the HTTP capabilities.
Each HTTP servlet is registered against a specific URL pattern, so that when a matching URL is requested, the corresponding servlet is called upon to handle the request.
Refer to the documentation for your particular Web server for instructions on how to register servlets.
The Jolt software includes three sample applications that demonstrate servlet connectivity using the Jolt servlet classes. The three samples are:
Refer to these samples to see code examples of how to use the Jolt servlet classes in your own servlets.
To view the code for the Jolt sample applications, you need to install the Jolt API client classes (usually chosen as an option when installing Jolt). Once the classes are installed in your directory of choice, navigate to the following directory to see the sample application files:
<Installation directory>\udataobj\jolt\examples\servlet
To view the sample code, use a text editor such as Microsoft Notepad to open the Java files for each sample application.
A sample application named simpapp
is included with Jolt. The simpapp
application illustrates how the servlet uses Servlet Connectivity for BEA Tuxedo. The following servlet tasks are illustrated by the SimpApp sample:
This example demonstrates how a servlet can connect to BEA Tuxedo and call upon one of its services; it should be invoked from the simpapp.html
file. The servlet creates a session pool manager at initialization, which is used to obtain a session when the doPost()
method is invoked. This session is used to connect to a service in BEA Tuxedo with a name described by the posted "SVCNAME
" argument. In this example the service is called "TOUPPER
", which transposes the posted "STRING
" argument text into uppercase, and returns the result to the client browser within some generated HTML.
Note: The WebLogic Server is used in this example.
The requirements for running the SimpApp sample are:
javac -classpath $(JAVA_HOME)/lib/classes.zip:$(JSDK)/lib/servlet.jar:
$(JOLTHOME)/jolt.jar:$(JOLTHOME)/joltjse.jar:./classes
-d ./classes SimpAppServlet.java
Note: The package name of the SimpAppServlet is examples.jolt.servlet.simpapp
.
#simpapp
#Fri Apr 16 00:43:30 PDT 1999
poolname=simpapp
appaddrlist=//host:7000,//host:8000
failoverlist=//backup:9000
minpoolsize=1
maxpoolsize=3
userrole=tester
apppassword=appPass
username=guest
userpassword=myPass
config.xml
file:<Application
Deployed="true"
Name="simpapp"
Path=".\config\mydomain\applications"
>
<WebAppComponent
Name="simpapp"
Targets="myserver"
URI="simpapp"
/>
</Application>
The bankapp
application illustrates how the servlet is written with PageCompiledServlet with Servlet Connectivity for BEA Tuxedo. bankapp
illustrates how to:
Following are the requirements for running the BankApp sample:
bankapp.properties
tellerForm.html
inquiryForm.html
depositForm.html
withdrawalForm.html
transferForm.html
InquiryServlet.jhtml
DepositServlet.jhtml
WithdrawalServlet.jhtml
TransferServlet.jhtml
#bankapp
#Fri Apr 16 00:43:30 PDT 1999
poolname=bankapp
appaddrlist=//host:8000,//host:7000
failoverlist=//backup:9000
minpoolsize=2
maxpoolsize=10
userrole=teller
apppassword=appPass
username=JaneDoe
userpassword=myPass
The Admin sample application illustrates the following servlet tasks:
Following are the requirements for running the Admin sample:
PoolList.jhtml
PoolAdmin.jhtml
For more information on writing and using servlets, refer to the following sites:
BEA WebLogic Servlet Documentation
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/adminguide/index.html
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/servlet/index.html
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/javadocs/index.html
http://jserv.java.sun.com/products/java-server/documentation/
webserver1.1/index_developer.html