src/main/java/com/webcheckers/ui/WebServer.java
/**
   * Initialize all of the HTTP routes that make up this web application.
   *
   * <p>
   * Initialization of the web server includes defining the location for static
   * files, and defining all routes for processing client requests. The method
   * returns after the web server finishes its initialization.
   * </p>
   */
Initialize all of the HTTP routes that make up this web application.

Initialization of the web server includes defining the location for static
files, and defining all routes for processing client requests. The method
returns after the web server finishes its initialization.
Initialize all of the HTTP routes that make up this web application . Initialization of the web server includes defining the location for static files and defining all routes for processing client requests . The method returns after the web server finishes its initialization .
public void initialize() {
    staticFileLocation("/public");
    get(HOME_URL, new GetHomeRoute(templateEngine, lobby));
    post(SIGNOUT_URL, new GetSignoutRoute(lobby, templateEngine));
    get(SIGNIN_URL, new GetSigninRoute(templateEngine));
    post(SIGNIN_URL, new PostSigninRoute(templateEngine, lobby));
    get(GAME_URL, new GetGameRoute(templateEngine, lobby));
    post(VALIDATE_MOVE_URL, new PostValidateMoveRoute(gson));
    post(CHECK_TURN_URL, new PostCheckTurnRoute(gson));
    post(GAME_URL, new GetHomeRoute(templateEngine));
    LOG.config("WebServer is initialized.");
  }
public void initialize ( ) { staticFileLocation ( "/public" ) ; get ( HOME_URL , new GetHomeRoute ( templateEngine , lobby ) ) ; post ( SIGNOUT_URL , new GetSignoutRoute ( lobby , templateEngine ) ) ; get ( SIGNIN_URL , new GetSigninRoute ( templateEngine ) ) ; post ( SIGNIN_URL , new PostSigninRoute ( templateEngine , lobby ) ) ; get ( GAME_URL , new GetGameRoute ( templateEngine , lobby ) ) ; post ( VALIDATE_MOVE_URL , new PostValidateMoveRoute ( gson ) ) ; post ( CHECK_TURN_URL , new PostCheckTurnRoute ( gson ) ) ; LOG . config ( "WebServer is initialized." ) ; }
Initialize all of the HTTP routes that make up this web application.
Initialize all of the HTTP routes that make up this web application .
// Configuration to serve static files //// Setting any route (or filter) in Spark triggers initialization of the //// embedded Jetty web server. //// A route is set for a request verb by specifying the path for the //// request, and the function callback (request, response) -> {} to //// process the request. The order that the routes are defined is //// important. The first route (request-path combination) that matches //// is the one which is invoked. Additional documentation is at //// http://sparkjava.com/documentation.html and in Spark tutorials. //// Each route (processing function) will check if the request is valid //// from the client that made the request. If it is valid, the route //// will extract the relevant data from the request and pass it to the //// application object delegated with executing the request. When the //// delegate completes execution of the request, the route will create //// the parameter map that the response template needs. The data will //// either be in the value the delegate returns to the route after //// executing the request, or the route will query other application //// objects for the data needed. //// FreeMarker defines the HTML response using templates. Additional //// documentation is at //// http://freemarker.org/docs/dgui_quickstart_template.html. //// The Spark FreeMarkerEngine lets you pass variable values to the //// template via a map. Additional information is in online //// tutorials such as //// http://benjamindparrish.azurewebsites.net/adding-freemarker-to-java-spark/. //// These route definitions are examples. You will define the routes //// that are appropriate for the HTTP client interface that you define. //// Create separate Route classes to handle each route; this keeps your //// code clean; using small classes. // Shows the Checkers game Home page. // //post(GAME_URL, new GetHomeRoute(templateEngine));