Class RestContext


  • public class RestContext
    extends Context
    This class provides an abstraction to implements a simple rest end point that join any rest rule with some layer implementation.
    Author:
    javaito
    • Constructor Detail

      • RestContext

        public RestContext​(java.lang.String baseContext)
      • RestContext

        public RestContext​(java.lang.String baseContext,
                           java.util.List<java.util.regex.Pattern> idRegexList)
    • Method Detail

      • onContext

        public HttpResponse onContext​(HttpRequest request)
        This method receive the http request and delegate each request for the different method depends of the http method and the request body.
        Specified by:
        onContext in class Context
        Parameters:
        request - All the request information.
        Returns:
        Returns the response object.
      • onError

        protected HttpResponse onError​(HttpRequest request,
                                       java.lang.Throwable throwable)
        This method generate error response all the times that the request generates an throwable instance.
        Overrides:
        onError in class Context
        Parameters:
        request - All the request information.
        throwable - Throwable object, could be null.
        Returns:
        Returns http response instance.