package com.vistech.net;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ImageViewerMainServlet extends HttpServlet{
   protected String imageBaseDir = ".";
   public void init( ServletConfig config )throws ServletException {
      super.init(config);

      try {
         String baseDir = getInitParameter("imageBaseDir");
         if(baseDir != null) imageBaseDir = baseDir;
      } catch (Exception e){
           throw new ServletException( e.toString() );
      } 
   }

   public void doGet(HttpServletRequest req, HttpServletResponse res)
                  throws ServletException{
      try {
        HttpSession session = req.getSession(true);
        if(session != null) session.putValue("imagepath", imageBaseDir);
        ServletContext sc =  getServletContext();
        RequestDispatcher rd = 
         sc.getRequestDispatcher("/servlet/com.vistech.net.ImageManipControllerServlet");
        rd.forward(req, res);
     } catch(Exception e) {System.out.println(e);}
   }

   public void doPost(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException {
        doGet(request, response);
   }
}
