Class GameService2Html
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 -
Method Summary
Modifier and TypeMethodDescriptiondisplayHtml
(String playerId, String episodeId, jakarta.ws.rs.core.UriInfo uriInfo) mostRecentEpisodeHtml
(String playerId, jakarta.ws.rs.core.UriInfo uriInfo) moveHtml
(String playerId, String episodeId, int x, int y, int bx, int by, int cnt, jakarta.ws.rs.core.UriInfo uriInfo) newEpisodeHtml
(String playerId, boolean activateBonus, boolean giveUp, jakarta.ws.rs.core.UriInfo uriInfo) pickHtml
(String playerId, String episodeId, int x, int y, int cnt, jakarta.ws.rs.core.UriInfo uriInfo) playerHtml
(String playerId, String exp, int uid, jakarta.ws.rs.core.UriInfo uriInfo) Methods inherited from class edu.wisc.game.rest.GameService2
activateBonus, colorMap, display, findPlans, getVersion, giveUp, guess, listShapes, mostRecentEpisode, move, move, newEpisode, player, registerUser
-
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
-
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
-
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)
-