Skip to main content

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

Use a HandlerCollection or HandlerList

HandlerList handlers = new HandlerList();
handlers.addHandler(new MovedContextHandler());
handlers.addHandler(gzip);
server.setHandler(handlers);



Joakim Erdfelt / joakim@xxxxxxxxxxx

On Tue, Feb 21, 2017 at 2:19 PM, Brandon Mintern <mintern@xxxxxxxxxxx> wrote:
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.

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top