Package: io.vertx.groovy.ext.web

## [Groovy] Class Route

- io.vertx.groovy.ext.web.Route

- A route is a holder for a set of criteria which determine whether an HTTP request or failure should be routed to a handler.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `Route (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `Route` | `blockingHandler(io.vertx.core.Handler<RoutingContext> requestHandler)` Like Route.blockingHandler called with ordered = true
    `Route` | `blockingHandler(io.vertx.core.Handler<RoutingContext> requestHandler, boolean ordered)` Specify a blocking request handler for the route.
    `Route` | `consumes(java.lang.String contentType)` Add a content type consumed by this route.
    `Route` | `disable()` Disable this route.
    `Route` | `enable()` Enable this route.
    `Route` | `failureHandler(io.vertx.core.Handler<RoutingContext> failureHandler)` Specify a failure handler for the route.
    `java.lang.Object` | `getDelegate()`
    `java.lang.String` | `getPath()` @return Returns: the path prefix (if any) for this route
    `Route` | `handler(io.vertx.core.Handler<RoutingContext> requestHandler)` Specify a request handler for the route.
    `Route` | `last()` Specify this is the last route for the router.
    `Route` | `method(io.vertx.core.http.HttpMethod method)` Add an HTTP method for this route.
    `Route` | `order(int order)` Specify the order for this route.
    `Route` | `path(java.lang.String path)` Set the path prefix for this route.
    `Route` | `pathRegex(java.lang.String path)` Set the path prefix as a regular expression.
    `Route` | `produces(java.lang.String contentType)` Add a content type produced by this route.
    `Route` | `remove()` Remove this route from the router
    `Route` | `useNormalisedPath(boolean useNormalisedPath)` If true then the normalised request path will be used when routing (e.g. removing duplicate /) Default is true

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### Route(java.lang.Object delegate)

  - ### Method Detail

    - #### Route blockingHandler(io.vertx.core.Handler<RoutingContext> requestHandler)

      Like Route.blockingHandler called with ordered = true

      Returns:
      Parameters:
        requestHandler

    - #### Route blockingHandler(io.vertx.core.Handler<RoutingContext> requestHandler, boolean ordered)

      Specify a blocking request handler for the route. This method works just like Route.handler excepted that it will run the blocking handler on a worker thread so that it won't block the event loop. Note that it's safe to call context.next() from the blocking handler as it will be executed on the event loop context (and not on the worker thread. If the blocking handler is ordered it means that any blocking handlers for the same context are never executed concurrently but always in the order they were called. The default value of ordered is true. If you do not want this behaviour and don't mind if your blocking handlers are executed in parallel you can set ordered to false.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `requestHandler` - the blocking request handler
        `ordered` - if true handlers are executed in sequence, otherwise are run in parallel

    - #### Route consumes(java.lang.String contentType)

      Add a content type consumed by this route. Used for content based routing.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `contentType` - the content type

    - #### Route disable()

      Disable this route. While disabled the router will not route any requests or failures to it.

      Returns:
        a reference to this, so the API can be used fluently

    - #### Route enable()

      Enable this route.

      Returns:
        a reference to this, so the API can be used fluently

    - #### Route failureHandler(io.vertx.core.Handler<RoutingContext> failureHandler)

      Specify a failure handler for the route. The router routes failures to failurehandlers depending on whether the various criteria such as method, path, etc match. There can be only one failure handler for a route. If you set this more than once it will overwrite the previous handler.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `failureHandler` - the request handler

    - #### java.lang.Object getDelegate()

    - #### java.lang.String getPath()

      Returns:
        the path prefix (if any) for this route

    - #### Route handler(io.vertx.core.Handler<RoutingContext> requestHandler)

      Specify a request handler for the route. The router routes requests to handlers depending on whether the various criteria such as method, path, etc match. There can be only one request handler for a route. If you set this more than once it will overwrite the previous handler.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `requestHandler` - the request handler

    - #### Route last()

      Specify this is the last route for the router.

      Returns:
        a reference to this, so the API can be used fluently

    - #### Route method(io.vertx.core.http.HttpMethod method)

      Add an HTTP method for this route. By default a route will match all HTTP methods. If any are specified then the route will only match any of the specified methods

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `method` - the HTTP method to add

    - #### Route order(int order)

      Specify the order for this route. The router tests routes in that order.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `order` - the order

    - #### Route path(java.lang.String path)

      Set the path prefix for this route. If set then this route will only match request URI paths which start with this path prefix. Only a single path or path regex can be set for a route.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `path` - the path prefix

    - #### Route pathRegex(java.lang.String path)

      Set the path prefix as a regular expression. If set then this route will only match request URI paths, the beginning of which match the regex. Only a single path or path regex can be set for a route.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `path` - the path regex

    - #### Route produces(java.lang.String contentType)

      Add a content type produced by this route. Used for content based routing.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `contentType` - the content type

    - #### Route remove()

      Remove this route from the router

      Returns:
        a reference to this, so the API can be used fluently

    - #### Route useNormalisedPath(boolean useNormalisedPath)

      If true then the normalised request path will be used when routing (e.g. removing duplicate /) Default is true

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `useNormalisedPath` - use normalised path for routing?