tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: is it possible to dynamically add servlets and websocket endpoints during startup based on our own configuration settings?
Date Tue, 03 Sep 2013 22:01:37 GMT
On 03/09/2013 22:14, Bob DeRemer wrote:
> 
> 
>> -----Original Message----- From: Mark Thomas
>> [mailto:markt@apache.org] Sent: Tuesday, September 03, 2013 4:46
>> PM To: Tomcat Users List Subject: Re: is it possible to dynamically
>> add servlets and websocket endpoints during startup based on our
>> own configuration settings?
>> 
>> On 03/09/2013 21:35, Bob DeRemer wrote:
>> 
>>> Just getting around to trying this - maybe a stupid question, but
>>> how do I get
>> access to the WsServerContainer instance?
>> 
>> From the ServletContext. You want the attribute called 
>> "javax.websocket.server.ServerContainer"
> 
> Thanks, I got the ServerContainer and can now call addEndpoint, but
> it expects the class I pass in to have the @ServerEndpoint
> annotation.   I removed the annotation because Tomcat was ALWAYS
> adding any pojo with that annotation, and my goal is to only add
> ServerEndpoints that I read in from my own configuration.  Is there a
> way to do this?

You want the other addEndpoint method - the one that takes a
ServerEndpointConfig instance. If you look at the source for the
addEndpoint method you are currently using, you'll see an example of how
to build a ServerEndpointConfig instance.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message