Class 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

    • Constructor Detail

      • BoardDisplayService

        public BoardDisplayService()
    • Method Detail

      • displayBoard

        @POST
        @Path("/displayBoard")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("text/html")
        public String displayBoard​(@FormParam("boardJson")
                                   String boardJsonText,
                                   @DefaultValue("80") @FormParam("cellWidth")
                                   int cellWidth)
      • doBoard

        public static String doBoard​(Board board,
                                     int cellWidth)
        Given a Board object, creates an HTML snippet containing a visual display of the board.
      • doBoardAscii

        public static String doBoardAscii​(Board board)
        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

        @POST
        @Path("/displayBoardList")
        @Consumes("application/x-www-form-urlencoded")
        @Produces("text/html")
        public String displayBoardList​(@FormParam("boardListJson")
                                       String boardListJsonText,
                                       @DefaultValue("40") @FormParam("cellWidth")
                                       int cellWidth,
                                       @DefaultValue("3") @FormParam("ncol")
                                       int ncol)
      • 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)