Igal,

Some more description of exactly what your setup is would be good:  do you
have a bundle that is a traditional war? And the websocket code bundle is
external to the main webapp bundle? What bundle is the "servlet" in? What
does the websocket bundle do? Without knowing more it is difficult to give
a cogent answer.

Assuming you have another bundle that contains a web.xml, you could either
put that listener definition in there (so long as you manually get the
manifest import statements correct on the web bundle to refer to your
websocket bundle); or you could define a context listener in there whose
job it is to register the request listener programmatically - that way
tools like bnd will generate correct manifest import statements for you. I
don't know if you want to be able to selectively enable this listener or
not, or based on what configuration ....

If you provide more info, then maybe I can suggest something else.

cheers
Jan



On 13 July 2017 at 19:21, Igal @ Lucee.org <[email protected]> wrote:

> Hello,
>
> I have a JSR-356 (WebSocket API) code that is packaged in an OSGi bundle.
> The servlet loads the code via Apache Felix if needed.
>
> I want to register a ServletRequestListener, which I would normally put in
> the web descriptor:
>
>   <listener>
>     <listener-class>path.to.my.RequestListener</listener-class>
>   </listener>
>
> but since the bundle is not in the classpath that wouldn't work.
>
> How can I register the ServletRequestListener? I am thinking that maybe
> there would be a way with scanning for annotations but am not sure how to
> set that up. My other concern is that many users disable the scanning to
> improve startup time.
>
> The listener's job is to initialize HttpSession so that I can retrieve the
> ServletContext in the WebSocket handshake. If there's a way to achieve that
> without the listener then that will work for me even better.
>
> Any ideas?  Thanks!
>
> p.s. This is a crosspost with https://stackoverflow.com/
> questions/45083982/register-servletrequestlistener-from-osgi-bundle
>
> Igal Sapir
> Lucee Core Developer
> Lucee.org <http://lucee.org/>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>



-- 
Jan Bartel <[email protected]>
www.webtide.com
*Expert assistance from the creators of Jetty and CometD*
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to