Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 132555

Summary: [http] Upgrade HttpService support of Servlet API to 2.3/2.4
Product: [Eclipse Project] Equinox Reporter: Simon Kaegi <simon_kaegi>
Component: CompendiumAssignee: equinox.compendium-inbox <equinox.compendium-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: arunbhatj, backhous, bogofilter+eclipse.org, curtispd, ed.burnette, gunnar, harald, jeffmcaffer, jfogell, pmuellr, toddsing
Version: 3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Jetty based Http Service project archive
none
same as last but with SSL support
none
org.eclipse.equinox.http.proxy project
none
org.eclipse.equinox.http.jetty
none
org.eclipse.equinox.servlet.bridge.http
none
update org.eclipse.equinox.http.jetty
none
org.eclipse.equinox.jetty.http
none
org.eclipse.equinox.jetty project
none
org.eclipse.equinox.jetty.http project
none
org.eclipse.equinox.jetty.http project
none
org.eclipse.equinox.jetty6 project
none
org.eclipse.equinox.jetty6.http project none

Description Simon Kaegi CLA 2006-03-20 11:05:52 EST
The current HttpService will compile against Servlet 2.4 but for the most part doesn't really implement functionality past Servlet 2.1 and will throw unsupported exceptions. This causes integration problems as many existing servlets require at least 2.3 support in order to operate.

We should look at upgrading our support of the Servlet API to at least 2.3, but preferably 2.4 for those elements exposed in the HttpService.
Comment 1 Simon Kaegi CLA 2006-03-26 01:07:35 EST
Created attachment 36944 [details]
Jetty based Http Service project archive

Here's a stand-alone Jetty Based Sevlet 2.4 Http Service.
It doesn't support Https right now but is otherwise fully functional and as far as I know spec complete.

The packaging is mainly illustrative as what I've done here is simply re-used the servlet bridge ProxyServlet. e.g. different Activator and dependencies but otherwise same code.

Some re-packaging would be needed here but I think it might be a good idea if we could share the same code in both of the HttpService implementations. Mapping a servlet container to the HttpService is tricky.

Also, the bundle's size is "much" larger than it needs to be as a bunch of stuff we won't need is packaged for now.

Any comments?
Comment 2 Simon Kaegi CLA 2006-03-26 16:38:54 EST
Created attachment 36961 [details]
same as last but with SSL support

Adding basic (but configurable) SSL support
Comment 3 Simon Kaegi CLA 2006-03-27 17:03:37 EST
Created attachment 37025 [details]
org.eclipse.equinox.http.proxy project

This project holds the ProxyServlet code and all of it's underlying implementation.

The idea is that a servlet container implementation registers an instance of the ProxyServlet (in its container) and then advertises it as a service.
All this bundle does is listen for ProxyServlets in the service registry and then uses them to create OSGi HttpService instances. Take a look at the Activator.

This decouples the OSGi Http Service implementation from the servlet container. It also makes it trivial to use existing servlet containers to provide an OSGi HttpService. I'll add some examples.
Comment 4 Simon Kaegi CLA 2006-03-27 17:10:37 EST
Created attachment 37026 [details]
org.eclipse.equinox.http.jetty

Using Jetty as the underlying servlet container. Other than the Jetty implementation jars (in /lib) this consists of just the Activator - e.g. integrated with approx. 100 lines of code.

Note: this is using Jetty 5 which is a servlet 2.4 container.
(You might get the patch Servlet 2.4 API bundle patch from bug 130561)
Comment 5 Simon Kaegi CLA 2006-03-27 17:16:49 EST
Created attachment 37028 [details]
org.eclipse.equinox.servlet.bridge.http

A bit of a special case, but the servlet bridge can be integrated in about 10 lines of code. I'm more just trying to demonstrate the possibility of using the same code-base here.
Comment 6 Simon Kaegi CLA 2006-03-28 15:21:24 EST
Created attachment 37136 [details]
update org.eclipse.equinox.http.jetty

Cleanup...
Removed org.mortbay.jmx.jar to cut down size
Setting context work area to use the osgi provided area
Changed the boolean parse to let us use ee.minimum
Comment 7 Jeff McAffer CLA 2006-03-29 22:40:11 EST
To move forward we need contributeion questionnaires or all the new bits (Jetty, commons logging, servlet 2.4 api).  Simon has agreed to do that.
Comment 8 Simon Kaegi CLA 2006-04-02 23:05:32 EDT
Created attachment 37480 [details]
org.eclipse.equinox.jetty.http

This project is all that's needed now for trying this out. 
It uses the functionality provided in org.eclipse.equinox.servlet.bridge.http from HEAD directly.

