Interface WebRoute<A extends ExchangeContext>

Type Parameters:
A - the type of the exchange context
All Superinterfaces:
AcceptAware, ContentAware, InterceptableRoute<A,WebExchange<A>>, MethodAware, PathAware, Route<A,WebExchange<A>>
All Known Subinterfaces:
WebSocketRoute<A>

public interface WebRoute<A extends ExchangeContext> extends InterceptableRoute<A,WebExchange<A>>, PathAware, MethodAware, ContentAware, AcceptAware

A web route specifies criteria used to determine the web exchange handler to execute to handle a request.

It basically supports the following criteria:

  • the path to the resource which can be parameterized as defined by URIBuilder.
  • the HTTP method used to access the resource
  • the media range defining the content types accepted by the resource as defined by RFC 7231 Section 5.3.2.
  • the content type of the resource
  • the language tag of the resource

The path to the resource can be either static or dynamic if a parameterized path is specified as defined by URIBuilder. When defined with a parameterized path, a router can extract path parameters from the URIMatcher that matches the request. For instance, path /books/{id} defines path parameter id and matches paths: /books/1, /books/2...

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Method Details

    • getPath

      String getPath()

      Returns the static normalized absolute path to the resource served by the route.

      This criteria should exactly match the absolute path of the request.

      Specified by:
      getPath in interface PathAware
      Returns:
      an absolute normalized path or null
    • getPathPattern

      URIPattern getPathPattern()

      Returns the URI pattern that matches all the paths to the resource served by the route.

      This criteria should match the absolute path of the request.

      Specified by:
      getPathPattern in interface PathAware
      Returns:
      a URI pattern or null
    • getMethod

      Method getMethod()

      Returns the HTTP method accepted by the resource served by the route.

      This criteria should match the request HTTP method.

      Specified by:
      getMethod in interface MethodAware
      Returns:
      a HTTP method or null
    • getConsume

      String getConsume()

      Returns the media range defining the content types accepted by the resource served by the route as defined by RFC 7231 Section 5.3.2.

      This criteria should match the request content-type header field.

      Specified by:
      getConsume in interface ContentAware
      Returns:
      a media range or null
    • getProduce

      String getProduce()

      Returns the media type of the resource served by the route.

      This criteria should match the request accept header field.

      Specified by:
      getProduce in interface AcceptAware
      Returns:
      a media type or null
    • getLanguage

      String getLanguage()

      Returns the language of the resource served by the route.

      This criteria should match the request accept-language header field.

      Specified by:
      getLanguage in interface AcceptAware
      Returns:
      a language tag or null