java - How to Limit ServletListener to a Single Context? -
i have jsr-356 websocket application. use listeners initialize it, don't need rely on jar scanning annotations slows down startup.
for example, use servletcontextlistener
implementation register websocket's endpoint
:
@override public void contextinitialized(servletcontextevent sce) { servercontainer servercontainer = (servercontainer) sce .getservletcontext() .getattribute("javax.websocket.server.servercontainer"); servercontainer.addendpoint(myendpoint.class); }
and register listener in web.xml deployment descriptor:
<listener> <listener-class>my.servletcontextlistenerimpl</listener-class> </listener>
the problem endpoint registered of web contexts, not want.
how can limit listener specific contexts? or set "init params" on listener via configuration can inspect in servletcontextlistener , register endpoint if matches init param?
each webapp own servletcontext
, wouldn't possible have single servlet listener respond multiple webapp contexts that.
something else going on in situation.
Comments
Post a Comment