tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob DeRemer <bob.dere...@thingworx.com>
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 20:35:41 GMT


> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org]
> Sent: Friday, August 23, 2013 8:40 AM
> 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 23/08/2013 13:28, Bob DeRemer wrote:
> >
> >
> >> -----Original Message-----
> >> From: Mark Thomas [mailto:markt@apache.org]
> >> Sent: Friday, August 23, 2013 8:14 AM
> >> 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 22/08/2013 19:32, Bob DeRemer wrote:
> >>> I'm in the process of developing a configurable server application
> >>> which must handle various protocols, but the respective endpoints
> >>> must be configurable.  Specifically, I would like to
> >>> programmatically add both HTTP servlet(s) as well as WebSocket
> >>> Servlets/Endpoints during the contextInitialized call [based on our
> >>> own configuration settings], as opposed to having all servlets in
> >>> web.xml or annotated classes loaded automatically.
> >>>
> >>> Is this possible in Tomcat 7; and, if yes, are there any examples?
> >>> I know the Endpoint aspect of the question depends on JSR-356 being
> >>> back-ported.
> >>
> >> Yes, it is possible.
> >>
> >> There are some examples in the unit tests:
> >>
> >> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/co
> >> re/Test
> >> StandardContext.java?view=annotate
> >>
> >> Look for calls to addServlet(...)
> >
> > Great!  So, how do I tell Tomcat NOT to load anything in the first place?
> 
> Exclude the JARs containing the Servlets with an absolute-ordering in web.xml
> 
> >  Can I still use Annotation on my servlets, or will I have to use an interface-
> based approach?
> 
> I don't believe @WebServlet has any effect when adding Servlets via
> addServlet()
> 
> > Also, how about for the JSR-356 Endpoints?  Is there an addEndpoint(...) call?
> 
> Yes on ServerContainer, as long as you do it before any of them are used.
> 
Just getting around to trying this - maybe a stupid question, but how do I get access to the
WsServerContainer instance?  

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


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


Mime
View raw message