Class Roulette

All Implemented Interfaces:
spark.Route

public class Roulette extends HTMLTemplateRoute
Handles the "/games/roulette" route, fetching roulette game data based on a replay ID and populating the HTML template with the game details or an error flag.
  • Constructor Details

    • Roulette

      public Roulette(App app)
      Initializes the route handler with the app instance and sets the route path.
      Parameters:
      app - The main application instance.
  • Method Details

    • getHTMLTemplatePath

      public String getHTMLTemplatePath(spark.Request request)
      Returns the path to the HTML template for the roulette game page.
      Specified by:
      getHTMLTemplatePath in class HTMLTemplateRoute
      Parameters:
      request - The HTTP request.
      Returns:
      The template path.
    • populateContext

      public Map<String,Object> populateContext(spark.Request request, spark.Response response) throws SQLException
      Populates the template context with roulette game data (date, bet amount, guess, result) or redirects the user on error with a correct flag in the URL.
      Overrides:
      populateContext in class HTMLTemplateRoute
      Parameters:
      request - The HTTP request containing the query parameter.
      response - The HTTP response used to redirect the user.
      Returns:
      A map with game data.
      Throws:
      SQLException - if a database access error occurs in any subclass implementation
    • getNotificationDefinitions

      public Map<String,String> getNotificationDefinitions()
      Description copied from class: HTMLTemplateRoute
      Returns a map of notification definitions to be used in the Jinjava HTML template. Intended to be overridden by subclasses, providing their own definitions based on all redirects which point the user to the route with any error or success tags.
      Overrides:
      getNotificationDefinitions in class HTMLTemplateRoute
      Returns:
      the definitions as an URL name-notification message map.