Package 

Class Router

  • All Implemented Interfaces:

    
    public final class Router
    
                        

    Creates and initializes a Router based on a code block.

    • Constructor Detail

      • Router

        Router(Function1<Router, Unit> block)
        Parameters:
        block - Router's setup block.
    • Method Detail

      • before

         final Unit before(String path, Function1<Call, Unit> block)

        Registers FilterHandler with BEFORE for given route path.

        Parameters:
        path - Route path for which the handler is to be registered.
        block - RouteCallback instance to be executed by the handler.
      • after

         final Unit after(String path, Function1<Call, Unit> block)

        Registers FilterHandler with AFTER for given route path.

        Parameters:
        path - Route path for which the handler is to be registered.
        block - RouteCallback instance to be executed by the handler.
      • get

         final Unit get(String path, Function1<Call, Unit> block)

        Creates GET route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • get

         final Unit get(String path, URL resource)

        Registers ResourceHandler for given resource URL at given route path.

        Parameters:
        path - Route path for which the handler is to be registered.
        resource - The URL for which the handler is to be registered.
      • get

         final Unit get(File file)

        Registers FileHandler for given file URL for any route.

        Parameters:
        file - The File for which handler is to be registered.
      • get

         final Unit get(String path, File file)

        Registers FileHandler for given file at given route path.

        Parameters:
        path - Route path for which the handler is to be registered.
        file - The File for which the handler is to be registered.
      • head

         final Unit head(String path, Function1<Call, Unit> block)

        Creates HEAD route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • post

         final Unit post(String path, Function1<Call, Unit> block)

        Creates POST route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • put

         final Unit put(String path, Function1<Call, Unit> block)

        Creates PUT route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • delete

         final Unit delete(String path, Function1<Call, Unit> block)

        Creates DELETE route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • trace

         final Unit trace(String path, Function1<Call, Unit> block)

        Creates TRACE route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • options

         final Unit options(String path, Function1<Call, Unit> block)

        Creates OPTIONS route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • patch

         final Unit patch(String path, Function1<Call, Unit> block)

        Creates PATH route with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be handled.
      • any

         final Unit any(String path, Function1<Call, Unit> block)

        Creates a route for a filter (with all methods) with given RouteCallback to be handled.

        Parameters:
        path - Route path of the request.
        block - A RouteCallback instance to be executed.
      • error

         final Unit error(Integer code, Function2<Call, CodedException, Unit> block)

        Registers handler for routes halted with specified code.

        Parameters:
        code - Status code.
        block - Callback to be executed by the handler.
      • path

         final Unit path(Path path, Router router)

        Registers PathHandler for given route path.

        Parameters:
        path - Route path for which the callback is to be registered.
        router - Nested Router handler.