Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Register ServletRequestListener from OSGi Bundle

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


Back to the top