Class Router

    • Constructor Detail

      • Router

        public Router()
    • Method Detail

      • init

        public Router init()
        Initial this Router.
        Returns:
        this Router
      • add

        public Router add​(HttpServiceInvoker service,
                          java.lang.String path,
                          io.netty.handler.codec.http.HttpMethod... methods)
        Add a new HTTP route with given parameters.
        Parameters:
        service - an HTTP service
        path - the path pattern of the service
        methods - the array of the allowed HTTP methods
        Returns:
        this Router
      • add

        public Router add​(java.lang.String path,
                          io.netty.handler.codec.http.HttpMethod method,
                          HttpServiceInvoker service)
        Add a new HTTP route with given parameters.
        Parameters:
        path - the path pattern of the service
        method - the HTTP method
        service - an HTTP service
        Returns:
        this Router
      • add

        public Router add​(java.lang.String path,
                          HttpServiceInvoker service)
        Add a new "all method allowed" route with specified path and service.
        Parameters:
        path - the path pattern of the service
        service - an HTTP service
        Returns:
        this Router
      • get

        public Router get​(java.lang.String path,
                          HttpServiceInvoker service)
        Add a new HTTP GET route with specified path and service.
        Parameters:
        path - the path pattern of the service
        service - an HTTP service
        Returns:
        this Router
      • post

        public Router post​(java.lang.String path,
                           HttpServiceInvoker service)
        Add a new HTTP POST route with specified path and service.
        Parameters:
        path - the path pattern of the service
        service - an HTTP service
        Returns:
        this Router
      • put

        public Router put​(java.lang.String path,
                          HttpServiceInvoker service)
        Add a new HTTP PUT route with specified path and service.
        Parameters:
        path - the path pattern of the service
        service - an HTTP service
        Returns:
        this Router
      • patch

        public Router patch​(java.lang.String path,
                            HttpServiceInvoker service)
        Add a new HTTP PATCH route with specified path and service.
        Parameters:
        path - the path pattern of the service
        service - an HTTP service
        Returns:
        this Router
      • delete

        public Router delete​(java.lang.String path,
                             HttpServiceInvoker service)
        Add a new HTTP DELETE route with specified path and service.
        Parameters:
        path - the path pattern of the service
        service - an HTTP service
        Returns:
        this Router
      • register

        public Router register​(java.lang.Object controller)
        Register a controller.

        This method is equivalent to:

         ControllerBeanUtil.register(this, controller);
         
        Parameters:
        controller - the controller object
        Returns:
        this Router
        See Also:
        RouterUtil.register(Router, Object)
      • register

        public <T> Router register​(T controller,
                                   java.lang.Class<T> clazz)
        Register a controller.

        This method is equivalent to:

         ControllerBeanUtil.register(this, controller, clazz);
         
        Type Parameters:
        T - the type of the controller
        Parameters:
        controller - the controller object
        clazz - the class of the type
        Returns:
        this Router
        See Also:
        RouterUtil.register(Router, Object, Class)