Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Programmatic MovedContextHandler

I'm using embedded Jetty with a WebAppContext. I now need to add a MovedContextHandler, but I'm not sure where it fits in the server/servlet/context stack. Our code currently looks roughly like this:

Server server = new Server();
...
WebAppContext webapp = new WebAppContext();
...
GzipHandler gzip = new GzipHandler();
...
gzip.setHandler(webapp);
server.setHandler(gzip);
WebSocketServerContainerInitializer.configureContext(webapp);
...
server.start();
server.join();


So far I've tried:

(1) new MovedContextHandler(webapp/server, ...);

This solution doesn't work because it calls setHandler on the webapp/server, removing the sessionHandler/gzipHandler, respectively.

(2) webapp.insertHandler(new MovedContextHandler());

This doesn't work because movedCtxHandler.getHandler() returns the Redirector, which doesn't implement HandlerWrapper.


So where does MovedContextHandler go in the stack? All of my searches have only led me to XML configuration.

Thanks!
Brandon

p.s. I'm happy to ask on StackOverflow instead if that's the preferred venue for Jetty questions these days.

Back to the top