[jetty-users] Jetty provides HttpService API ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jetty-users] Jetty provides HttpService API ?

Cristiano Gavião
Hi,

OSGi HTTP doesn't give to use the ability to register Filters. So for this I used to work with org.eclipse.equinox.http.servlet.ExtendedHttpService from Equinox to build my embeded webserver application.

But with this API doesn't supply any easy way to register Servlet Listener as the ones that exists in web.xml.

Jetty project has any API for this?

regards

Cristiano



_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty provides HttpService API ?

Hugues Malphettes
Hi Cristiano,

On Thu, Jan 19, 2012 at 3:21 AM, Cristiano Gavião <[hidden email]> wrote:

> Hi,
>
> OSGi HTTP doesn't give to use the ability to register Filters. So for this I
> used to work with org.eclipse.equinox.http.servlet.ExtendedHttpService from
> Equinox to build my embeded webserver application.
>
> But with this API doesn't supply any easy way to register Servlet Listener
> as the ones that exists in web.xml.
>
> Jetty project has any API for this?
We have not been further than hosting the HttpService provided by Equinox.
How about using a web-bundle to get support for the whole servlet spec?
Hugues

>
> regards
>
> Cristiano
>
>
>
> _______________________________________________
> jetty-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty provides HttpService API ?

Cristiano Gavião
Hi Hugues,

Hummm, ok. Thanks for answer.

I would, but first I need to evaluate if a web-bundle gives me all the
flexibility that I have today using a bundle where I can control almost
everything.

Being more specific, could a web-bundle give me the plugability that is
described here: http://www.toedter.com/blog/?p=412  ?

cheers

Cristiano


On 18/01/12 20:44, Hugues Malphettes wrote:

> Hi Cristiano,
>
> On Thu, Jan 19, 2012 at 3:21 AM, Cristiano Gavião<[hidden email]>  wrote:
>> Hi,
>>
>> OSGi HTTP doesn't give to use the ability to register Filters. So for this I
>> used to work with org.eclipse.equinox.http.servlet.ExtendedHttpService from
>> Equinox to build my embeded webserver application.
>>
>> But with this API doesn't supply any easy way to register Servlet Listener
>> as the ones that exists in web.xml.
>>
>> Jetty project has any API for this?
> We have not been further than hosting the HttpService provided by Equinox.
> How about using a web-bundle to get support for the whole servlet spec?
> Hugues
>
>> regards
>>
>> Cristiano
>>
>>
>>
>> _______________________________________________
>> jetty-users mailing list
>> [hidden email]
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
> _______________________________________________
> jetty-users mailing list
> [hidden email]
> https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty provides HttpService API ?

Hugues Malphettes
On Thu, Jan 19, 2012 at 8:09 AM, Cristiano Gavião <[hidden email]> wrote:

> Hi Hugues,
>
> Hummm, ok. Thanks for answer.
>
> I would, but first I need to evaluate if a web-bundle gives me all the
> flexibility that I have today using a bundle where I can control almost
> everything.
>
> Being more specific, could a web-bundle give me the plugability that is
> described here: http://www.toedter.com/blog/?p=412  ?

I understand that what you are after is:
<quote>
Provide Bundles that contribute directly to the web application’s UI
Just starting and stopping bundles should contribute/remove UI
elements and functionality
</quote>
Just like Glassfish Jetty support web-fragments in OSGi and just like
Glassfish this is not dynamic: you would need to restart the webapp to
discover the newly enabled fragments.
There are many ways to tackle the problem you describe and it sounds
like you have a specific implementation in mind.

I would make a dispatcher servlet in a web-bundle or hosted by the HttpService.
Then I would use an OSGi service listener or a BundleListenerr to
register/unregister new contributions onto the dispatcher servlet.

If you want you can extend the HttpServletBridge which is the servlet
that hosts the HttpService.
This is the bundle where we host the
org.eclipse.equinox.http.servlet.HttpServiceServlet
which provides the HttpService:
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-osgi/jetty-osgi-httpservice/contexts/httpservice.xml
When the bundle org.eclipse.jetty.osgi.httpservice is activated the
HttpService becomes available.

You can make a similar bundle or fork this one and extend the HttpService there.
The best would be to convince equinox to adopt your enhancement.

I hope this helps,
Hugues

