[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [equinox-dev] JSP support in the servlet bridge incubator project
|
Hi Richard,
Great post.
I found myself in agreement with most of your observations
and your approach definitely sounds interesting.
For my part I've
been experimenting with packaging so in particular I'm very
curious to see the details of how you've handled tag libraries.
I think your work here sounds excellent and is
very much in line with what's going on. There's been considerable interest in
this problem so if you're willing to contribute your work
here that would be appreciated and really help things get moving.
The RSP-UI folk also alluded to similar work in their proposal so we
might also have that as source for a final solution.
There's an enhancement request here (https://bugs.eclipse.org/bugs/show_bug.cgi?id=140430)
to track this work. I can update it with a bit more information, as we
now have the go ahead for using Jasper2, Commons EL, and Commons
Logging. Before we can really get going in the incubator we still need
approval for Servlet 2.4 and JSP 2.0 (hopefully not to long now). In the
interim I can certainly post what I've got in terms of packaging so we can
perhaps begin a discussion on how we might want to bundle this stuff.
-Simon
I have spent a little time
investigating supporting JSPs within the server side OSGi incubator project.
Having taken a look at what Harald Niesche had achieved with his JasperBundle
I felt that instead of having to prefix all my JSP requests with "/jasper-jsp"
it would be preferable to support JSP's just as requests for static resources
are handled.
Here is what I have
put together :
1.) Created a
org.apache.jasper bundle containing the required Jasper jars to run the JSP
Container (commons-el.jar, jasper-compiler.jar, jasper-compiler-jdt.jar and
jasper-runtime.jar). This bundle is also a fragment bundle whose bundle host
is org.eclipse.equinox.servlet.bridge.http bundle. This allows references to
the Jasper classes to be made without having to add explicit imports to the
org.eclipse.equinox.servlet.bridge.http manifest.
2.) In the org.eclipse.equinox.servlet.bridge.http
bundle I created a JspEnabledProxyServlet class that extends the ProxyServlet
class. Within this new class a single JSPServletRegistration object is created
that wrappers the Jasper org.apache.jasper.servlet.JspServlet. Also a specialized JspServletHtpContext class has been created to
handle setting the correct resouce http context for the bundle that contains
the JSP resource.
3.) In the
org.eclipse.equinox.servlet.bridge.http bundle I created a
JspEnabledResourceRegistration class that extends the existing
ResourceRegistration class and overides the handleRequest method. When created
it is passed a reference to the JSPServletRegistration object .When the
handleRequest method is called if the supplied alias has an extension
identified as a JSP extension the JSPServletRegistration object is used to
handle the request instead of the standard ResourceRegistration.
4) All of the above is enabled by
making some slight modifications to some of the
org.eclipse.equinox.servlet.bridge.http classes, specifically the Activator
class and the ProxyServlet class. The ProxyServlet changes were simply
changing some of the class attributes and methods to protected access. The
change to the Activator class was to invoke the new JspEnabledProxyServlet
instead of the standard ProxyServlet. The manifest for the
org.eclipse.equinox.servlet.bridge.extensionbundle was also modified to filter
the javax.servlet.jsp classes down from the running webcontainer.
So this works nicely for any JSP resources configure via the standard
resources extension point but what if the JSP's reference Custom Tag Libraries
? The solution I have come up with allows Custom Tag Libraries to be created
as standard OSGi bundles. They register their provided TLD's via a TldProvider
service I added to the org.eclipse.equinox.http.registry bundle. The
JspEnabledProxyServlet class tracks the registered services and adds their
TLD uri's to the Jasper JSP Servlet. via an extended URLClassloader
I could have achieved the registration of the TLDProviders by using a
new extension point added to the org.eclipse.equinox.http.registry bundle but
getting access to the registry details seemed as though it would be quite hard
to achieve in simple manor.
Thoughts ?
Richard
Backhouse
This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.