Class HttpFilter

    • Constructor Detail

      • HttpFilter

        public HttpFilter​(int ordinal,
                          HttpMethod method,
                          HttpPattern pattern,
                          HttpFilterHandler handler)
        Creates new HttpService filter.
        ordinal - When to execute the filter relative to other filters. Lower numbers are executed first.
        method - HTTP method to require in filtered requests. Use null to allow any method.
        pattern - HTTP pattern to require filtered request paths to match. Use null to allow any path.
        handler - The handler to execute with matching requests.
    • Method Detail

      • ordinal

        public int ordinal()
        Integer indicating when to execute this filter in relation to other filters that match the same methods and have the exact same patterns.
      • method

        public java.util.Optional<HttpMethod> method()
        Specified by:
        method in interface HttpRoutable
        HttpMethod, if any, that incoming requests must match for this filter to be invoked.
      • pattern

        public java.util.Optional<HttpPattern> pattern()
        Specified by:
        pattern in interface HttpRoutable
        HttpPattern, if any, that paths of incoming requests must match for this filter to be invoked.
      • tryHandle

        public Future<java.lang.Boolean> tryHandle​(HttpRouteTask task)
        Offers this filter the opportunity to respond to the request in the given task. If it does respond, it is assumed that the request needs no more processing and a response is sent to the requester immediately.

        A filter will typically only handle a request if it is invalid.

        task - Incoming HTTP request route task.
        Future completed when filtering is complete. Its value is true only if the request was handled.