>
> cheers
>
> Cristiano
>
>
>
> On 18/01/12 20:44, Hugues Malphettes wrote:
>>
>> Hi Cristiano,
>>
>> On Thu, Jan 19, 2012 at 3:21 AM, Cristiano Gavião<[hidden email]>
>>  wrote:
>>>
>>> Hi,
>>>
>>> OSGi HTTP doesn't give to use the ability to register Filters. So for
>>> this I
>>> used to work with org.eclipse.equinox.http.servlet.ExtendedHttpService
>>> from
>>> Equinox to build my embeded webserver application.
>>>
>>> But with this API doesn't supply any easy way to register Servlet
>>> Listener
>>> as the ones that exists in web.xml.
>>>
>>> Jetty project has any API for this?
>>
>> We have not been further than hosting the HttpService provided by Equinox.
>> How about using a web-bundle to get support for the whole servlet spec?
>> Hugues
>>
>>> regards
>>>
>>> Cristiano
>>>
>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> [hidden email]
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>> _______________________________________________
>> jetty-users mailing list
>> [hidden email]
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: [jetty-users] Jetty provides HttpService API ?

Cristiano Gavião
Hey Hugues,

When I heard about web-bundle I just think:  if in the web.xml there is
a listener session and jetty reads it, so probably it should create
those listeners programmatically somehow... :)

My need of a Servlet ContextListener setup was because I'm trying to
integrate apache shiro security in my application and it needs to setup
a filter and a listener. I could extend the vaadin-osgi add-on to use
ExtendedHttpService and setup the filter, but couldn't find a way to
provide a listener...

My knowledge in such subject is not that much, but I think that I figure
out your tip, thanks...

regards,

Cristiano

On 18/01/12 22:06, Hugues Malphettes wrote:

> On Thu, Jan 19, 2012 at 8:09 AM, Cristiano Gavião<[hidden email]>  wrote:
>> Hi Hugues,
>>
>> Hummm, ok. Thanks for answer.
>>
>> I would, but first I need to evaluate if a web-bundle gives me all the
>> flexibility that I have today using a bundle where I can control almost
>> everything.
>>
>> Being more specific, could a web-bundle give me the plugability that is
>> described here: http://www.toedter.com/blog/?p=412  ?
> I understand that what you are after is:
> <quote>
> Provide Bundles that contribute directly to the web application’s UI
> Just starting and stopping bundles should contribute/remove UI
> elements and functionality
> </quote>
> Just like Glassfish Jetty support web-fragments in OSGi and just like
> Glassfish this is not dynamic: you would need to restart the webapp to
> discover the newly enabled fragments.
> There are many ways to tackle the problem you describe and it sounds
> like you have a specific implementation in mind.
>
> I would make a dispatcher servlet in a web-bundle or hosted by the HttpService.
> Then I would use an OSGi service listener or a BundleListenerr to
> register/unregister new contributions onto the dispatcher servlet.
>
> If you want you can extend the HttpServletBridge which is the servlet
> that hosts the HttpService.
> This is the bundle where we host the
> org.eclipse.equinox.http.servlet.HttpServiceServlet
> which provides the HttpService:
> http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-osgi/jetty-osgi-httpservice/contexts/httpservice.xml
> When the bundle org.eclipse.jetty.osgi.httpservice is activated the
> HttpService becomes available.
>
> You can make a similar bundle or fork this one and extend the HttpService there.
> The best would be to convince equinox to adopt your enhancement.
>
> I hope this helps,
> Hugues
>
>> cheers
>>
>> Cristiano
>>
>>
>>
>> On 18/01/12 20:44, Hugues Malphettes wrote:
>>> Hi Cristiano,
>>>
>>> On Thu, Jan 19, 2012 at 3:21 AM, Cristiano Gavião<[hidden email]>
>>>   wrote:
>>>> Hi,
>>>>
>>>> OSGi HTTP doesn't give to use the ability to register Filters. So for
>>>> this I
>>>> used to work with org.eclipse.equinox.http.servlet.ExtendedHttpService
>>>> from
>>>> Equinox to build my embeded webserver application.
>>>>
>>>> But with this API doesn't supply any easy way to register Servlet
>>>> Listener
>>>> as the ones that exists in web.xml.
>>>>
>>>> Jetty project has any API for this?
>>> We have not been further than hosting the HttpService provided by Equinox.
>>> How about using a web-bundle to get support for the whole servlet spec?
>>> Hugues
>>>
>>>> regards
>>>>
>>>> Cristiano
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> jetty-users mailing list
>>>> [hidden email]
>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> [hidden email]
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>

_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users