Package edu.wisc.game.rest

## Class GameService2Html

- java.lang.Object
- - edu.wisc.game.rest.GameService2
  - - edu.wisc.game.rest.GameService2Html

-     @Path("/GameService2Html")
      public class GameService2Html
      extends GameService2

  The page generator for the HTML Play interface.

  Each REST API method (e.g. /moveHtml) here returns an HTML wrapper for the corresponding Second Batch Rule Game API call (e.g. /move), to enable "HTML Play".

  The designer of the GUI Client can look at various methods of this class to see how the Java structure returned by the underlying API calls (such as /player, /newEpisode, /move, /pick, or /display) is analyzed to extract the information needed to correctly generate all the data-presenting elements of the GUI. In the GUI Client, the same exactly data are returned by the Game Server API calls in the form of JSON structures.

  There is a minor difference between the data available to this class's methods and to the GUI Client: this method sometimes directly access EpisodeInfo or PlayerInfo objects, which of course are not available in the GUI client. However, here we access these structures in a very limited way, and for each of these accesses there is an alternative way to get ahold of the needed piece of data, usually by saving some value (such as "adveGame" or "needChat") from the result of a /player or /newEpisode call, and using it later on (e.g. during a /display call).

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GameService2Html()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `displayHtml​(String playerId, String episodeId, jakarta.ws.rs.core.UriInfo uriInfo)` |
    `String` | `guessHtml​(String playerId, String episodeId, String guessText, int confidence)` |
    `String` | `mostRecentEpisodeHtml​(String playerId, jakarta.ws.rs.core.UriInfo uriInfo)` |
    `String` | `moveHtml​(String playerId, String episodeId, int x, int y, int bx, int by, int pieceId, int bucketId, int cnt, jakarta.ws.rs.core.UriInfo uriInfo)` |
    `String` | `newEpisodeHtml​(String playerId, boolean activateBonus, boolean giveUp, jakarta.ws.rs.core.UriInfo uriInfo)` |
    `String` | `pickHtml​(String playerId, String episodeId, int x, int y, int pieceId, int cnt, jakarta.ws.rs.core.UriInfo uriInfo)` |
    `String` | `playerHtml​(String playerId, String exp, int uid, jakarta.ws.rs.core.UriInfo uriInfo)` |

    - ### Methods inherited from class edu.wisc.game.rest.GameService2

      `abandon, activateBonus, colorMap, display, findPlans, getVersion, giveUp, guess, listShapes, mostRecentEpisode, move, move, newEpisode, player, registerUser`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GameService2Html

          public GameService2Html()

  - ### Method Detail

    - #### playerHtml

          @POST
          @Path("/playerHtml")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("text/html")
          public String playerHtml​(@DefaultValue("null") @FormParam("playerId")
                                   String playerId,
                                   @DefaultValue("null") @FormParam("exp")
                                   String exp,
                                   @DefaultValue("-1") @FormParam("uid")
                                   int uid,
                                   @Context
                                   jakarta.ws.rs.core.UriInfo uriInfo)

    - #### mostRecentEpisodeHtml

          @POST
          @Path("/mostRecentEpisodeHtml")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("text/html")
          public String mostRecentEpisodeHtml​(@FormParam("playerId")
                                              String playerId,
                                              @Context
                                              jakarta.ws.rs.core.UriInfo uriInfo)

    - #### newEpisodeHtml

          @POST
          @Path("/newEpisodeHtml")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("text/html")
          public String newEpisodeHtml​(@FormParam("playerId")
                                       String playerId,
                                       @DefaultValue("false") @FormParam("activateBonus")
                                       boolean activateBonus,
                                       @DefaultValue("false") @FormParam("giveUp")
                                       boolean giveUp,
                                       @Context
                                       jakarta.ws.rs.core.UriInfo uriInfo)

    - #### displayHtml

          @GET
          @Path("/displayHtml")
          @Produces("text/html")
          public String displayHtml​(@DefaultValue("null") @QueryParam("playerId")
                                    String playerId,
                                    @QueryParam("episode")
                                    String episodeId,
                                    @Context
                                    jakarta.ws.rs.core.UriInfo uriInfo)

    - #### moveHtml

          @POST
          @Path("/moveHtml")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("text/html")
          public String moveHtml​(@FormParam("playerId")
                                 String playerId,
                                 @FormParam("episode")
                                 String episodeId,
                                 @DefaultValue("-1") @FormParam("x")
                                 int x,
                                 @DefaultValue("-1") @FormParam("y")
                                 int y,
                                 @DefaultValue("-1") @FormParam("bx")
                                 int bx,
                                 @DefaultValue("-1") @FormParam("by")
                                 int by,
                                 @DefaultValue("-1") @FormParam("id")
                                 int pieceId,
                                 @DefaultValue("-1") @FormParam("bid")
                                 int bucketId,
                                 @FormParam("cnt")
                                 int cnt,
                                 @Context
                                 jakarta.ws.rs.core.UriInfo uriInfo)

    - #### pickHtml

          @POST
          @Path("/pickHtml")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("text/html")
          public String pickHtml​(@FormParam("playerId")
                                 String playerId,
                                 @FormParam("episode")
                                 String episodeId,
                                 @DefaultValue("-1") @FormParam("x")
                                 int x,
                                 @DefaultValue("-1") @FormParam("y")
                                 int y,
                                 @DefaultValue("-1") @FormParam("id")
                                 int pieceId,
                                 @FormParam("cnt")
                                 int cnt,
                                 @Context
                                 jakarta.ws.rs.core.UriInfo uriInfo)

    - #### guessHtml

          @POST
          @Path("/guessHtml")
          @Consumes("application/x-www-form-urlencoded")
          @Produces("text/html")
          public String guessHtml​(@DefaultValue("null") @FormParam("playerId")
                                  String playerId,
                                  @FormParam("episode")
                                  String episodeId,
                                  @FormParam("data")
                                  String guessText,
                                  @DefaultValue("-1") @FormParam("confidence")
                                  int confidence)