Class JsonTileServlet

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    @WebServlet(asyncSupported=true,
                description="Servlet handling json tile requests",
                displayName="jadice web toolkit json tile download",
                name="jwtJsonTileDownloadServlet",
                urlPatterns="/jwt/jsontile/*")
    public class JsonTileServlet
    extends TileServlet
    This servlet handles JSON tile requests. The requests must match the pattern <base URL> + "jwt/jsontile?" + <request data>. The request data can either be the serialized FlattenedRenderSpecificationData (needs to have the format "v=<UUID>&r=<SPEC>" at the beginning) or the String "brokenImage".
    See Also:
    Serialized Form
    • Field Detail

      • objectMapper

        protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • Constructor Detail

      • JsonTileServlet

        public JsonTileServlet()
      • JsonTileServlet

        public JsonTileServlet​(com.levigo.jadice.web.server.internal.TileRenderService tileRenderService)
    • Method Detail

      • init

        public void init​(javax.servlet.ServletConfig config)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class TileServlet
        Throws:
        javax.servlet.ServletException
      • doPost

        protected void doPost​(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • unmarshalRenderSpecification

        protected com.levigo.jadice.web.shared.model.internal.RenderSpecification unmarshalRenderSpecification​(javax.servlet.http.HttpServletRequest request)
                                                                                                        throws IOException
        Throws:
        IOException
      • deserializeHandles

        protected PageSegmentHandle[] deserializeHandles​(String[] handlesStrings)
                                                  throws IOException
        Method used for deserializing JSON-strings of PageSegmentHandles. If you want to add your own deserialization logic that uses Jackson, overriding getJsonDeserializationMapper() is the best way. If you don't want Jackson and use e.g. Gson instead, you probably want to override this method.
        Parameters:
        handlesStrings - the handles as string (JSON)
        Returns:
        a list of deserialized PageSegmentHandles
        Throws:
        IOException - is thrown if handles are not correct url-encoded
      • getJsonDeserializationMapper

        protected com.fasterxml.jackson.databind.ObjectMapper getJsonDeserializationMapper()
        Gets a jackson ObjectMapper that can deserialize Permission, Source, PageSegmentHandle and any other class, that has a field called selfClassName, where the value of the field resembles to Class.getSimpleName().
        Returns:
        the default object-mapper