예제 #1
0
 private void init(HttpServletResponse response) {
   response.setHeader("Pragma", "no-cache"); // HTTP 1.0
   response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
   response.setDateHeader("Expires", 0); // prevents caching at the proxy server
   response.setHeader("Cache-Control", "private"); // HTTP 1.1
   response.setHeader("Cache-Control", "no-store"); // HTTP 1.1
   response.setHeader("Cache-Control", "max-stale=0"); // HTTP 1.1
   response.setContentType("text/html");
 }
예제 #2
0
  private void setNoCacheHeaders(HttpServletResponse pResp) {
    pResp.setHeader("Cache-Control", "no-cache");
    pResp.setHeader("Pragma", "no-cache");
    // Check for a date header and set it accordingly to the recommendations of
    // RFC-2616 (http://tools.ietf.org/html/rfc2616#section-14.21)
    //
    //   "To mark a response as "already expired," an origin server sends an
    //    Expires date that is equal to the Date header value. (See the rules
    //  for expiration calculations in section 13.2.4.)"
    //
    // See also #71

    long now = System.currentTimeMillis();
    pResp.setDateHeader("Date", now);
    // 1h  in the past since it seems, that some servlet set the date header on their
    // own so that it cannot be guaranteed that these headers are really equals.
    // It happened on Tomcat that Date: was finally set *before* Expires: in the final
    // answers some times which seems to be an implementation peculiarity from Tomcat
    pResp.setDateHeader("Expires", now - 3600000);
  }
예제 #3
0
 private void outputJson(HttpServletResponse response, Response<String> kv)
     throws IOException, JsonGenerationException, JsonMappingException {
   response.setContentType("application/json;charset=UTF-8");
   response.setHeader("Pragma", "No-cache");
   response.setHeader("Cache-Control", "no-cache");
   response.setDateHeader("Expires", 0);
   response.setContentType("application/json");
   PrintWriter out = response.getWriter();
   ObjectMapper om = JsonHelper.getObjectMapperInstance();
   out.print(om.writeValueAsString(kv));
   out.flush();
   out.close();
 }
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    resp.setContentType("text/plain");

    resp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1
    resp.setHeader("Pragma", "no-cache"); // HTTP 1.0
    resp.setDateHeader("Expires", 0); // Proxies.

    Enumeration paramNames = req.getParameterNames();
    String action = req.getParameterValues("action")[0];
    String values = req.getParameterValues("values")[0];

    Gson gson = new Gson();
    JsonValues jsonValues = gson.fromJson(values, JsonValues.class);

    if (action.equals("RECORD")) {
      doRecordAction(jsonValues, resp.getWriter());
    } else if (action.equals("GET")) {
      doGetAction(jsonValues, resp.getWriter());
    }
  }
예제 #5
0
 private void setResponseHeader(
     HttpServletResponse response, String uri, String transferEncoding) {
   // LogUtil.logDebug( uri + ".Accept-Encoding: "+ transferEncoding);
   String ext = null;
   int dot = uri.lastIndexOf(".");
   if (dot != -1) {
     ext = uri.substring(dot + 1);
   }
   if (ext != null && ext.length() > 0) {
     Integer expires = (Integer) expiresMap.get(ext);
     if (expires != null) {
       // LogUtil.logDebug( uri + ".Expires: "+ expires.intValue());
       if (expires.intValue() > 0) {
         response.setHeader("Cache-Control", "max-age=" + expires.intValue()); // HTTP 1.1
       } else {
         response.setHeader("Cache-Control", "no-cache");
         response.setHeader("Pragma", "no-cache"); // HTTP 1.0
         response.setDateHeader("Expires", expires.intValue());
       }
     }
   }
 }
