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 Details

    • GameService2Html

      public GameService2Html()
  • Method Details

    • 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, @FormParam("x") int x, @FormParam("y") int y, @FormParam("bx") int bx, @FormParam("by") int by, @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, @FormParam("x") int x, @FormParam("y") int y, @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)