Class Horses
java.lang.Object
io.github.sigmacasino.HTTPRoute
io.github.sigmacasino.GetRoute
io.github.sigmacasino.HTMLTemplateRoute
io.github.sigmacasino.routes.games.Horses
- All Implemented Interfaces:
spark.Route
Handles the "/games/horses" route, fetching horse race data based on a replay ID
and populating the HTML template with the race details or an error flag.
-
Field Summary
Fields inherited from class io.github.sigmacasino.HTTPRoute
app, loginRequired, path
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHTMLTemplatePath
(spark.Request request) Returns the path to the HTML template for the horse racing page.Returns a map of notification definitions to be used in the Jinjava HTML template.populateContext
(spark.Request request, spark.Response response) Populates the template context with race data (date, bet amount, user's guess, horse times, and Bezier curves) or redirects the user on error with a correct flag in the URL.Methods inherited from class io.github.sigmacasino.HTMLTemplateRoute
handleGet
Methods inherited from class io.github.sigmacasino.GetRoute
handle, registerSparkRoute
-
Constructor Details
-
Horses
Initializes the route handler with the app instance and sets the route path.- Parameters:
app
- The main application instance.
-
-
Method Details
-
getHTMLTemplatePath
Returns the path to the HTML template for the horse racing page.- Specified by:
getHTMLTemplatePath
in classHTMLTemplateRoute
- 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 race data (date, bet amount, user's guess, horse times, and Bezier curves) or redirects the user on error with a correct flag in the URL.- Overrides:
populateContext
in classHTMLTemplateRoute
- Parameters:
request
- The HTTP request containing the query parameter.response
- The HTTP response used to redirect the user.- Returns:
- A map with race data or an error flag.
- Throws:
SQLException
- if a database access error occurs in any subclass implementation
-
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 classHTMLTemplateRoute
- Returns:
- the definitions as an URL name-notification message map.
-