예제 #6
0
  // *****************************************************
  // Process the initial request from Proshop_main
  // *****************************************************
  //
  @SuppressWarnings("deprecation")
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    //
    //  Prevent caching so sessions are not mangled
    //
    resp.setHeader("Pragma", "no-cache"); // for HTTP 1.0
    resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // for HTTP 1.1
    resp.setDateHeader("Expires", 0); // prevents caching at the proxy server

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    HttpSession session = SystemUtils.verifyPro(req, out); // check for intruder

    if (session == null) {

      return;
    }

    String club = (String) session.getAttribute("club"); // get club name
    String templott = (String) session.getAttribute("lottery"); // get lottery support indicator
    int lottery = Integer.parseInt(templott);

    //
    //  Call is to display the new features page.
    //
    //  Display a page to provide a link to the new feature page
    //
    out.println("<html><head>");
    out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">");
    out.println("<meta http-equiv=\"Content-Language\" content=\"en-us\">");
    out.println("<title> \"ForeTees Proshop Announcement Page\"</title>");
    //   out.println("<link rel=\"stylesheet\" href=\"/" +rev+ "/web utilities/foretees.css\"
    // type=\"text/css\"></link>");
    out.println(
        "<script language=\"JavaScript\" src=\"/" + rev + "/web utilities/foretees.js\"></script>");
    out.println("</head>");
    out.println("<body bgcolor=\"#FFFFFF\" text=\"#000000\">");

    SystemUtils.getProshopSubMenu(req, out, lottery);

    File f;
    FileReader fr;
    BufferedReader br;
    String tmp = "";
    String path = "";

    try {
      path = req.getRealPath("");
      tmp = "/proshop_features.htm"; // "/" +rev+
      f = new File(path + tmp);
      fr = new FileReader(f);
      br = new BufferedReader(fr);
      if (!f.isFile()) {
        // do nothing
      }
    } catch (FileNotFoundException e) {
      out.println("<br><br><p align=center>Missing New Features Page.</p>");
      out.println("</BODY></HTML>");
      out.close();
      return;
    } catch (SecurityException se) {
      out.println("<br><br><p align=center>Access Denied.</p>");
      out.println("</BODY></HTML>");
      out.close();
      return;
    }

    while ((tmp = br.readLine()) != null) out.println(tmp);

    br.close();

    out.println("</BODY></HTML>");
    out.close();
  } // end of doGet
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!--%@ page errorPage=\"/error.jsp\" %-->\n");

      response.setHeader("Pragma", "no-cache"); // HTTP 1.0
      response.setDateHeader("Expires", 0);
      response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1

      String _adminid = "";
      String _adminname = "";
      String _admintype = "";
      String _admingroup = "";
      String _approval = "";
      String _adminclass = "";
      String _adminmail = "";

      try {

        _adminid = (String) session.getAttribute("adminid");

        if (_adminid == null || _adminid.length() == 0 || _adminid.equals("null")) {
          response.sendRedirect("/admin/login_first.html");
          return;
        }

        _adminname = (String) session.getAttribute("adminname");
        _admintype = (String) session.getAttribute("admintype");
        _admingroup = (String) session.getAttribute("admingroup");
        _approval = (String) session.getAttribute("approval");
        _adminclass = (String) session.getAttribute("adminclass");
        _adminmail = (String) session.getAttribute("admin_email");
        // session.setMaxInactiveInterval(60*60);

      } catch (Exception e) {
        response.sendRedirect("/admin/login_first.html");
        return;
      }

      out.write('\n');
      out.write('\n');
      out.write('\n');

      String password = request.getParameter("password");
      String fromURL = request.getParameter("fromURL");
      String oldPassword = "";

      String sql = "";
      int iCnt = 0;
      boolean isSucceeded = false;
      String strMsg = "";
      Connection conn = null;
      MatrixDataSet matrix = null;
      DataProcess dataProcess = null;
      PreparedStatement pstmt = null;

      String targetUrl = "";

      try {

        if (password.equals("1111")) {
          throw new UserDefinedException(
              "The new password is not acceptable. Change your password.");
        }

        Context ic = new InitialContext();
        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/scm");
        conn = ds.getConnection();
        matrix = new dbconn.MatrixDataSet();
        dataProcess = new DataProcess();

        sql =
            " select  password " + " from    admin_01t " + " where   adminid = '" + _adminid + "' ";

        iCnt = dataProcess.RetrieveData(sql, matrix, conn);

        if (iCnt > 0) {
          oldPassword = matrix.getRowData(0).getData(0);
        } else {
          throw new UserDefinedException("Can't find User Information.");
        }

        if (password.equals(oldPassword)) {
          throw new UserDefinedException(
              "The new password is not acceptable. Change your password.");
        }

        // update ó¸®...
        int idx = 0;
        conn.setAutoCommit(false);

        sql =
            " update  admin_01t "
                + " set     password = ?, pw_date = sysdate() "
                + " where   adminid = ? ";

        pstmt = conn.prepareStatement(sql);
        pstmt.setString(++idx, password);
        pstmt.setString(++idx, _adminid);

        iCnt = pstmt.executeUpdate();

        if (iCnt != 1) {
          throw new UserDefinedException("Password update failed.");
        }

        conn.commit();
        isSucceeded = true;

      } catch (UserDefinedException ue) {
        try {
          conn.rollback();
        } catch (Exception ex) {
        }

        strMsg = ue.getMessage();
      } catch (Exception e) {
        try {
          conn.rollback();
        } catch (Exception ex) {
        }

        System.out.println("Exception /admin/resetAdminPasswd : " + e.getMessage());
        throw e;
      } finally {
        if (pstmt != null) {
          try {
            pstmt.close();
          } catch (Exception e) {
          }
        }

        if (conn != null) {
          try {
            conn.setAutoCommit(true);
          } catch (Exception e) {
          }
          conn.close();
        }
      }

      // °á°ú ¸Þ½ÃÁö ó¸®
      if (isSucceeded) {
        // where to go?
        if (fromURL.equals("menu")) {
          targetUrl = "";
        } else {
          targetUrl = "/admin/index2.jsp";
        }
        strMsg = "The data are successfully processed.";
      } else {
        strMsg = "The operation failed.\\n" + strMsg;
        targetUrl = "/admin/resetAdminPasswdForm.jsp";
      }

      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<title></title>\n");
      out.write("<link href=\"/common/css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n");
      out.write("</head>\n");
      out.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>\n");
      out.write("<form name=\"form1\" method=\"post\" action=\"");
      out.print(targetUrl);
      out.write("\">\n");
      out.write("<input type='hidden' name='fromURL' value='");
      out.print(fromURL);
      out.write("'>\n");
      out.write("</form>\n");
      out.write("<script language=\"javascript\">\n");
      if (targetUrl.length() > 0) {
        out.write("\n");
        out.write("  alert('");
        out.print(strMsg);
        out.write("');\n");
        out.write("  document.form1.submit();\n");
      }
      out.write("\n");
      out.write("</script>\n");
      out.write("<table width='840' border='0' cellspacing='0' cellpadding='0'><tr><td>\n");
      out.write("\n");
      out.write("<table width='99%' border='0' cellspacing='0' cellpadding='0'>\n");
      out.write("<tr>\n");
      out.write("  <td height='15' colspan='2'></td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td width='3%'><img src='/img/title_icon.gif'></td>\n");
      out.write("  <td width='*' class='left_title'>Password Change</td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td width='100%' height='2' colspan='2'><hr width='100%'></td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td height='10' colspan='2'></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("\n");
      out.write("<table width='90%' border='0' cellspacing='0' cellpadding='0' align='center'>\n");
      out.write("<tr>\n");
      out.write("  <td width='100%' align='center'><img border=\"0\" src=\"/img/pass.jpg\">\n");
      out.write("    <br><br>\n");
      out.write("    <b>The Password has been changed successfully.</b></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");

      out.println(CopyRightLogo());

      out.write("\n");
      out.write("</tr></td></table>\n");
      out.write("</body>\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            out.clearBuffer();
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
예제 #8
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      response.setContentType("image/jpeg");
      pageContext =
          _jspxFactory.getPageContext(
              this, request, response, "/myhtml/errorpage/erroe.jsp", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write('\r');
      out.write('\n');

      // 设置页面不缓存
      response.setHeader("Pragma", "No-cache");
      response.setHeader("Cache-Control", "no-cache");
      response.setDateHeader("Expires", 0);

      //   在内存中创建图象
      int width = 60, height = 20;
      BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

      //   获取图形上下文
      Graphics g = image.getGraphics();

      // 生成随机类
      Random random = new Random();

      //   设定背景色
      g.setColor(getRandColor(200, 250));
      g.fillRect(0, 0, width, height);

      // 设定字体
      g.setFont(new Font("Times   New   Roman", Font.PLAIN, 18));

      // 画边框
      // g.setColor(new   Color());
      // g.drawRect(0,0,width-1,height-1);

      //   随机产生155条干扰线,使图象中的认证码不易被其它程序探测到
      g.setColor(getRandColor(160, 200));
      for (int i = 0; i < 155; i++) {
        int x = random.nextInt(width);
        int y = random.nextInt(height);
        int xl = random.nextInt(12);
        int yl = random.nextInt(12);
        g.drawLine(x, y, x + xl, y + yl);
      }

      //   取随机产生的认证码(4位数字)
      String sRand = "";
      for (int i = 0; i < 4; i++) {
        String rand = String.valueOf(random.nextInt(10));
        sRand += rand;
        //   将认证码显示到图象中
        g.setColor(
            new Color(
                20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
        // 调用函数出来的颜色相同,可能是å›
        // ä¸ºç§å­å¤ªæŽ¥è¿‘,所以只能直接生成
        g.drawString(rand, 13 * i + 6, 16);
      }

      //   将认证码存入SESSION
      session.setAttribute("rand", sRand);

      //   图象生效
      g.dispose();

      //   输出图象到页面
      ImageIO.write(image, "JPEG", response.getOutputStream());
      out.clear();
      out = pageContext.pushBody();

    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            out.clearBuffer();
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else log(t.getMessage(), t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
예제 #9
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=EUC-KR");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<HTML>\r\n");
      out.write("<BODY bgcolor=\"white\">\r\n");
      out.write("<H3>요청 정보 </H3>\r\n");

      response.setDateHeader("Expires", 0);
      response.setHeader("Pragma", "no-cache");
      if (request.getProtocol().equals("HTTP/1.1")) {
        response.setHeader("Cache-Control", "no-cache");
      }

      out.write("\r\n");
      out.write("<FONT size=\"4\">\r\n");
      out.write("JSP Request Method:");
      out.print(request.getMethod());
      out.write("<BR>\r\n");
      out.write("Request URI:");
      out.print(request.getRequestURI());
      out.write("<BR>\r\n");
      out.write("Request Protocol:");
      out.print(request.getProtocol());
      out.write("<BR>\r\n");
      out.write("Servlet path:");
      out.print(request.getServletPath());
      out.write("<BR>\r\n");
      out.write("Query string:");
      out.print(request.getQueryString());
      out.write("<BR>\r\n");
      out.write("Content length:");
      out.print(request.getContentLength());
      out.write("<BR>\r\n");
      out.write("Content type:");
      out.print(request.getContentType());
      out.write("<BR>\r\n");
      out.write("Server name:");
      out.print(request.getServerName());
      out.write("<BR>\r\n");
      out.write("Server port:");
      out.print(request.getServerPort());
      out.write("<BR>\r\n");
      out.write("Remote address:");
      out.print(request.getRemoteAddr());
      out.write("<BR>\r\n");
      out.write("Remote host:");
      out.print(request.getRemoteHost());
      out.write("<BR>\r\n");
      out.write("<HR>\r\n");
      out.write("The browser you are using is ");
      out.print(request.getHeader("User-Agent"));
      out.write("\r\n");
      out.write("</FONT>\r\n");
      out.write("</BODY>\r\n");
      out.write("</HTML>\r\n");
      out.write("\t");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
예제 #10
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \n");
      out.write("\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n");
      out.write("\n");

      response.setHeader("Cache-Control", "no-store");
      response.setHeader("Pragma", "no-cache");
      response.setDateHeader("Expires", 0);

      out.write("\n");
      out.write("\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
      out.write("<head>\n");
      out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n");
      out.write("\t<meta name=\"language\" content=\"en\" />\n");
      out.write("\n");
      out.write("\t<title>OOPS Science Portal</title>\n");
      out.write("\n");
      out.write(
          "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"../lib/css/layout-default-latest.css\" />\n");
      out.write(
          "        <LINK rel=\"stylesheet\" type=\"text/css\" href=\"css/themes/base/ui.core.css\">\n");
      out.write(
          "        <LINK rel=\"stylesheet\" type=\"text/css\" href=\"css/themes/base/ui.tabs.css\">\n");
      out.write(
          "        <LINK rel=\"stylesheet\" type=\"text/css\" href=\"css/themes/base/ui.all.css\">\n");
      out.write(
          "        <LINK rel=\"stylesheet\" type=\"text/css\" href=\"css/ui-1.7.1-demos.css\">\n");
      out.write(
          "        <LINK rel=\"stylesheet\" type=\"text/css\" href=\"css/layout-default.css\">\n");
      out.write("\n");
      out.write("\n");
      out.write("<!-- CUSTOMIZE/OVERRIDE THE DEFAULT CSS -->\n");
      out.write("\t<style type=\"text/css\">\n");
      out.write("\n");
      out.write(
          "\t    /* remove padding and scrolling from elements that contain an Accordion OR a content-div */\n");
      out.write("\t    .ui-layout-center ,\t/* has content-div */\n");
      out.write("\t    .ui-layout-west \t/* has Accordion */\n");
      out.write("\t    .ui-layout-content { /* content-div has Accordion */\n");
      out.write("\t\t    padding: 0;\n");
      out.write("\t\t    //overflow: scroll;\n");
      out.write("\t    }\n");
      out.write("\t    .ui-layout-north P.ui-layout-content {\n");
      out.write("\t\t    line-height:\t1.4em;\n");
      out.write("            }\n");
      out.write("\t    .ui-layout-northcentral P.ui-layout-content {\n");
      out.write("\t\t    line-height:\t1.4em;\n");
      out.write("            }\n");
      out.write("\t    .ui-layout-center P.ui-layout-content {\n");
      out.write("\t\t    line-height:\t1.4em;\n");
      out.write(
          "\t\t    margin:\t\t\t0; /* remove top/bottom margins from <P> used as content-div */\n");
      out.write("                    overflow: visible;\n");
      out.write("\t\t    //overflow: scroll;\n");
      out.write("\t    }\n");
      out.write("\t    h3, h4 { /* Headers & Footer in Center & East panes */\n");
      out.write("\t\t    font-size:\t\t1.1em;\n");
      out.write("\t\t    background:\t\t#EEF;\n");
      out.write("\t\t    border:\t\t\t1px solid #BBB;\n");
      out.write("\t\t    border-width:\t0 0 1px;\n");
      out.write("\t\t    padding:\t\t7px 10px;\n");
      out.write("\t\t    margin:\t\t\t0;\n");
      out.write("\t    }\n");
      out.write("\t</style>\n");
      out.write("\n");
      out.write("\n");
      out.write("        <STYLE type=\"text/css\">\n");
      out.write("\n");
      out.write("                /*\n");
      out.write("                 *      TAB-THEME ADJUSTMENTS\n");
      out.write("                 */\n");
      out.write("                .ui-tabs-nav li {\n");
      out.write("                        white-space:    nowrap;\n");
      out.write("                }\n");
      out.write("                .ui-tabs-nav li a {\n");
      out.write("                        font-size:              1em !important;\n");
      out.write("                        padding:                4px 1.5ex 3px !important;\n");
      out.write("                }\n");
      out.write("                .ui-tabs-panel {\n");
      out.write("                        font-size:              1em !important;\n");
      out.write("                        padding:                0 1em !important;\n");
      out.write("                }\n");
      out.write("\n");
      out.write("                /*\n");
      out.write("                 *      WEST-PANE TABS\n");
      out.write("                 *\n");
      out.write("                 *      These tabs 'fill' the pane,\n");
      out.write("                 *      so the pane-border acts as the tab-border\n");
      out.write("                 */\n");
      out.write("                .ui-layout-pane-west {\n");
      out.write("                        padding:        0;\n");
      out.write("                        }\n");
      out.write("                        .ui-layout-pane-west .ui-tabs-nav {\n");
      out.write(
          "                                /* don't need border or rounded corners - tabs 'fill' the pane */\n");
      out.write("                                border-top:             0;\n");
      out.write("                                border-left:    0;\n");
      out.write("                                border-right:   0;\n");
      out.write("                                padding-bottom: 0 !important;\n");
      out.write("                                -moz-border-radius:             0;\n");
      out.write("                                -webkit-border-radius:  0;\n");
      out.write("                        }\n");
      out.write("\n");
      out.write("         </STYLE>\n");
      out.write("\n");
      out.write("\n");
      out.write("<!--  maybe these are satisfied by the next block of scripts\n");
      out.write("        <SCRIPT type=\"text/javascript\" src=\"js/jquery-1.3.2.js\"></SCRIPT>\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"js/ui-1.7.1/ui.core.js\"></SCRIPT>\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"js/ui-1.7.1/ui.tabs.js\"></SCRIPT>\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"js/ui-1.7.1/ui.sortable.js\"></SCRIPT>\n");
      out.write("\n");
      out.write(
          "        <!-- using a beta Layout version because contains some bug-fixes relevant to this page  -->\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"jquery.layout_1.2.2beta.js\"></SCRIPT>\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"js/ui-1.7.1/ui.draggable.js\"></SCRIPT>\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"js/ui-1.7.1/effects.core.js\"></SCRIPT>\n");
      out.write(
          "        <SCRIPT type=\"text/javascript\" src=\"js/ui-1.7.1/effects.slide.js\"></SCRIPT>\n");
      out.write("\n");
      out.write("-->\n");
      out.write("\n");
      out.write("\t<!-- REQUIRED scripts for layout widget -->\n");
      out.write("\t<script type=\"text/javascript\" src=\"../lib/js/jquery-1.3.2.js\"></script>\n");
      out.write(
          "\t<script type=\"text/javascript\" src=\"../lib/js/jquery-ui-1.7.2.js\"></script>\n");
      out.write(
          "\t<script type=\"text/javascript\" src=\"../lib/js/jquery.layout-1.3.rc5.js\"></script>\n");
      out.write("\t<script type=\"text/javascript\" src=\"../lib/js/debug.js\"></script>\n");
      out.write(
          "       <script type=\"text/javascript\" src=\"/SIDGridPortal/js/jsonrpc.js\"></script>\n");
      out.write("\n");
      out.write("        <SCRIPT type=\"text/javascript\">\n");
      out.write("\n");
      out.write("                $(document).ready( function() {\n");
      out.write("\n");
      out.write(
          "                        document.getElementById(\"username\").innerHTML = user;\n");
      out.write("\n");
      out.write("                        // TABS-WEST - sortable\n");
      out.write("                        $(\".ui-layout-west-tabs\")\n");
      out.write("                                .tabs()\n");
      out.write("                                .find(\".ui-tabs-nav\")\n");
      out.write("                                        .sortable({ axis: 'x', zIndex: 2 })\n");
      out.write("                        ;\n");
      out.write("\n");
      out.write("                        // TABS-CENTER - sortable\n");
      out.write("                        $(\".ui-layout-center-tabs\")\n");
      out.write("                                .tabs()\n");
      out.write("                                .find(\".ui-tabs-nav\")\n");
      out.write("                                        .sortable({ axis: 'x', zIndex: 2 })\n");
      out.write("                        ;\n");
      out.write("\n");
      out.write("                        // PAGE LAYOUT\n");
      out.write("                        $('body').layout({\n");
      out.write(
          "                                west__size:                     $('body').innerWidth() * 0.2\n");
      out.write("\t\t\t,\twest__onresize:\t\t'westLayout.resizeAll'\n");
      out.write("\t\t\t,\tcenter__onresize:\t'eastLayout.resizeAll'\n");
      out.write("                        });\n");
      out.write("                });\n");
      out.write("        </SCRIPT>\n");
      out.write("\n");
      out.write("\t<script type=\"text/javascript\">\n");
      out.write("\t    $(document).ready( function() {\n");
      out.write("               my.init();\n");
      out.write("               my.renderGadgets();\n");
      out.write("               my.listGadgets();\n");
      out.write("\t    });\n");
      out.write("\t</script>\n");
      out.write("\n");
      out.write("<!-- default container look and feel -->\n");
      out.write("<link rel=\"stylesheet\" href=\"gadgets.css\">\n");
      out.write(
          "<script type=\"text/javascript\" src=\"/gadgets/js/pubsub.js?c=1&debug=1\"></script>\n");
      out.write("<script type=\"text/javascript\" src=\"util.js\"></script>\n");
      out.write("<script type=\"text/javascript\" src=\"gadgets.js\"></script>\n");
      out.write("<script type=\"text/javascript\">\n");
      out.write("\n");
      out.write("\tvar user = \"");
      out.print(session.getAttribute("username"));
      out.write("\";\n");
      out.write("\tvar my = {};\n");
      out.write(
          "\tvar webroot = \"http://\"+document.location.hostname+\":\"+document.location.port+\"/\";\n");
      out.write("\tmy.gadgetSpecUrls = [\n");
      out.write("\t webroot+\"/SIDGridPortal/gadgets/oops4.xml\",\n");
      out.write("\t webroot+\"/SIDGridPortal/gadgets/oops-preview4.xml\",\n");
      out.write("\t webroot+\"/SIDGridPortal/gadgets/wfhistory-oops4.xml\",\n");
      out.write("\t];\n");
      out.write("\t\n");
      out.write("\tmy.LayoutManager = function() {\n");
      out.write("\t  gadgets.LayoutManager.call(this);\n");
      out.write("\t};\n");
      out.write("\t\n");
      out.write("\tmy.LayoutManager.inherits(gadgets.LayoutManager);\n");
      out.write("\t\n");
      out.write("\tmy.LayoutManager.prototype.getGadgetChrome = function(gadget) {\n");
      out.write("\t  var chromeId = 'gadget-chrome-' + gadget.id;\n");
      out.write("\t  return chromeId ? document.getElementById(chromeId) : null;\n");
      out.write("\t};\n");
      out.write("\t\n");
      out.write("\tmy.init = function() {\n");
      out.write("\t  gadgets.pubsubrouter.init(function(id) {\n");
      out.write("\t    return my.gadgetSpecUrls[parseInt(id[id.length - 1])];\n");
      out.write("\t  }, {\n");
      out.write("\t    onSubscribe: function(sender, channel) {\n");
      out.write("\t      log(sender + \" subscribes to channel '\" + channel + \"'\");\n");
      out.write("\t      // return true to reject the request.\n");
      out.write("\t    },\n");
      out.write("\t    onUnsubscribe: function(sender, channel) {\n");
      out.write("\t      log(sender + \" unsubscribes from channel '\" + channel + \"'\");\n");
      out.write("\t      // return true to reject the request.\n");
      out.write("\t    },\n");
      out.write("\t    onPublish: function(sender, channel, message) {\n");
      out.write(
          "\t      log(sender + \" publishes '\" + message + \"' to channel '\" + channel + \"'\");\n");
      out.write("\t      // return true to reject the request.\n");
      out.write("\t    }\n");
      out.write("\t  });\n");
      out.write("\t  gadgets.container.layoutManager = new my.LayoutManager();\n");
      out.write("\t};\n");
      out.write("\t\n");
      out.write("\tmy.renderGadgets = function() {\n");
      out.write("\t    var secureToken = user+\":\"+user+\":appid:cont:url:0\";\n");
      out.write("\t    for (var i = 0; i < my.gadgetSpecUrls.length; ++i) {\n");
      out.write("\t        var gadget = gadgets.container.createGadget(\n");
      out.write("\t            {specUrl: my.gadgetSpecUrls[i], secureToken:secureToken});\n");
      out.write(
          "\t            //{specUrl: my.gadgetSpecUrls[i], title: (i ? \"Subscriber\" : \"Publisher\"), secureToken:secureToken });\n");
      out.write("\t        gadgets.container.addGadget(gadget);\n");
      out.write("\t        gadgets.container.renderGadget(gadget);\n");
      out.write("\t    }\n");
      out.write("\t};\n");
      out.write("\tmy.changeSimGagdget = function(){\n");
      out.write("         var gadgetList = document.getElementById(\"gadgetList\");\n");
      out.write("         var newUrl = gadgetList.options[gadgetList.selectedIndex].value;\n");
      out.write("         //var url = document.getElementById(\"gadgetUrl\");\n");
      out.write("         //url.value = newUrl;\n");
      out.write("         var secureToken = user+\":\"+user+\":appid:cont:newUrl:0\";\n");
      out.write(
          "         var gadget = gadgets.container.createGadget({specUrl: newUrl, secureToken: secureToken, id:0});\n");
      out.write("         // remove the old sim gadget in the container\n");
      out.write("         var chrome= document.getElementById(\"gadget-chrome-0\");\n");
      out.write("         while(chrome.firstChild){\n");
      out.write("           chrome.removeChild(chrome.firstChild);\n");
      out.write("         }\n");
      out.write("         gadgets.container.gadgets_[0] = gadget;          \n");
      out.write("         gadgets.container.renderGadget(gadget);\n");
      out.write("       };\n");
      out.write("       my.listGadgets = function(){\n");
      out.write("        var jsonrpc = new JSONRpcClient(\"/SIDGridPortal/Old-JSONRPC\");\n");
      out.write("        var result = jsonrpc.AppMgr.showAllApplication();\n");
      out.write("        var gadgetList = document.getElementById(\"gadgetList\");\n");
      out.write("        for( var i=0; i<result.list.length; i++){\n");
      out.write("          //display the gadgets\n");
      out.write("          // get the current server address\n");
      out.write("          var rootUrl = (document.location.href).split(\"/\");\n");
      out.write("          //alert(rootUrl);\n");
      out.write(
          "\t   var gadgetUrl = rootUrl[0]+\"//\"+rootUrl[1]+rootUrl[2]+\"/SIDGridGadgets/\"+result.list[i].appName+\".xml\";\n");
      out.write("         console.log(gadgetUrl);\n");
      out.write(
          "\t  gadgetList.options[gadgetList.length] = new Option(result.list[i].appName, gadgetUrl);\n");
      out.write("\t \n");
      out.write("      }\n");
      out.write("  \t//list all the scripts\n");
      out.write("  \tvar result = jsonrpc.AppMgr.showAllScripts(\"oops\");\n");
      out.write("  \tvar gadgetList = document.getElementById(\"gadgetList\");\n");
      out.write("  \tfor( var i=0; i<result.list.length; i++){\n");
      out.write("       \tvar rootUrl = (document.location.href).split(\"/\");\n");
      out.write("       \tvar scriptname = result.list[i].scriptName;\n");
      out.write("       \tvar scriptfullname;\n");
      out.write("       \tif (result.list[i].version != null )\n");
      out.write("         \t\tscriptfullname = scriptname+\"(\"+result.list[i].version+\")\";\n");
      out.write("      \t\t else\n");
      out.write("         \t\tscriptfullname = scriptname;\n");
      out.write("\n");
      out.write("\t\tvar gadgetUrl;\n");
      out.write("       \tif (result.list[i].gadgetLink == null )\n");
      out.write(
          "         \t\tgadgetUrl = rootUrl[0]+\"//\"+rootUrl[1]+rootUrl[2]+\"/SIDGridGadgets/modpipe/\"+scriptfullname+\"/\"+scriptname+\".xml\";\n");
      out.write("       \telse\n");
      out.write("         \t\tgadgetUrl = result.list[i].gadgetLink;\n");
      out.write("       \tconsole.log(gadgetUrl);\n");
      out.write(
          "\t\tgadgetList.options[gadgetList.length] = new Option(scriptfullname , gadgetUrl);\n");
      out.write("  \t}\n");
      out.write("\n");
      out.write("\t};\n");
      out.write("\n");
      out.write("\tfunction log(message) {\n");
      out.write(
          "\t    document.getElementById(\"output\").innerHTML += gadgets.util.escapeString(message) + \"<br/>\";\n");
      out.write("\t}\n");
      out.write("\n");
      out.write("</script>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      out.write("\n");
      out.write("\t<div class=\"ui-layout-north\" style=\"display: none;\">OOPS Science Portal\n");
      out.write("\t    <div style=\"float:right\">\n");
      out.write("                <div style=\"float:left\">Logged in as&nbsp;</div>\n");
      out.write("\t        <div id=username style=\"font-weight:bold;float:left\"></div>&nbsp;\n");
      out.write("\t        <a href=/SIDGridPortal/jsp/logout.jsp>Logout</a>\n");
      out.write("            </div>\n");
      out.write("\t</div>\n");
      out.write("\t\n");
      out.write("\t<div class=\"ui-layout-west\" style=\"overflow:scroll\">\n");
      out.write("\t    <DIV id=\"left_column_tabs\" class=\"ui-layout-west-tabs\">\n");
      out.write("\t        <UL>                \n");
      out.write("\t            <LI><A href=\"#tabs-west-1\">Workflows</A></LI>\n");
      out.write("\t        </UL>\n");
      out.write("\t        <DIV class=\"ui-layout-content\">\n");
      out.write("\t            <DIV id=\"tabs-west-1\">     \n");
      out.write(
          "\t                <div id=\"gadget-chrome-2\" class=\"gadgets-gadget-chrome\" style=\"float:left;\"></div>\n");
      out.write("                    </DIV>\n");
      out.write("\t        </DIV>\n");
      out.write("\t    </DIV>\n");
      out.write("\t</div>\n");
      out.write("\t\n");
      out.write("\t\n");
      out.write("\t<div class=\"ui-layout-center\" style=\"display: none;\"> \n");
      out.write(
          "\t    <DIV id=\"main_app_tabs\" class=\"ui-layout-center-tabs\" style=\"height:100%\">\n");
      out.write("\t        <UL>                \n");
      out.write("\t            <LI><A href=\"#tabs-center-1\">Run Simulations</A></LI>\n");
      out.write("\t            <LI><A href=\"#tabs-center-2\">View Results</A></LI>\n");
      out.write("\t        </UL>        \n");
      out.write("\t    \n");
      out.write("\t        <!-- add wrapper that Layout will auto-size to 'fill space' -->   \n");
      out.write("\t        <DIV class=\"ui-layout-content\">\n");
      out.write("\t            <DIV id=\"tabs-center-1\">     \n");
      out.write(
          "                       <select id=\"gadgetList\" onchange=\"my.changeSimGagdget();\">\n");
      out.write(
          "                          <option value=\"../gadgets/oops4.xml\">oops4</option>\n");
      out.write("                       </select>\n");
      out.write("\n");
      out.write(
          "\t                <div id=\"gadget-chrome-0\" class=\"gadgets-gadget-chrome\" style=\"float:left;width:100%\"></div>\n");
      out.write("\t            </DIV>\n");
      out.write("\t            <DIV id=\"tabs-center-2\">  \n");
      out.write(
          "\t                <div id=\"gadget-chrome-1\" class=\"gadgets-gadget-chrome\" style=\"float:left;width:100%\"></div>\n");
      out.write("\t            </DIV>\n");
      out.write("\t        </DIV><!--- END content-body --->\n");
      out.write("\t    </DIV>\n");
      out.write("\t\n");
      out.write("\t    <div id=\"output\" style=\"clear: left;display:none\"></div>\n");
      out.write("\t\n");
      out.write("\t</div>\n");
      out.write("\t\n");
      out.write("\n");
      out.write("</body>\n");
      out.write("</html> \n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
예제 #11
0
 /*
  * Sets the Last-Modified entity header field, if it has not
  * already been set and if the value is meaningful.  Called before
  * doGet, to ensure that headers are set before response data is
  * written.  A subclass might have set this header already, so we
  * check.
  */
 private void maybeSetLastModified(HttpServletResponse resp, long lastModified) {
   if (resp.containsHeader(HEADER_LASTMOD)) return;
   if (lastModified >= 0) resp.setDateHeader(HEADER_LASTMOD, lastModified);
 }
예제 #12
0
  // *****************************************************
  // Process the initial request from Proshop_main
  // *****************************************************
  //
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    //
    //  Prevent caching so sessions are not mangled
    //
    resp.setHeader("Pragma", "no-cache"); // for HTTP 1.0
    resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // for HTTP 1.1
    resp.setDateHeader("Expires", 0); // prevents caching at the proxy server

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    HttpSession session = SystemUtils.verifyHotel(req, out); // check for intruder

    if (session == null) {

      return;
    }

    String club = (String) session.getAttribute("club"); // get club name
    String user = (String) session.getAttribute("user");

    if (req.getParameter("clubswitch") != null
        && req.getParameter("clubswitch").equals("1")
        && req.getParameter("club") != null) {

      //
      //  Request is to switch clubs - switch the db (TPC or Demo sites)
      //
      String newClub = req.getParameter("club");

      Connection con = null;

      //
      //  release the old connection
      //
      ConnHolder holder = (ConnHolder) session.getAttribute("connect");

      if (holder != null) {

        con = holder.getConn(); // get the connection for previous club
      }

      if (con != null) {
        /*
                   // abandon any unfinished transactions
                   try { con.rollback(); }
                   catch (Exception ignore) {}
        */
        // close/release the connection
        try {
          con.close();
        } catch (Exception ignore) {
        }
      }

      //
      //  Connect to the new club
      //
      try {
        con = dbConn.Connect(newClub); // get connection to this club's db
      } catch (Exception ignore) {
      }

      holder = new ConnHolder(con);

      session.setAttribute("club", newClub);
      session.setAttribute("connect", holder);

      out.println("<HTML><HEAD><Title>Switching Sites</Title>");
      out.println("<meta http-equiv=\"Refresh\" content=\"0; url=/" + rev + "/hotel_home.htm\">");
      out.println("</HEAD>");
      out.println("<BODY><CENTER><BR>");
      out.println("<BR><H2>Switching Sites</H2><BR>");
      out.println("<a href=\"/" + rev + "/hotel_home.htm\" target=_top>Continue</a><br>");
      out.println("</CENTER></BODY></HTML>");
      out.close();
      return;
    }

    //
    //  Call is to display the Home page.
    //
    out.println("<html><head>");
    out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">");
    out.println("<meta http-equiv=\"Content-Language\" content=\"en-us\">");
    out.println("<title> \"ForeTees Hotel Home Page\"</title>");
    out.println(
        "<script language=\"JavaScript\" src=\"/" + rev + "/web utilities/foretees.js\"></script>");

    out.println(
        "<style type=\"text/css\"> body {text-align: center} </style>"); // so body will align on
                                                                         // center

    out.println("</head>");

    out.println("<body bgcolor=\"#CCCCAA\" text=\"#000000\">");

    out.println("<div style=\"align:center; margin:0px auto;\">");

    if (club.startsWith("tpc") && user.startsWith("passport")) { // if TPC Passport user

      out.println("<br><H3>Welcome to ForeTees</H3><br>");

      String clubname = "";
      String fullname = "";

      Connection con = null;

      try {
        con = dbConn.Connect(rev); // get connection to the Vx db

        //
        //  Get the club names for each TPC club
        //
        PreparedStatement pstmt =
            con.prepareStatement("SELECT fullname FROM clubs WHERE clubname=?");

        pstmt.clearParameters();
        pstmt.setString(1, club);
        ResultSet rs = pstmt.executeQuery();

        if (rs.next()) {

          fullname = rs.getString("fullname"); // get the club's full name
        }

        out.println("<p>You are currently connected to: <b>" + fullname + "</b><br><br>");
        out.println("To continue with this site, simply use the navigation menus above.<br><br>");
        out.println("To switch sites, click on the desired club name below.</p><br>");

        //
        //  Get the club names for each TPC club
        //
        pstmt =
            con.prepareStatement(
                "SELECT clubname, fullname FROM clubs WHERE inactive=0 AND clubname LIKE 'tpc%' ORDER BY fullname");

        pstmt.clearParameters();
        rs = pstmt.executeQuery();

        while (rs.next()) {

          clubname = rs.getString("clubname"); // get a club name

          if (clubname.startsWith("tpc")) {

            fullname = rs.getString("fullname"); // get the club's full name

            out.println(
                "<a href=\"Hotel_home?clubswitch=1&club="
                    + clubname
                    + "\" target=_top>"
                    + fullname
                    + "</a><br>");
          }
        }
        pstmt.close();

      } catch (Exception e) {

        // Error connecting to db....
        out.println(
            "<BR><BR>Sorry, we encountered an error while trying to connect to the database.");
        // out.println("<br><br>Error: " + e.toString() + "<br>");
        out.println("<BR><BR> <A HREF=\"Hotel_home\">Return</A>.");
        out.println("</BODY></HTML>");
        return;
      }

    } else {

      out.println(
          "<BR><BR> You have entered here by mistake. Please contact ForeTees Support at 651-765-6006.");
      out.println("</BODY></HTML>");
    }
    out.println("</div></BODY></HTML>");
  } // end of doGet
예제 #13
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\n');
      out.write('\n');

      response.setHeader("Pragma", "no-cache"); // HTTP 1.0
      response.setDateHeader("Expires", 0);
      response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1

      String _adminid = "";
      String _adminname = "";
      String _admintype = "";
      String _admingroup = "";
      String _approval = "";
      String _adminclass = "";
      String _adminmail = "";

      try {

        _adminid = (String) session.getAttribute("adminid");

        if (_adminid == null || _adminid.length() == 0 || _adminid.equals("null")) {
          response.sendRedirect("/admin/login_first.html");
          return;
        }

        _adminname = (String) session.getAttribute("adminname");
        _admintype = (String) session.getAttribute("admintype");
        _admingroup = (String) session.getAttribute("admingroup");
        _approval = (String) session.getAttribute("approval");
        _adminclass = (String) session.getAttribute("adminclass");
        _adminmail = (String) session.getAttribute("admin_email");
        // session.setMaxInactiveInterval(60*60);

      } catch (Exception e) {
        response.sendRedirect("/admin/login_first.html");
        return;
      }

      out.write('\n');

      // response.resetBuffer();
      response.reset();

      String attachPath = request.getParameter("attachPath");
      String attachFile = request.getParameter("attachFile");
      String attachRealFile = request.getParameter("attachRealFile");

      try {

        String savePath = application.getRealPath(attachPath) + File.separator;
        File file = new File(savePath + attachRealFile);

        if (!file.exists()) {
          throw new UserDefinedException("File does not exist.");
        }

        // file read ..
        response.setContentType("application/octet-stream");
        response.setHeader("Content-Length", "" + file.length());
        response.setHeader("Content-Disposition", "attachment; filename=" + attachFile + ";");

        byte[] buf = new byte[8192];

        int cnt = 0;

        BufferedInputStream inStream = new BufferedInputStream(new FileInputStream(file));
        BufferedOutputStream outStream = new BufferedOutputStream(response.getOutputStream());

        try {
          while ((cnt = inStream.read(buf)) != -1) {
            outStream.write(buf, 0, cnt);
          }

          outStream.flush();
        } catch (Exception e) {
          throw e;
        } finally {
          if (outStream != null) outStream.close();
          if (inStream != null) inStream.close();
        }

      } catch (Exception e) {
        out.println(
            "<html><script language='javascript'>alert('" + e.getMessage() + "');</script></html>");
      }

    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            out.clearBuffer();
          } catch (java.io.IOException e) {
          }
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }