Proposal for Development of Jasper in Tomcat 4.0

$Id$

by Craig McClanahan

Introduction

The specification for JavaServer PagesTM (JSP) version 1.2 is likely to require, among other things, exposing the internal structure of a JSP page to custom tag libraries at page translation time. This will require some substantial changes to the existing Jasper code base, and offers us the opportunity to improve its internal organization and functionality. Prior to undertaking these efforts, it is appropriate for us to discuss and agree on the high level goals we wish to achieve, and the proposed overall architecture of the new code.

This document proposes a set of goal statements, along with related assumptions and implications, for the purpose of gaining consensus and agreement at a high level. It also includes a first cut at an overall architecture (subject to change if the goals change during the process of consensus building)

Jasper is, and is proposed to remain, the component of Tomcat that compiles and executes JSP pages. If the proposal on source code organization is also accepted, it will live in a "jasper" subdirectory of the new jakarta-tomcat-4.0 CVS module.

High Level Goals for Next Generation Jasper

The statements in the following sections describe goals by which we can measure the completeness and success of the efforts to develop the next major version of the JSP page compiler and runtime environment currently known as Jasper.

Specification Compliance

The result of this coding effort will support 100% of the required functionality described in the JSP 1.2 specification (to be available as an initial public draft fairly soon), as well as the relevant portions of the Servlet 2.3 specification (to be available at the same time).

Compiler Environment and Requirements

The JSP page compiler component of Jasper shall operate in the following environments:

The JSP page compiler component of Jasper shall support the following high level functional capabilities:

Runtime Environment and Requirements

The servlet classes produced by the JSP page compiler (no matter which mode the compiler itself was executed in) shall operate in the following environments:

The servlet classes produced by the JSP page compiler (no what what environment it was executed in) shall support the following high level functional capabilities:

Overall Architecture Proposal

The following diagram contains the first cut at an overall architecture for the next generation Jasper compiler, taking into account the goals described earlier.

FIXME - image containing the architecture diagram

As you can see, the compiler is divided into several phases, with the functionality described below:

The following points should be kept in mind when considering how to implement the phases described above:

Although it is too early for detailed source code design, I would suggest that the source modules for each phase of the JSP page compiler be organized into a separate Java package (such as org.apache.jasper.generator for the Java code generation phase). Interfaces that describe cross-phase information flows can be defined in the org.apache.jasper package, with implementations provided by the phase that actually produces that information.

In a similar manner, the runtime support classes that a generated page may depend on should be organized into a single Java package (such as org.apache.jasper.runtime), to facilitate easy packaging as a JAR file, and to discourage dependencies on other Jasper internals.