Package edu.wisc.game.rest
Class BoardDisplayService
java.lang.Object
edu.wisc.game.rest.BoardDisplayService
@Path("/BoardDisplayService") public class BoardDisplayService extends Object
HTML display for user-upload boards (in JSON format), for use by
the ML team (Shubham)
The file upload technique is as per https://www.lkit.dev/jax-rs-single-file-upload-example/ , using the library jersey-media-multipart-2.34.jar from https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-multipart/ Make sure not use version 3.*, because they jave switched from "json" naming to "jakarta" naming.
See also https://stackoverflow.com/questions/56454397/jersey-formdataparam-to-read-multiple-inputstream-files for uploading multiple files
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BoardDisplayService.BoardList
-
Constructor Summary
Constructors Constructor Description BoardDisplayService()
-
Method Summary
Modifier and Type Method Description String
displayBoard(String boardJsonText, int cellWidth)
String
displayBoardFile(org.glassfish.jersey.media.multipart.FormDataBodyPart parts, int cellWidth)
String
displayBoardList(String boardListJsonText, int cellWidth, int ncol)
String
displayBoardListFile(InputStream file, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDisposition, int cellWidth, int ncol)
static String
doBoard(Board board, int cellWidth)
Given a Board object, creates an HTML snippet containing a visual display of the board.static String
doBoardAscii(Board board)
The ASCII-art alternative
-
Constructor Details
-
BoardDisplayService
public BoardDisplayService()
-
-
Method Details
-
displayBoard
-
doBoard
Given a Board object, creates an HTML snippet containing a visual display of the board. -
doBoardAscii
The ASCII-art alternative -
displayBoardFile
@Path("/displayBoardFile") @POST @Consumes("multipart/form-data") @Produces("text/html") public String displayBoardFile(org.glassfish.jersey.media.multipart.FormDataBodyPart parts, @DefaultValue("80") int cellWidth) -
displayBoardList
-
displayBoardListFile
@Path("/displayBoardListFile") @POST @Consumes("multipart/form-data") @Produces("text/html") public String displayBoardListFile(InputStream file, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDisposition, @DefaultValue("40") int cellWidth, @DefaultValue("3") int ncol)
-