Using Oracle Jolt

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using Servlet Connectivity for Oracle Tuxedo

With Oracle 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 Oracle Tuxedo services without directly connecting to Oracle Tuxedo. HTML clients can instead connect to a Web server, through HTTP, where the Oracle Tuxedo service request is executed by a generic servlet. Using a Jolt session, the servlet on the Web server administers the Oracle Tuxedo service request by connecting to the Oracle Tuxedo Server through the Jolt Server Handler (JSH) or the Jolt Server Listener (JSL), which then makes the Oracle Tuxedo service request.

This capability allows many types of HTML clients to make remote Oracle 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:

 


What Is a Servlet?

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:

 


How Servlets Work with Jolt

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:

The Jolt Servlet Connectivity Classes

Following are descriptions of the Jolt servlet connectivity classes.

ServletDataSet

This class contains data elements that represent the input and output parameters of an Oracle Tuxedo service. It provides a method to import the HTML field names and values from a javax.servlet.http.HttpServletRequest object.

ServletPoolManagerConfig

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.

ServletResult

This class provides methods to retrieve each field in a ServletResult object as a String.

ServletSessionPool

This class provides a session pool for use in a Java servlet. A session pool represents one or more connections (sessions) to an Oracle Tuxedo system. This class provides call methods that accept input parameters for an Oracle Tuxedo service as a javax.servlet.http.HttpServletRequest object.

ServletSessionPoolManager

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.

 


Writing and Registering HTTP Servlets

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.

 


Jolt Servlet Connectivity Sample

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.

Viewing the Sample Servlet Applications

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.

SimpApp Sample

A sample application named simpapp is included with Jolt. The simpapp application illustrates how the servlet uses Servlet Connectivity for Oracle Tuxedo. The following servlet tasks are illustrated by the SimpApp sample:

This example demonstrates how a servlet can connect to Oracle 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 Oracle 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.

Requirements for Running the SimpApp Sample

The requirements for running the SimpApp sample are:

Installing the SimpApp Sample

  1. Install the Jolt class library (jolt.jar) and Servlet Connectivity for Oracle Tuxedo class library (joltjse.jar) on the Web application server. Extract the class files if it is required by your Web application server.
  2. Compile the SimpAppServlet.java. Make sure that you include the standard JDK 1.1.x classes.zip, JSDK 1.1 classes, Jolt class library, and Servlet Connectivity for Oracle Tuxedo class library in the classpath.
  3. 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.
  4. Put the simpapp.html and simpapp.properties files in the public HTML directory.
  5. Modify the simpapp.properties file. Change the “appaddrlist” and “failoverlist” with the proper Jolt server hosts and ports. Specify the proper Oracle Tuxedo authentication information if the SimpApp has security turned on. For example:
  6. 	#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
  7. Register “Simpapp” for the SimpAppServlet. Consult your Web application server for details. If you are using Oracle WebLogic Server, add the following section of the config.xml file:
  8. <Application
    Deployed="true"
    Name="simpapp"
    Path=".\config\mydomain\applications"
    >
    <WebAppComponent
    Name="simpapp"
    Targets="myserver"
    URI="simpapp"
    />
    </Application>
  9. To access the SimpApp initial page “simpapp.html,” type:
  10. http://mywebserver:8080/simpapp.html

BankApp Sample

The bankapp application illustrates how the servlet is written with PageCompiledServlet with Servlet Connectivity for Oracle Tuxedo. bankapp illustrates how to:

Requirements for Running the BankApp Sample

Following are the requirements for running the BankApp sample:

Installation Instructions

  1. Install the Jolt class library (jolt.jar) and Servlet Connectivity for Oracle Tuxedo class library (joltjse.jar) to the Web application server. Extract the class files if it is required by your Web application server.
  2. Copy all HTML, JHTML and bankapp.properties files to the public HTML directory of the Web application server (for example, $WEBLOGIC/myserver/public_html for WebLogic):
  3. 	bankapp.properties
    	tellerForm.html
    	inquiryForm.html
    	depositForm.html
    	withdrawalForm.html
    	transferForm.html
    	InquiryServlet.jhtml
    	DepositServlet.jhtml
    	WithdrawalServlet.jhtml
    	TransferServlet.jhtml
  4. Modify the bankapp.properties file. Change the “appaddrlist” and “failoverlist” with the proper Jolt server hosts and ports. Specify the proper Oracle Tuxedo authentication information if the BankApp has security turned on. For example:
  5. 	#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
  6. If applicable, turn on the automatic page compilation for JHTML from your servlet engine. Consult the user manual of your Web application server for details.
  7. To access BankApp through Servlet Connectivity for Oracle Tuxedo, use the following URL in your favorite browser:
  8. http://mywebserver:8080/tellerForm.html

Admin Sample

The Admin sample application illustrates the following servlet tasks:

Requirements for Running the Admin Sample

Following are the requirements for running the Admin sample:

Installation Instructions

  1. Install the Jolt class library and Servlet Connectivity for Oracle Tuxedo class library on the Web application server.
  2. Copy all JHTML files to the public HTML directory (for example, $WEBLOGIC/myserver/public_html for WebLogic):
  3. 	PoolList.jhtml
    	PoolAdmin.jhtml
  4. To get a list of session pools, use the following URL in your favorite browser:
  5. http://mywebserver:8080/PoolList.jhtml

 


Additional Information on Servlets

For more information on writing and using servlets, refer to the following sites:

Oracle WebLogic Servlet Documentation

http://e-docs.bea.com/wls/docs81/adminguide/index.html

http://e-docs.bea.com/wls/docs81/servlet/index.html

http://e-docs.bea.com/wls/docs81/javadocs/index.html

Java Servlets

http://jserv.java.sun.com/products/java-server/documentation/
webserver1.1/index_developer.html

Servlet Interest Group

http://servlet-interest@java.sun.com


  Back to Top       Previous  Next