[jetty-users] Calling different handlers

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jetty-users] Calling different handlers

Amaltas
I have 5 handlers.

ServletContextHandler
IPAccessHandler
RequestLogHandler
GzipHandler
SomeCustomHandler.

Currently I am setting / calling these handlers in the following fashion so that its called in following order: requestLogHandler -> ipAccessHandler -> servletContextHandler -> gzipHandler -> customHandler.

gzipHandler.setHandler(customHanlder);
servletContextHandler.setHandler(gzipHandler);
ipAccessHandler.setHandler(servletContextHandler);
requestLogHandler.setHandler(ipAccessHandler);
server.setHandler(requestLogHandler);


The above works fine, but I am afraid, I might break the order if I keep adding more handlers.


The following doesn't work as expected:

HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] {
    requestLogHandler, ipAccessHandler, servletContextHandler, gzipHandler, customHandler
});

server.setHandler(handlers);

When I see the output, the page is not compressed (gziphandler), the request is not logged etc.



_______________________________________________
jetty-users mailing list
[hidden email]
https://dev.eclipse.org/mailman/listinfo/jetty-users