org.vertx.java.core.http

## Class RouteMatcher

- java.lang.Object
- - org.vertx.java.core.http.RouteMatcher

- All Implemented Interfaces:
    Handler<HttpServerRequest>

      public class RouteMatcher
      extends java.lang.Object
      implements Handler<HttpServerRequest>

  This class allows you to do route requests based on the HTTP verb and the request URI, in a manner similar to Sinatra or Express.

  RouteMatcher also lets you extract paramaters from the request URI either a simple pattern or using regular expressions for more complex matches. Any parameters extracted will be added to the requests parameters which will be available to you in your request handler.

  It's particularly useful when writing REST-ful web applications.

  To use a simple pattern to extract parameters simply prefix the parameter name in the pattern with a ':' (colon).

  Different handlers can be specified for each of the HTTP verbs, GET, POST, PUT, DELETE etc.

  For more complex matches regular expressions can be used in the pattern. When regular expressions are used, the extracted parameters do not have a name, so they are put into the HTTP request with names of param0, param1, param2 etc.

  Multiple matches can be specified for each HTTP verb. In the case there are more than one matching patterns for a particular request, the first matching one will be used.

  Instances of this class are not thread-safe

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RouteMatcher()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `all(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for all HTTP methods
    `void` | `allWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for all HTTP methods
    `void` | `connect(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP CONNECT
    `void` | `connectWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP CONNECT
    `void` | `delete(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP DELETE
    `void` | `deleteWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP DELETE
    `void` | `get(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP GET
    `void` | `getWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP GET
    `void` | `handle(HttpServerRequest request)` Something has happened, so handle it.
    `void` | `head(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP HEAD
    `void` | `headWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP HEAD
    `void` | `noMatch(Handler<HttpServerRequest> handler)` Specify a handler that will be called when no other handlers match.
    `void` | `options(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP OPTIONS
    `void` | `optionsWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP OPTIONS
    `void` | `patch(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP PATCH
    `void` | `patchWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP PATCH
    `void` | `post(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP POST
    `void` | `postWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP POST
    `void` | `put(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP PUT
    `void` | `putWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP PUT
    `void` | `trace(java.lang.String pattern, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP TRACE
    `void` | `traceWithRegEx(java.lang.String regex, Handler<HttpServerRequest> handler)` Specify a handler that will be called for a matching HTTP TRACE

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RouteMatcher

          public RouteMatcher()

  - ### Method Detail

    - #### handle

          public void handle(HttpServerRequest request)

      Description copied from interface: `Handler`
      Something has happened, so handle it.
      Specified by:
        `handle` in interface `Handler<HttpServerRequest>`

    - #### get

          public void get(java.lang.String pattern,
                 Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP GET
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### put

          public void put(java.lang.String pattern,
                 Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP PUT
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### post

          public void post(java.lang.String pattern,
                  Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP POST
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### delete

          public void delete(java.lang.String pattern,
                    Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP DELETE
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### options

          public void options(java.lang.String pattern,
                     Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP OPTIONS
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### head

          public void head(java.lang.String pattern,
                  Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP HEAD
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### trace

          public void trace(java.lang.String pattern,
                   Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP TRACE
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### connect

          public void connect(java.lang.String pattern,
                     Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP CONNECT
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### patch

          public void patch(java.lang.String pattern,
                   Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP PATCH
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### all

          public void all(java.lang.String pattern,
                 Handler<HttpServerRequest> handler)

      Specify a handler that will be called for all HTTP methods
      Parameters:
        `pattern` - The simple pattern
        `handler` - The handler to call

    - #### getWithRegEx

          public void getWithRegEx(java.lang.String regex,
                          Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP GET
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### putWithRegEx

          public void putWithRegEx(java.lang.String regex,
                          Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP PUT
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### postWithRegEx

          public void postWithRegEx(java.lang.String regex,
                           Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP POST
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### deleteWithRegEx

          public void deleteWithRegEx(java.lang.String regex,
                             Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP DELETE
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### optionsWithRegEx

          public void optionsWithRegEx(java.lang.String regex,
                              Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP OPTIONS
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### headWithRegEx

          public void headWithRegEx(java.lang.String regex,
                           Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP HEAD
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### traceWithRegEx

          public void traceWithRegEx(java.lang.String regex,
                            Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP TRACE
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### connectWithRegEx

          public void connectWithRegEx(java.lang.String regex,
                              Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP CONNECT
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### patchWithRegEx

          public void patchWithRegEx(java.lang.String regex,
                            Handler<HttpServerRequest> handler)

      Specify a handler that will be called for a matching HTTP PATCH
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### allWithRegEx

          public void allWithRegEx(java.lang.String regex,
                          Handler<HttpServerRequest> handler)

      Specify a handler that will be called for all HTTP methods
      Parameters:
        `regex` - A regular expression
        `handler` - The handler to call

    - #### noMatch

          public void noMatch(Handler<HttpServerRequest> handler)

      Specify a handler that will be called when no other handlers match. If this handler is not specified default behaviour is to return a 404
      Parameters:
        `handler` -