Class GetRoute

java.lang.Object
io.github.sigmacasino.HTTPRoute
io.github.sigmacasino.GetRoute
All Implemented Interfaces:
spark.Route
Direct Known Subclasses:
HTMLTemplateRoute, Index, Logout, StripeResult

public abstract class GetRoute extends HTTPRoute
A route that handles GET requests.
  • Constructor Details

    • GetRoute

      protected GetRoute(App app, String path)
      Creates a new GET route.
      Parameters:
      app - app instance, passed to the super contructor
      path - the path of the route, passed to the super contructor
  • Method Details

    • handle

      public final Object handle(spark.Request request, spark.Response response) throws Exception
      Handles a GET request by running super.handle() and then calling handleGet().
      Specified by:
      handle in interface spark.Route
      Overrides:
      handle in class HTTPRoute
      Parameters:
      request - the request
      response - the response
      Returns:
      the response body
      Throws:
      Exception - If an error occurs while handling the request.
      See Also:
      • Route.handle(Request, Response)
    • registerSparkRoute

      public final void registerSparkRoute()
      Description copied from class: HTTPRoute
      Registers the route with Spark.
      Specified by:
      registerSparkRoute in class HTTPRoute
    • handleGet

      public abstract Object handleGet(spark.Request request, spark.Response response) throws SQLException
      Handles a GET request.
      Parameters:
      request - the request
      response - the response
      Returns:
      the response body
      Throws:
      SQLException - if a database access error occurs in any subclass implementation