Class MCRTileCombineServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.mycore.frontend.servlets.MCRServlet
org.mycore.iview2.frontend.MCRTileCombineServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class MCRTileCombineServlet extends MCRServlet
Combines tiles of an image in specific resolutions.
Author:
Thomas Scheffler (yagee)
See Also:
  • Field Details

    • IMAGE_KEY

      protected static final String IMAGE_KEY
      key of request attribute for BufferedImage.
    • THUMBNAIL_KEY

      protected static final String THUMBNAIL_KEY
      key of request attribute for iview2-File.
  • Constructor Details

    • MCRTileCombineServlet

      public MCRTileCombineServlet()
  • Method Details

    • init

      public void init() throws jakarta.servlet.ServletException
      Initializes this instance. Use parameter org.mycore.iview2.frontend.MCRFooterInterface to specify implementation of MCRFooterInterface (can be omitted).
      Overrides:
      init in class MCRServlet
      Throws:
      jakarta.servlet.ServletException
    • think

      protected void think(MCRServletJob job) throws IOException, JDOMException, URISyntaxException
      prepares render process and gets IView2 file and combines tiles. The image dimensions and path are determined from HttpServletRequest.getPathInfo(): /{zoomAlias}/{derivateID}/{absoluteImagePath} where zoomAlias is mapped like this:
      Mapping of zoomAlias to actual zoom level
      zoomAliaszoom level
      'MIN'1
      'MID'2
      'MAX'3
      default and all others0
      See init() how to attach a footer to every generated image.
      Overrides:
      think in class MCRServlet
      Throws:
      IOException
      JDOMException
      URISyntaxException
      See Also:
    • render

      protected void render(MCRServletJob job, Exception ex) throws Exception
      Transmits combined file or sends thumbnail. Uses ServletRequest.getAttribute(String) to retrieve information generated by think(MCRServletJob).
      description of HttpServletRequest attributes
      keyNametypedescription
      THUMBNAIL_KEYFile.iview2 File with all tiles in it
      IMAGE_KEYBufferedImage generated image if zoomLevel != 0 and no implementation of MCRFooterInterface defined
      Overrides:
      render in class MCRServlet
      Parameters:
      job - same instance as of think(MCRServlet job)
      ex - any exception thrown by think(MCRServletJob) or transaction commit
      Throws:
      Exception - if render could not handle ex to produce a nice user page
    • attachFooter

      protected static BufferedImage attachFooter(BufferedImage combinedImage, BufferedImage footer)
      attaches footer to combinedImage.
      Parameters:
      combinedImage - image to attach footer to
      footer - image of same with as combinedImage
      Returns:
      a BufferedImage with footer attached to combinedImage