Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Jetty servlet filter bundle?
Jetty servlet filter bundle? [message #78063] Tue, 28 November 2006 18:46 Go to next message
Wouter de Vaal is currently offline Wouter de VaalFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

I'm thinking of writing my own Jetty bundle which supports Filters and
listeners, as I will be using an application which uses only these
things to serve the content and the plugin given with server side
equinox does not support this.

Will it be enough to just start jetty within the bundle activator and
register the filter and the listener, with maybe a wrapper around it to
let it handle requests with the right context loader, as is done within
the equinox jetty bundle?

Also, what is the added value for the org.equinox.http.servlet bundle? I
get the feeling it is only there to facilitate coupling to the osgi http
service. Am I right?

Regards,
Wouter
Re: Jetty servlet filter bundle? [message #78109 is a reply to message #78063] Tue, 28 November 2006 20:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simon.kaegi.cognos.com

Hi Wouter,

That sounds right.
You can create an activator that starts a Jetty server similar to http.jetty
(or alternately create a factory method that some outside code can use to
start Jetty) and then directly register servlets and filters as you see fit.
One thing to be careful about is that the classloader associated with the
Jetty HttpContext must have visibility of Servlets and Filters you register.
Also, you might also have a bit of work setting up your context paths to
expose public and private resources.

It sounds like org.eclipse.equinox.http.servlet is not needed in your
situation as it is used to register an OSGi HttpService and I think you're
just trying to register directly against Jetty. Still, for what you're doing
you might find there's some logic worth re-using inside that bundle.

HTH
-Simon


"Wouter de Vaal" <wouter_de_vaal@hotmail.com> wrote in message
news:eki06p$gnn$1@utils.eclipse.org...
> Hi,
>
> I'm thinking of writing my own Jetty bundle which supports Filters and
> listeners, as I will be using an application which uses only these things
> to serve the content and the plugin given with server side equinox does
> not support this.
>
> Will it be enough to just start jetty within the bundle activator and
> register the filter and the listener, with maybe a wrapper around it to
> let it handle requests with the right context loader, as is done within
> the equinox jetty bundle?
>
> Also, what is the added value for the org.equinox.http.servlet bundle? I
> get the feeling it is only there to facilitate coupling to the osgi http
> service. Am I right?
>
> Regards,
> Wouter
Re: Jetty servlet filter bundle? [message #78126 is a reply to message #78109] Tue, 28 November 2006 20:35 Go to previous messageGo to next message
Wouter de Vaal is currently offline Wouter de VaalFriend
Messages: 19
Registered: July 2009
Junior Member
Hi Simon,

Thank you for your quick reply, a few questions on your comments.

"Jetty HttpContext must have visibility of Servlets and Filters you
register."

What do you mean by this?
Actually I am using the Server class, as there seems to be no more http
package in jetty 6 (equinox was coded against 5).

"Also, you might also have a bit of work setting up your context paths
to expose public and private resources."

Any pointers where to look for solution on this issue?

Thanx,
Wouter

Simon Kaegi wrote:
> Hi Wouter,
>
> That sounds right.
> You can create an activator that starts a Jetty server similar to http.jetty
> (or alternately create a factory method that some outside code can use to
> start Jetty) and then directly register servlets and filters as you see fit.
> One thing to be careful about is that the classloader associated with the
> Jetty HttpContext must have visibility of Servlets and Filters you register.
> Also, you might also have a bit of work setting up your context paths to
> expose public and private resources.
>
> It sounds like org.eclipse.equinox.http.servlet is not needed in your
> situation as it is used to register an OSGi HttpService and I think you're
> just trying to register directly against Jetty. Still, for what you're doing
> you might find there's some logic worth re-using inside that bundle.
>
> HTH
> -Simon
>
>
> "Wouter de Vaal" <wouter_de_vaal@hotmail.com> wrote in message
> news:eki06p$gnn$1@utils.eclipse.org...
>> Hi,
>>
>> I'm thinking of writing my own Jetty bundle which supports Filters and
>> listeners, as I will be using an application which uses only these things
>> to serve the content and the plugin given with server side equinox does
>> not support this.
>>
>> Will it be enough to just start jetty within the bundle activator and
>> register the filter and the listener, with maybe a wrapper around it to
>> let it handle requests with the right context loader, as is done within
>> the equinox jetty bundle?
>>
>> Also, what is the added value for the org.equinox.http.servlet bundle? I
>> get the feeling it is only there to facilitate coupling to the osgi http
>> service. Am I right?
>>
>> Regards,
>> Wouter
>
>
Re: Jetty servlet filter bundle? [message #78141 is a reply to message #78126] Tue, 28 November 2006 22:01 Go to previous message
Eclipse UserFriend
Originally posted by: simon.kaegi.cognos.com

> "Jetty HttpContext must have visibility of Servlets and Filters you
> register."
>
> What do you mean by this?
> Actually I am using the Server class, as there seems to be no more http
> package in jetty 6 (equinox was coded against 5).
It's less of a concern in Jetty6. As I recall you can directly register an
instance instead of the Servler/Filter/Listener instead of just the class
name. In Jetty 6 I think you might also be able to get away without doing
anything too fancy with the thread context class loader.

>
> "Also, you might also have a bit of work setting up your context paths to
> expose public and private resources."
>
> Any pointers where to look for solution on this issue?
Take a look here - http://docs.codehaus.org/display/JETTY/Embedding+Jetty
I was referring to setting up and adding your Resources correctly.
At a glance adding accesible resources is covered, but I didn't spot an
example of setting up resources accessible from
ServletContext.getResource(..). If you can get away with it using a
WebApplicationContext might be the easiest route if you need ServletContext
resources.
-Simon
>
> Thanx,
> Wouter
>
> Simon Kaegi wrote:
>> Hi Wouter,
>>
>> That sounds right.
>> You can create an activator that starts a Jetty server similar to
>> http.jetty (or alternately create a factory method that some outside code
>> can use to start Jetty) and then directly register servlets and filters
>> as you see fit. One thing to be careful about is that the classloader
>> associated with the Jetty HttpContext must have visibility of Servlets
>> and Filters you register. Also, you might also have a bit of work setting
>> up your context paths to expose public and private resources.
>>
>> It sounds like org.eclipse.equinox.http.servlet is not needed in your
>> situation as it is used to register an OSGi HttpService and I think
>> you're just trying to register directly against Jetty. Still, for what
>> you're doing you might find there's some logic worth re-using inside that
>> bundle.
>>
>> HTH
>> -Simon
>>
>>
>> "Wouter de Vaal" <wouter_de_vaal@hotmail.com> wrote in message
>> news:eki06p$gnn$1@utils.eclipse.org...
>>> Hi,
>>>
>>> I'm thinking of writing my own Jetty bundle which supports Filters and
>>> listeners, as I will be using an application which uses only these
>>> things to serve the content and the plugin given with server side
>>> equinox does not support this.
>>>
>>> Will it be enough to just start jetty within the bundle activator and
>>> register the filter and the listener, with maybe a wrapper around it to
>>> let it handle requests with the right context loader, as is done within
>>> the equinox jetty bundle?
>>>
>>> Also, what is the added value for the org.equinox.http.servlet bundle? I
>>> get the feeling it is only there to facilitate coupling to the osgi http
>>> service. Am I right?
>>>
>>> Regards,
>>> Wouter
>>
Previous Topic:equinox in a web application in and outside of an rcp application
Next Topic:ExtensionPoint or RegisterService?
Goto Forum:
  


Current Time: Fri Apr 26 05:34:29 GMT 2024

Powered by FUDForum. Page generated in 0.02674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top