[opencms-dev] Re: JSP Support in 4.6.0

Alexander Kandzior alex at opencms.com
Mon Mar 25 13:35:56 CET 2002

Dear Patrick,

I was the one mentioning the "proof of concept". You are right in
assuming that currently no one is working on the integration of JSP in
OpenCms. I would very much like to change that and I also can commit
some time to this project. 

Here's an overview about what the issues of integrating JSP are:

1. JSP in the VFS
First point is that usually all resources of OpenCms are residing in the
VFS (virtual file system). However, the JSP engine usually expects the
JSP pages to be files in or below a certain directory of the "real" FS.
It would be preferable to use the existing engine (e.g. Tomcats) to
process the JSP. Therefore, all JSP in the VFS must be synchronized to
the "real" FS, so that the JSP engine can process them. 

2. Online / Offline Projects
In the OpenCms project mechanism, a resource can exist twice: In the
"Online" project and in all offline projects that you might have
created. To keep this working, there must also be 2 versions of the JSP
- pages that get synchronized to the "real" FS. 

3. Access to the OpenCms object
When a JSP gets processed, you want to have access to the OpenCms
resources and user - related information. Which User is currently logged
in? What are his permissions? Which files can he access? 

4. Output - caching
OpenCms has a sophisticaed caching mechanism. It would be preferable if
the JSP output is also cachable using that mechanism.

5. Static export
This new feature in OpenCms 4.6 makes use of of URL rewriting. To enable
this feature with JSP, this URL rewriting has somehow to be integrated. 

My "proof of concept" solves issues 1-3. Here's how I think it should be

In the web application directory e.g. {$TOMCAT-HOME}\webapps\opencms
there should be a directory "jsp" with subdirectories "online" and
"offline". Whenever a JSP page in an offline project is changed, it gets
copied from the VFS to this "offline" directory. If it gets published,
it is copied to the "online" directory. So the file exists in the
OpenCms VFS and the real FS. If a request is made to a JSP page
resource, this first is routed through the opencms servlet, as usual.
Here, permissions get checked. If permission to the requested JSP page
is granted, the opencms servlet (that knows which project is active and
in which directory of the "real" FS the corrosponding JSP files reside)
just calls the JSP, which processes and returns the output to the
servlet through standard Java servlet chaining. This approach solves
issues 1 + 2 from above. This BTW is also a valid model of
Model-View-Controller (MVC) programming for JSP pages, with the opencms
servlet being the controller. Now accessing the OpenCms object (see 3
above) could be easily handled by just placing the current CmsObject in
the request context that the JSP of course will have access to. 

This approach is, of course, just a DRAFT PROPOSAL from my side. I would
be happy to exchange some ideas around this topic. 

Best Regards,

Alexander Kandzior
OpenCms Group

-----Original Message-----
From: owner-opencms-dev at www.opencms.com
[mailto:owner-opencms-dev at www.opencms.com] On Behalf Of Patrick Pyette
Sent: Sunday, March 24, 2002 10:46 PM
To: Opencms-Dev (E-mail)
Subject: [opencms-dev] Re: JSP Support in 4.6.0

About three weeks ago, I asked about the status of the JSP support in
openCMS.  I didn't get any responses so I'm assuming that no one is
on it.   If that's the case, I'm going to try to get something to work

What I'd really appreciate that someone let me know what "proof of
concept" (as is mentioned on the website) has been performed, so that I
don't have to reinvent the wheel.  Any helpful pointers would be


More information about the opencms-dev mailing list