A lot of this can be explained by looking at the embedded examples.
Ok ...
ServletContextHandler is your "web application"
SessionHandler is part of the ServletContextHandler, its kinda special, its for the "web application" to use.
See ServletContextHandler.setSessionHandler()
The DefaultHandler, GzipHandler, RequestLogHandler, and StatisticsHandler are part of the server side.
GzipHandler and StatisticsHandler are HandlerWrappers, you want to wrap them around what you are interested in.
RequestLogHandler is also a HandlerWrapper, but it can operate without wrapping another Handler (this mode means that it operates on all behaviors after it in the Handler tree)
You can use HandlerCollection, or HandlerList for this.
(ContextHandlerCollection is to group together multiple ServletContextHandler or WebAppContext branches).
Your eventual tree might look like this ...
- StatisticsHandler (for all requests)
- HandlerList
- RequestLogHandler
- GzipHandler (only for ServletContext)
- ServletContextHandler
- SessionHandler
- Servlets
- Filters
- etc..
- DefaultHandler (always last!)
Hope this helps ...