Class AllowedMethodsHandler

  • All Implemented Interfaces:
    HttpHandler

    public class AllowedMethodsHandler
    extends java.lang.Object
    implements HttpHandler
    Handler that whitelists certain HTTP methods. Only requests with a method in the allowed methods set will be allowed to continue.
    Author:
    Stuart Douglas
    • Constructor Detail

      • AllowedMethodsHandler

        public AllowedMethodsHandler​(HttpHandler next,
                                     java.util.Set<HttpString> allowedMethods)
      • AllowedMethodsHandler

        public AllowedMethodsHandler​(HttpHandler next,
                                     HttpString... allowedMethods)
    • Method Detail

      • handleRequest

        public void handleRequest​(HttpServerExchange exchange)
                           throws java.lang.Exception
        Description copied from interface: HttpHandler
        Handle the request.
        Specified by:
        handleRequest in interface HttpHandler
        Parameters:
        exchange - the HTTP request/response exchange
        Throws:
        java.lang.Exception
      • getAllowedMethods

        public java.util.Set<HttpString> getAllowedMethods()