Class Request.In

All Implemented Interfaces:
Future<Boolean>, Associator, Eligible
Direct Known Subclasses:
Request.In.Connect, Request.In.Delete, Request.In.Get, Request.In.Head, Request.In.Options, Request.In.Post, Request.In.Put, Request.In.Trace
Enclosing class:
Request<R>

public static class Request.In extends Request<Boolean>
The base class for all incoming HTTP requests.

Incoming request flow downstream and are served by the framework.

A result of true indicates that the request has been processed, i.e. a response has been sent or will sent.

  • Constructor Details

  • Method Details

    • effectiveRequestUri

      protected URI effectiveRequestUri(String protocol, HttpRequest request) throws URISyntaxException
      Builds the URI that represents this request.

      The default implementation checks that request URI in the HTTP request is directed at this server as specified in the “Host”-header and adds the protocol, host and port if not specified in the request URI.

      Parameters:
      protocol - the protocol
      request - the request
      Returns:
      the URI
      Throws:
      URISyntaxException - if the request is not acceptable
    • fromHttpRequest

      public static Request.In fromHttpRequest(HttpRequest request, boolean secure, int matchLevels) throws URISyntaxException
      Creates the appropriate derived request event type from a given HttpRequest.
      Parameters:
      request - the HTTP request
      secure - whether the request was received over a secure channel
      matchLevels - the match levels
      Returns:
      the request event
      Throws:
      URISyntaxException
    • setRequestUri

      protected final void setRequestUri(URI uri)
      Sets the request URI.
      Parameters:
      uri - the new request URI
    • requestUri

      public final URI requestUri()
      Returns an absolute URI of the request.

      For incoming requests, the URI is built from the information provided by the decoder.

      Returns:
      the URI
    • httpRequest

      Returns the “raw” request as provided by the HTTP decoder.
      Returns:
      the request
    • defaultCriterion

      The match value consists of the event class and a URI.

      The URI is similar to the request URI but its path elements are shortened as specified in the constructor.

      The match value is used as key in a map that speeds up the lookup of handlers. Having the complete URI in the match value would inflate this map.

      Specified by:
      defaultCriterion in interface Eligible
      Overrides:
      defaultCriterion in class Event<Boolean>
      Returns:
      the object
      See Also:
    • isEligibleFor

      public boolean isEligibleFor(Object value)
      Description copied from class: Event
      Returns true if the criterion is of the same class or a base class of this event’s class.
      Specified by:
      isEligibleFor in interface Eligible
      Overrides:
      isEligibleFor in class Event<Boolean>
      Parameters:
      value - the criterion
      Returns:
      true if this meets the criterion
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Event<Boolean>
    • createMatchValue

      public static Object createMatchValue(Class<?> type, ResourcePattern resource)
      Creates the match value.
      Parameters:
      type - the type
      resource - the resource
      Returns:
      the object