On Mon, 11 Jun 2001, JULIEN,TIMOTHY (HP-NewJersey,ex2) wrote:

> Does jasper have an architecture goal to run in other Servlet Containers?
> I ask because I am working on a Servlet/JSP Container, and the JSP portion
> (a Servlet) has been kept separate for this exact reason.  We would like our
> JSP implementation to be able to run in any Servlet Container, and we would
> like to run other JSP implementations in our Servlet Container.

Yes, it is a goal, and we are working to improve this.

There are already other containers using jasper ( with more or less pain),
and in theory you could reduce all the adapter needed to few
attribute-name conventions ( classpath, classloader, etc).

We started work on jasper34, with the goal to modularize jasper and
improve its ability to work with a different containers, but with a
different aproach.

Instead of restricting jasper and using only a minimal interface to the
container ( i.e. servlet API and few attribute names ) we started to add a
ContainerLiaison class for compilation time and a RuntimeLiaison for
runtime.

We'll provide "default" implementations based on what JspServlet does
right now ( i.e. on top of a minimal API ), but a container will be able
to provide it's own hooks and optimize different operations.

Note that there are 2 different issuses here - using jasper as a
JSP->class compiler, and using java files generated by jasper. For the
second case you'll just need to include jasper runtime ( this happens if
you use JSPC to pre-compile JSPs, and then deploy this into a random
container)

> Options I see:
> 1. All Servlet/JSP implementations using common:
> a) attribute storage (i.e., the request)
> b) attribute names (i.e., javax.servlet.jsp.classpath)
> 
> This is probably a bit of a pipe dream since JSP implementations may expose
> attributes in different places.

The main problem I see with both aproaches is that it "dumbs" the jsp
implementation. Using few attributes is a nice hack, but it would be far
better if istead of minimizing the interactions between container and
jasper we would maximize them, providing hooks for the container for
every function that would benefit from that.

( for example WEB.XML is probably already parsed by the container, etc ).

Then we can use the current implementation as a default, for containers
that don't use the hooks.

This will be extremely important in the RuntimeLiaison, where hooks can
greatly optimize the runtime performance ( by taking advantage of the
container's internals ).

You can still benefit from portability - but without having to give up
performance.


> 2. Compile a list that details where attributes are stored (it may be
> several different places), and what their names are.  Then, to achive
> pluggability, a filter could be written which maps the Servlet Container's
> attribute name/value pairs to the name value pairs the JSP implementation is
> expecting.  This will be slower (a filter has to run for each request), and
> a bit of a hack, but it may be more acheivable then option 1.

Costin

Reply via email to