So at a minimum you'll need the following bundles:
org.eclipse.osgi
org.eclipse.osgi.service
org.eclipse.jetty.http
org.eclipse.servlet.api [with 2.4 support]
org.eclipse.servlet.bridge.http
Comment 9 Thomas Watson CLA 2006-04-08 13:11:40 EDT
Moving out of NEW inbox.  This enhancement is not suggested for 3.2, right?  IMO it is too late for that.
Comment 10 Simon Kaegi CLA 2006-04-08 15:40:48 EDT
Hi Tom,
I wish it was for 3.2 however there are a lot of dependencies.
1) We need to upgrade the Servlet API bundle to 2.4
2) The servlet bridge has to be promoted out of the incubator
3) We have to get the legal ok for the new 3rd party jars

...perhaps a better way is to start it in the incubator and promote it from there?
Comment 11 Patrick Mueller CLA 2006-05-02 09:33:25 EDT
Just peeked at the plugin attachment dated 2006-04-02.  

Yay!  (I'm a jetty fan-boy.)  Glad to see it brought into the fold.  However, I wonder about the current bundling.

We're also currently using Jetty, but we've bundled the mortbay code as a separate bundle; just the mortbay code.  The commons.logging and commons.codec bits are likewise separate bundles.

Seems like that shipping separate bundles is a more flexible way to do this, especially if there are other folks who'd like to take advantage of jetty (or even commons.logging).  It would be a real shame, and complicated/impossible to boot, if the jetty code ends up shipping this way, and then we have to ship yet another version of it.
Comment 12 Simon Kaegi CLA 2006-05-02 09:52:02 EDT
Hi Patrick,
Yep. Separate bundles is the plan.
The current packaging is more illustrative and once we have sign-off we can take a closer look at packaging.



Comment 13 Jeff McAffer CLA 2006-05-02 22:57:38 EDT
yes.  and feel free to contribute your metadata for the bundles.  This might save some time.
Comment 14 Simon Kaegi CLA 2006-06-16 17:15:31 EDT
Created attachment 44689 [details]
org.eclipse.equinox.jetty project

This is the project for a binary bundle containing just the  org.mortbay.* classes and no custom code.
Comment 15 Simon Kaegi CLA 2006-06-16 17:19:24 EDT
Created attachment 44690 [details]
org.eclipse.equinox.jetty.http project

This project contains just the Activator that uses code from servlet.bridge.http to create an embedded Http Service based on Jetty (5.1.11).
Comment 16 Simon Kaegi CLA 2006-06-26 14:26:36 EDT
Created attachment 45314 [details]
org.eclipse.equinox.jetty.http project

The previous version was lazy and would not start the HttpService until there was an incoming request. Updated so that the HttpService is activated immediately.
Comment 17 Simon Kaegi CLA 2006-08-25 15:13:36 EDT
Created attachment 48764 [details]
org.eclipse.equinox.jetty6 project

Quick update...
We're still waiting for approval for Jetty 5.1.11 (I've heard it just needs to be voted on at the next meeting). 
--
Jetty 6 is planning on releasing soon. Here's a very quick integration with Jetty 6rc2. We might look to do more with this version once it's been formally released. (Note: requires Java 1.4)
Comment 18 Simon Kaegi CLA 2006-08-25 15:14:47 EDT
Created attachment 48765 [details]
org.eclipse.equinox.jetty6.http project
Comment 19 Jeff McAffer CLA 2006-10-07 19:32:36 EDT
are you going to go for approavle on Jetty 6?  
Comment 20 Simon Kaegi CLA 2006-10-10 11:05:36 EDT
Yes. I'll start working on it as well as it's dependencies (Servlet 2.5 and SLF4J)

Jetty 6 was released not quite a month ago so I'd suggest we wait for a few minor releases and then do some testing first before settling on a particular version. Still we can start the ipzilla ball rolling...

The integration work can be done in the incubator once the various dependencies are sorted out.
Comment 21 Simon Kaegi CLA 2006-10-15 17:46:50 EDT
I think this can be closed now.
The Jetty (v5.1.11) based HttpService is graduated and available in the main eclipse and tools/Orbit depots.

The relevant projects are:
(Eclipse)
- org.eclipse.equinox.http.jetty
- org.eclipse.equinox.http.servlet

(Tools)
- org.eclipse.orbit/javax.servlet (v2_4)
- org.eclipse.orbit/org.mortbay.jetty (v5_1_11)
- org.eclipse.orbit/org.apache.common.logging (v1_0_4)

--

I'll go ahead with getting Jetty 6 approval and we can continue that work in the incubator.
Comment 22 Arun CLA 2007-03-07 11:46:20 EST
Guys ,I tried using the HTTPService to run my 2.4 servlets but that didnt help. But the registration there to start the HttpService was simple. Now it looks like using Jetty is the only way to run servlets with 2.4 spcification. But I dont know how to create a HTTP Service with Jetty that listens on a port and register a servlet similar to the HTTP Service. I urgently need this. Please help !!
Please mail me at arunbhatj@gmail.com
Comment 23 Simon Kaegi CLA 2007-03-07 17:44:45 EST
Full support for this is provide with the Jetty based implementation.
Take a look at the sections where Jetty is mentioned at http://www.eclipse.org/equinox/server/http_in_equinox.php

If you need further help you should use the equinox newsgroup.