AW: [opencms-dev] Velocity support
Mario Meisenberger
m.meisenberger at labor-c.net
Tue Mar 26 11:53:05 CET 2002
Due to recent discussion about Velocity and OpenCMS, one or two weeks
ago we (Labor_C) developed such a solution for OpenCMS as helper
classes. It is rather a small hack to integrate Velocity with OpenCMS.
We will send the code to the OpenCMS developers tomorrow (give us time
to clean up the code a little bit and write some end user documentation
to the thing-you know time constraints etc...). And it also will be
posted on our website tomorrow for fast access (a when and where will
come when it is posted) if anybody needs it before tomorrow simply send
us a mail.
Here is a short description what it does:
a) A backend driver for Velocity to access files in the OpenCMS
filesystem.
b) An access class to pass down the OpenCMS parameters properly into the
Velocity driver.
The code is very short (merely about 200 lines of code but very
powerful). Unfortunately due to the parameter passing the whole Velocity
call has to be done synchronized which could pose a problem on heavy
loads. But so far it seems to work really well, despite it. I will have
a look into it more exactly soon if there is a way to pass down the
parameters unsynchronized, but due to time constraints - I simply was
bound with other things, although I felt a little bit uneasy about my
current solution.
If its nothing else it is at least a headstart on how to integrate both
systems in a proper way without rewriting Velocity entirely to fit into
OpenCMS.
Werner Punz Labor_C
-----Ursprüngliche Nachricht-----
Von: owner-opencms-dev at www.opencms.com
[mailto:owner-opencms-dev at www.opencms.com] Im Auftrag von Alexander
Kandzior
Gesendet: Dienstag, 26. März 2002 10:20
An: opencms-dev at www.opencms.com
Betreff: [opencms-dev] Velocity support
Hi Jozef,
Velocity support is something that I have thought about, too. It seems
JSP is in more popular demand, though. However, since I am working on
JSP already I will also try to add Velocity support along the way. I am
not really sure jet if this is easier or more difficult.
Regards,
Alex.
-----Original Message-----
From: owner-opencms-dev at www.opencms.com
[mailto:owner-opencms-dev at www.opencms.com] On Behalf Of Jozef Hribik
Sent: Monday, March 25, 2002 2:05 PM
To: opencms-dev at www.opencms.com
Subject: Re: [opencms-dev] Re: JSP Support in 4.6.0
Hi Alex,
I have been also thinking about the JSP integration.
But what about to integrate some servlet-based templating engine e.g.
Jakarta Velocity?
Could it be easier?
Of course, i would like to have JSP with Struts MVC integrated in
OpenCMS to be able to integrate our e-commerce apps, but it seems to be
impossible.
Best Regards
Jozef Hribik
----- Original Message -----
From: Alexander <mailto:alex at opencms.com> Kandzior
To: opencms-dev at www.opencms.com
Sent: Monday, March 25, 2002 1:35 PM
Subject: RE: [opencms-dev] Re: JSP Support in 4.6.0
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
done:
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,
Alex.
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
working
on it. If that's the case, I'm going to try to get something to work
myself.
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
appreciated.
Thanks,
Pat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20020326/98a6681b/attachment.htm>
More information about the opencms-dev
mailing list