Class RootHandler

java.lang.Object
dev.katsute.simplehttpserver.handler.PredicateHandler
dev.katsute.simplehttpserver.handler.RootHandler
All Implemented Interfaces:
HttpHandler, SimpleHttpHandler

public class RootHandler extends PredicateHandler
By default, exchanges will look for the closest matching context for their handler, this consequently means that the root index / would catch any requests without a handler instead of returning a code 404.
The RootHandler resolves this issue by only accepting requests to the exact context / and sending the rest to an alternative handler, typically where a 404 page would reside.
Since:
5.0.0
Version:
5.0.0
Author:
Katsute
  • Constructor Details

    • RootHandler

      public RootHandler(HttpHandler index, HttpHandler other)
      Creates a root handler.
      Parameters:
      index - handler to use for context /
      other - handler to use for all other contexts, typically a 404 page
      Since:
      5.0.0
  • Method Details