Package spark

Class Routable

java.lang.Object
spark.Routable
Direct Known Subclasses:
Service

abstract class Routable extends Object
Routable abstract class. Lets extending classes inherit default routable functionality.
  • Field Details

  • Constructor Details

    • Routable

      Routable()
  • Method Details

    • addRoute

      protected abstract void addRoute(HttpMethod httpMethod, RouteImpl route)
      Adds a route
      Parameters:
      httpMethod - the HTTP method
      route - the route implementation
    • addRoute

      @Deprecated protected abstract void addRoute(String httpMethod, RouteImpl route)
      Deprecated.
    • addFilter

      protected abstract void addFilter(HttpMethod httpMethod, FilterImpl filter)
      Adds a filter
      Parameters:
      httpMethod - the HTTP method
      filter - the route implementation
    • addFilter

      @Deprecated protected abstract void addFilter(String httpMethod, FilterImpl filter)
      Deprecated.
    • get

      public void get(String path, Route route)
      Map the route for HTTP GET requests
      Parameters:
      path - the path
      route - The route
    • post

      public void post(String path, Route route)
      Map the route for HTTP POST requests
      Parameters:
      path - the path
      route - The route
    • put

      public void put(String path, Route route)
      Map the route for HTTP PUT requests
      Parameters:
      path - the path
      route - The route
    • patch

      public void patch(String path, Route route)
      Map the route for HTTP PATCH requests
      Parameters:
      path - the path
      route - The route
    • delete

      public void delete(String path, Route route)
      Map the route for HTTP DELETE requests
      Parameters:
      path - the path
      route - The route
    • head

      public void head(String path, Route route)
      Map the route for HTTP HEAD requests
      Parameters:
      path - the path
      route - The route
    • trace

      public void trace(String path, Route route)
      Map the route for HTTP TRACE requests
      Parameters:
      path - the path
      route - The route
    • connect

      public void connect(String path, Route route)
      Map the route for HTTP CONNECT requests
      Parameters:
      path - the path
      route - The route
    • options

      public void options(String path, Route route)
      Map the route for HTTP OPTIONS requests
      Parameters:
      path - the path
      route - The route
    • before

      public void before(String path, Filter filter)
      Maps a filter to be executed before any matching routes
      Parameters:
      path - the path
      filter - The filter
    • after

      public void after(String path, Filter filter)
      Maps a filter to be executed after any matching routes
      Parameters:
      path - the path
      filter - The filter
    • get

      public void get(String path, String acceptType, Route route)
      Map the route for HTTP GET requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • post

      public void post(String path, String acceptType, Route route)
      Map the route for HTTP POST requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • put

      public void put(String path, String acceptType, Route route)
      Map the route for HTTP PUT requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • patch

      public void patch(String path, String acceptType, Route route)
      Map the route for HTTP PATCH requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • delete

      public void delete(String path, String acceptType, Route route)
      Map the route for HTTP DELETE requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • head

      public void head(String path, String acceptType, Route route)
      Map the route for HTTP HEAD requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • trace

      public void trace(String path, String acceptType, Route route)
      Map the route for HTTP TRACE requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • connect

      public void connect(String path, String acceptType, Route route)
      Map the route for HTTP CONNECT requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • options

      public void options(String path, String acceptType, Route route)
      Map the route for HTTP OPTIONS requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
    • before

      public void before(Filter filter)
      Maps a filter to be executed before any matching routes
      Parameters:
      filter - The filter
    • after

      public void after(Filter filter)
      Maps a filter to be executed after any matching routes
      Parameters:
      filter - The filter
    • before

      public void before(String path, String acceptType, Filter filter)
      Maps a filter to be executed before any matching routes
      Parameters:
      path - the path
      acceptType - the accept type
      filter - The filter
    • after

      public void after(String path, String acceptType, Filter filter)
      Maps a filter to be executed after any matching routes
      Parameters:
      path - the path
      acceptType - the accept type
      filter - The filter
    • afterAfter

      public void afterAfter(Filter filter)
      Maps a filter to be executed after any matching routes even if the route throws any exception
      Parameters:
      filter - The filter
    • afterAfter

      public void afterAfter(String path, Filter filter)
      Maps a filter to be executed after any matching routes even if the route throws any exception
      Parameters:
      filter - The filter
    • get

      public void get(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP GET requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • get

      public void get(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP GET requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • post

      public void post(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP POST requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • post

      public void post(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP POST requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • put

      public void put(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP PUT requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • put

      public void put(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP PUT requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • delete

      public void delete(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP DELETE requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • delete

      public void delete(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP DELETE requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • patch

      public void patch(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP PATCH requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • patch

      public void patch(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP PATCH requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • head

      public void head(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP HEAD requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • head

      public void head(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP HEAD requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • trace

      public void trace(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP TRACE requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • trace

      public void trace(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP TRACE requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • connect

      public void connect(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP CONNECT requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • connect

      public void connect(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP CONNECT requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • options

      public void options(String path, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP OPTIONS requests
      Parameters:
      path - the path
      route - The route
      engine - the template engine
    • options

      public void options(String path, String acceptType, TemplateViewRoute route, TemplateEngine engine)
      Map the route for HTTP OPTIONS requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      engine - the template engine
    • get

      public void get(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP GET requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • get

      public void get(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP GET requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • post

      public void post(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP POST requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • post

      public void post(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP POST requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • put

      public void put(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP PUT requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • put

      public void put(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP PUT requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • delete

      public void delete(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP DELETE requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • delete

      public void delete(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP DELETE requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • head

      public void head(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP HEAD requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • head

      public void head(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP HEAD requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • connect

      public void connect(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP CONNECT requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • connect

      public void connect(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP CONNECT requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • trace

      public void trace(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP TRACE requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • trace

      public void trace(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP TRACE requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • options

      public void options(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP OPTIONS requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • options

      public void options(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP OPTIONS requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • patch

      public void patch(String path, Route route, ResponseTransformer transformer)
      Map the route for HTTP PATCH requests
      Parameters:
      path - the path
      route - The route
      transformer - the response transformer
    • patch

      public void patch(String path, String acceptType, Route route, ResponseTransformer transformer)
      Map the route for HTTP PATCH requests
      Parameters:
      path - the path
      acceptType - the accept type
      route - The route
      transformer - the response transformer
    • createRouteImpl

      private RouteImpl createRouteImpl(String path, String acceptType, Route route)
      Create route implementation or use default response transformer
      Parameters:
      path - the path
      acceptType - the accept type
      route - the route
      Returns:
      ResponseTransformerRouteImpl or RouteImpl
    • createRouteImpl

      private RouteImpl createRouteImpl(String path, Route route)
      Create route implementation or use default response transformer
      Parameters:
      path - the path
      route - the route
      Returns:
      ResponseTransformerRouteImpl or RouteImpl
    • defaultResponseTransformer

      public void defaultResponseTransformer(ResponseTransformer transformer)
      Sets default response transformer
      Parameters:
      transformer -