Yes, I am using a ServletConextHandler, however the question is : can you do the equivalent of HandlerList but with Servlets. AFAIK it is impossible to register different Servlets using the same Context path
Tx K > On 13 Dec 2019, at 11:33, Joakim Erdfelt <[email protected]> wrote: > > Use a ServletContextHandler. > > Don't use ServletHandlers, those are internal structures not meant for direct > usage. > > Use ServletContextHandler.addServlet() and ServletContextHandler.addFilter() > You can add the Servlet as a Class reference, or as a Servlet instances (via > a ServletHolder). > > Joakim Erdfelt / [email protected] <mailto:[email protected]> > > On Fri, Dec 13, 2019 at 2:36 AM Karel Goderis <[email protected] > <mailto:[email protected]>> wrote: > Hi, > > I have the practical need of splitting up a protocol implementation in 3 > “parts”, because the protocol does a kind of “staged” setup whereby a > connection goes through these steps in order. I also need the benefits of > Contexts to maintain some state. Ideally, I would like to have the equivalent > of a HandlerList but for Servlets being added to a ServletContextHandler. How > could this be achieved? > > Wrt to this question, I am confused about the > ServletHolder.setServletHandler(). What is its purpose? Does it replace the > handle() methods of the Servlet.class that is fed to the ServletHolder? > Obviously, I tried to use setServletHandler() with a HandlerList, but that > does not work. It is a bit lacking in the documentation and examples of how > to used embedded Jetty. > > My first attempt was something along the lines of > > HandlerList setupHandlers = new HandlerList(); > setupHandlers.addHandler(new StageOneHandler()); > setupHandlers.addHandler(new StageTwoHandler()); > setupHandlers.addHandler(new StageThreeHandler()); > > ServletHandler setupHandler = new ServletHandler(); > setupHandler.setHandler(setupHandlers); > > ServletHolder setupHolder = new ServletHolder(DefaultServlet.class); > pairSetupHolder.setServletHandler(setupHandler); > > But I clearly missed something from an architecture point of view > > The (IMO) ugly workaround is to put the 3 stages in a regular Servlet, and do > an if-then based on some bytes of the protocol payload, but I prefer the more > beautiful solution ;-) Any help is welcome > > Thanks > Karel > _______________________________________________ > jetty-users mailing list > [email protected] <mailto:[email protected]> > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://www.eclipse.org/mailman/listinfo/jetty-users > <https://www.eclipse.org/mailman/listinfo/jetty-users>_______________________________________________ > jetty-users mailing list > [email protected] > To change your delivery options, retrieve your password, or unsubscribe from > this list, visit > https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
