Oracle JavaServer Pages Developer's Guide and Reference
Release 8.1.7

Part Number A83726-01





Go to previous page Go to beginning of chapter Go to next page

Considerations for Apache/JServ Servlet Environments

There are special considerations in running OracleJSP in Apache/JServ-based platforms, including Oracle Internet Application Server release 1.0.x, because this is a servlet 2.0 environment. The servlet 2.0 specification lacked support for some significant features that are available in servlet 2.1 and 2.2 environments.

For information about how to configure an Apache/JServ environment for OracleJSP, see the following sections:

(If you use Apache/JServ through an Oracle platform, see the installation and configuration documentation for that platform instead.)

The rest of this section, after summarizing the use of Apache/JServ by the Oracle Internet Application Server, discusses the following Apache-specific considerations:

Use of Apache/JServ in the Oracle Internet Application Server

As of Oracle Internet Application Server release 1.0.0 and release 1.0.1, this product uses Apache/JServ as its servlet environment.

As in any Apache/JServ or other servlet 2.0 environment, there are special considerations relating to servlet and JSP usage when using Oracle Internet Application Server release 1.0.x. These are detailed in the sections that follow.

(The Oracle Internet Application Server includes the Oracle HTTP Server, powered by Apache, as its Web server. Be aware that if you use the Oracle HTTP Server mod_ose Apache mod to run your JSP application in the Oracle Servlet Engine, you are using the OSE servlet 2.2 environment, not the Internet Application Server Apache/JServ servlet 2.0 environment.)


Future releases of the Oracle HTTP Server and Oracle Internet Application Server may use a servlet environment other than Apache/JServ.  

For a brief overview of the Oracle Internet Application Server and its use of the Oracle HTTP Server, see "Support for OracleJSP in Oracle Environments".

Dynamic Includes and Forwards in Apache/JServ

JSP dynamic includes (the jsp:include action) and forwards (the jsp:forward action) rely on request dispatcher functionality that is present in servlet 2.1 and 2.2 environments, but not in servlet 2.0 environments.

OracleJSP, however, provides extended functionality to allow dynamic includes and forwards from one JSP page to another JSP page or to a static HTML file in Apache/JServ and other servlet 2.0 environments.

This OracleJSP functionality does not, however, allow dynamic forwards or includes to servlets. (Servlet execution is controlled by the JServ or other servlet container, not the OracleJSP container.)

If you want to include or forward to a servlet, you can create a JSP page that acts as a wrapper for the servlet.

The following example shows a servlet, and a JSP page that acts as a wrapper for that servlet. In an Apache/JServ environment, you can effectively include or forward to the servlet by including or forwarding to the JSP wrapper page.

Servlet Code

Presume that you want to include or forward to the following servlet:

import javax.servlet.*;
import javax.servlet.http.*;

public class TestServlet extends HttpServlet {

    public void init(ServletConfig config) throws ServletException

    public void destroy()

    public void service 
        (HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
        PrintWriter out = response.getWriter();
        out.println("TestServlet Testing");
        out.println("<H3>The local time is: "+ new java.util.Date());

JSP Wrapper Page Code

You can create the following JSP wrapper (wrapper.jsp) for the preceding servlet:

<%-- wrapper.jsp--wraps TestServlet for JSP include/forward --%>
<%@ page isThreadSafe="true" import="TestServlet" %>
  TestServlet s=null;
  public void jspInit() {
    s=new TestServlet();
    try {
    } catch (ServletException se)
  public void jspDestroy() {
<% s.service(request,response); %>

Including or forwarding to wrapper.jsp in a servlet 2.0 environment has the same effect as directly including or forwarding to TestServlet in a servlet 2.1 or 2.2 environment.


  • Whether to set isThreadSafe to true or false in the wrapper JSP page depends on whether the original servlet is thread-safe.

  • As an alternative to using a wrapper JSP page for this situation, you can add HTTP client code to the original JSP page (the one from which the include or forward is to occur). You can use an instance of the standard class to create an HTTP request from the original JSP page to the servlet. (Note that you cannot share session data or security credentials in this scenario.) Alternatively, you can use the HTTPClient class from Innovation GmbH. Oracle8i JServer provides a modified version of this class that supports SSL, directly or through a proxy, when you use https:// for the URL. (See for general information about this class. Click "Getting Started" for information that includes how to replace the JDK HTTP client with the HTTPClient class.) Details of these alternatives are outside the scope of this document, however, and this approach is generally not recommended.


Application Framework for Apache/JServ

The servlet 2.0 specification does not provide the full servlet context framework for application support that is provided in later specifications.

For servlet 2.0 environments, including Apache/JServ, OracleJSP supplies its own application framework using a file, globals.jsa, that you can use as an application marker.

For more information, see "Distinct Applications and Sessions Through globals.jsa".

JSP and Servlet Session Sharing

To share HTTP session information between JSP pages and servlets in an Apache/JServ environment, you must configure your environment so that oracle.jsp.JspServlet (the servlet that acts as the front-end of the OracleJSP container) is in the same zone as the servlet or servlets with which you want your JSP pages to share a session. Consult your Apache documentation for more information.

To verify proper zone setup, some browsers allow you to enable a warning for cookies. In an Apache environment, the cookie name includes the zone name.

Additionally, for applications that use a globals.jsa file, the OracleJSP configuration parameter session_sharing should be set to true (the default) for JSP session data to be accessible to servlets. See these sections for related information:

Directory Alias Translation

Apache supports directory aliasing by allowing you to create a "virtual directory" through an Alias command in the httpd.conf configuration file. This allows Web documents to be placed outside the default doc root directory. (An implicit application is created for the Web server document root and each aliasing root. )

Consider the following sample httpd.conf entry:

Alias /icons/ "/apache/apache139/icons/"

This command should result in icons being usable as an alias for the /apache/apache139/icons/ path. In this way, for example, the file /apache/apache139/icons/art.gif, could be accessed by the following URL:


Currently, however, this functionality does not work properly for servlets and JSP pages, because the Apache/JServ getRealPath() method returns an incorrect value when processing a file under an alias directory.

OracleJSP provides an Apache-specific configuration parameter, alias_translation, that works around this limitation when you set alias_translation=true (the default setting is false).

For information about how to set OracleJSP configuration parameters in an Apache/JServ environment, see "Setting OracleJSP Parameters in Apache/JServ".

Go to previous page
Go to beginning of chapter
Go to next page
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.