Jetty Logo
Version: 9.4.26-SNAPSHOT
Contact the core Jetty developers at

private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development

Default Handler




A simple handler that is useful to terminate handler chains with a clean fashion. As in the example below, if a resource to be served is not matched within the resource handler the DefaultHandler will take care of producing a 404 page. This class is a useful template to either extend and embrace or simply provide a similar implementation for customizing to your needs. There is also an Error Handler that services errors related to the servlet api specification, so it is best to not get the two confused.


The DefaultHandler will also handle serving out the flav.ico file should a request make it through all of the other handlers without being resolved.

    Server server = new Server(8080);
    HandlerList handlers = new HandlerList();
    ResourceHandler resourceHandler = new ResourceHandler();
    handlers.setHandlers(new Handler[]
    { resourceHandler, new DefaultHandler() });

See an error or something missing? Contribute to this documentation at Github!(Generated: 2020-01-17)