Subversion Repositories general

Rev

Blame | Last modification | View Log | RSS feed

package ak.photoalbum.webapp;

import javax.servlet.ServletException;
import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServlet;

public class InitServlet
  extends HttpServlet
{
  public void init()
    throws ServletException
  {
    ServletConfig config = getServletConfig();

    String  imagesRoot;
    String  imagesMask;
    String  cacheDir;
    String  thumbnailFormat;
    Integer smallWidth   = null;
    Integer smallHeight  = null;
    Integer mediumWidth  = null;
    Integer mediumHeight = null;
    Integer columns      = null;
    String  dirTemplate;
    String  dirThumbnailPositions;

    imagesRoot      = config.getInitParameter("images root");
    imagesMask      = config.getInitParameter("images mask");
    cacheDir        = config.getInitParameter("cache dir");
    thumbnailFormat = config.getInitParameter("thumbnail format");

    if(config.getInitParameter("small width") != null)
      smallWidth = new Integer(config.getInitParameter("small width"));
    if(config.getInitParameter("small height") != null)
      smallHeight = new Integer(config.getInitParameter("small height"));
    if(config.getInitParameter("medium width") != null)
      mediumWidth = new Integer(config.getInitParameter("medium width"));
    if(config.getInitParameter("medium heught") != null)
      mediumHeight = new Integer(config.getInitParameter("medium heught"));
    if(config.getInitParameter("columns") != null)
      columns = new Integer(config.getInitParameter("columns"));

    dirTemplate           = config.getInitParameter("dir template");
    dirThumbnailPositions = config.getInitParameter("dir thumbnails positions");

    Logic.getLogic().init(imagesRoot, imagesMask, cacheDir, thumbnailFormat,
      smallWidth, smallHeight, mediumWidth, mediumHeight, columns,
      dirTemplate, dirThumbnailPositions);
  }
}