public int doEndTag() throws JspException {
    if ((jspFile.indexOf("..") >= 0)
        || (jspFile.toUpperCase().indexOf("/WEB-INF/") != 0)
        || (jspFile.toUpperCase().indexOf("/META-INF/") != 0))
      throw new JspTagException("Invalid JSP file " + jspFile);

    InputStream in = pageContext.getServletContext().getResourceAsStream(jspFile);

    if (in == null) throw new JspTagException("Unable to find JSP file: " + jspFile);

    InputStreamReader reader = new InputStreamReader(in);
    JspWriter out = pageContext.getOut();

    try {
      out.println("<body>");
      out.println("<pre>");
      for (int ch = in.read(); ch != -1; ch = in.read())
        if (ch == '<') out.print("&lt;");
        else out.print((char) ch);
      out.println("</pre>");
      out.println("</body>");
    } catch (IOException ex) {
      throw new JspTagException("IOException: " + ex.toString());
    }
    return super.doEndTag();
  }
  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; 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;
      _jspx_resourceInjector =
          (org.apache.jasper.runtime.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write('\n');
      out.write('\n');
      out.write("\n<!DOCTYPE html>\n<html>\n<head>\n");
      JspHelper.createTitle(out, request, request.getParameter("filename"));
      out.write("\n</head>\n<body onload=\"document.goto.dir.focus()\">\n");

      Configuration conf = (Configuration) getServletContext().getAttribute(JspHelper.CURRENT_CONF);
      generateFileChunks(out, request, conf);

      out.write("\n<hr>\n");

      generateFileDetails(out, request, conf);

      out.write("\n\n<h2>Local logs</h2>\n<a href=\"/logs/\">Log</a> directory\n\n");

      out.println(ServletUtil.htmlFooter());

      out.write('\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 {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Example #3
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('\n');
      out.write('\n');
      out.write("\n\n\n\n<html>\n<head>\n");
      JspHelper.createTitle(out, request, request.getParameter("filename"));
      out.write("\n</head>\n<body>\n<form action=\"/tail.jsp\" method=\"GET\">\n");

      generateFileChunks(out, request);

      out.write("\n</form>\n<hr>\n\n<h2>Local logs</h2>\n<a href=\"/logs/\">Log</a> directory\n\n");

      out.println(ServletUtil.htmlFooter());

      out.write('\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);
    }
  }
Example #4
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;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE html>\n");
      out.write("<html>\n");
      out.write("    <head>\n");
      out.write(
          "        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("        <title>JSP Page</title>\n");
      out.write("    </head>\n");
      out.write("    <body>\n");
      out.write("        <p>Server date and time: ");
      out.println(new Date());
      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);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Example #5
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; 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;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" >\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n");
      out.write("<title>Neonat论坛</title>\r\n");
      out.write(
          "<link href=\"forum.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("<div id=\"page\">\r\n");
      out.write("  <div id=\"header\">\r\n");
      out.write("    <div class=\"clearfix\">\r\n");
      out.write("      <div style=\"padding:15px 0 10px 0;\">\r\n");
      out.write("          <div class=\"title_logo\"></div>\r\n");
      out.write("      </div>\r\n");
      out.write(
          "      <div class=\"toolbar\"><a href=\"new.jsp\"><img src=\"images/post.gif\" /></a><div style=\"float:right\">论坛发帖总数:\r\n");
      out.write("\t\t");

      BundleContext context = Activator.getContext();
      NeonatModelService ms =
          context.getService(context.getServiceReference(NeonatModelService.class));
      Board board = ms.getBoard();
      out.println(board.getTopicCount());

      out.write("\r\n");
      out.write("\t  </div></div>\r\n");
      out.write("\t  \r\n");
      out.write("\t <table id=\"forum_main\" cellspacing=\"1\">\r\n");
      out.write("        <thead>\r\n");
      out.write("          <tr>\r\n");
      out.write("            <td bgcolor=\"#477AA5\" style=\"width: 20px;\">ID</td>\r\n");
      out.write(
          "            <td colspan=\"2\" bgcolor=\"#477AA5\" style=\"border-left: 1px solid white;\">主题</td>\r\n");
      out.write("            <td bgcolor=\"#477AA5\" style=\"width: 50px;\">回复</td>\r\n");
      out.write("            <td bgcolor=\"#477AA5\" style=\"width: 100px;\">发帖时间</td>\r\n");
      out.write("            <td bgcolor=\"#477AA5\" style=\"width: 100px;\">作者</td>\r\n");
      out.write("          </tr>\r\n");
      out.write("        </thead>\r\n");
      out.write("        <tbody>\r\n");
      out.write("           ");

      for (Iterator<Entry<Integer, Topic>> i = board.getTopicsMap().entrySet().iterator();
          i.hasNext(); ) {
        Topic topic = i.next().getValue();

        out.write("\r\n");
        out.write("\t        <tr>\r\n");
        out.write("\t            <td class=\"topic_id\">");
        out.print(topic.getId());
        out.write("</td>\r\n");
        out.write("\t            <td class=\"topic_icon unread_topic\"></td>\r\n");
        out.write("\t            <td class=\"topic_title\"><a href=\"content.jsp?id=");
        out.print(topic.getId());
        out.write('"');
        out.write('>');
        out.print(topic.getTitle());
        out.write("</a></td>\r\n");
        out.write("\t            <td class=\"topic_replies\">");
        out.print(topic.getReplyTopics().size());
        out.write("</td>\r\n");
        out.write("\t            <td class=\"topic_time\">");
        out.print(topic.getDate().toLocaleString());
        out.write("</td>\r\n");
        out.write(
            "\t            <td class=\"topic_author\"><a href=\"#\" target=\"_blank\">IcyFenix</a></td>\r\n");
        out.write("\t        </tr>\r\n");
        out.write("\t        ");
      }

      out.write("\r\n");
      out.write("      </table>\r\n");
      out.write("      <br />\r\n");
      out.write(
          "      <div style=\"text-align:center\">©2011-2012 Neonat BBS All rights reserved.</div>\r\n");
      out.write("    </div>\r\n");
      out.write("  </div>\r\n");
      out.write("</div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } 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);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Example #6
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=UTF-8");
      pageContext =
          _jspxFactory.getPageContext(this, request, response, "/error.jsp", true, 8192, true);
      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");

      /** This include page ensures that the handler exists and is ready to be accessed. */
      CrawlJobHandler handler = (CrawlJobHandler) application.getAttribute("handler");
      Heritrix heritrix = (Heritrix) application.getAttribute("heritrix");

      // If handler is empty then this is the first time this bit of code is
      // being run since the server came online. In that case get or create the
      // handler.
      if (handler == null) {
        if (Heritrix.isSingleInstance()) {
          heritrix = Heritrix.getSingleInstance();
          handler = heritrix.getJobHandler();
          application.setAttribute("heritrix", heritrix);
          application.setAttribute("handler", handler);
        } else {
          // TODO:
          // If we get here, then there are multiple heritrix instances
          // and we have to put up a screen allowing the user choose between.
          // Otherwise, there is no Heritrix instance.  Thats a problem.
          throw new RuntimeException(
              "No heritrix instance (or multiple "
                  + "to choose from and we haven't implemented this yet)");
        }
      }

      // ensure controller's settingsHandler is always thread-installed
      // in web ui threads
      if (handler != null) {
        CrawlJob job = handler.getCurrentJob();
        if (job != null) {
          CrawlController controller = job.getController();
          if (controller != null) {
            controller.installThreadContextSettingsHandler();
          }
        }
      }

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

      String title = "Help";
      int tab = 6;

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

      String currentHeritrixName =
          (heritrix == null)
              ? "No current Heritrix instance"
              : (heritrix.getMBeanName() == null)
                  ? heritrix.getInstances().keySet().iterator().next().toString()
                  : heritrix.getMBeanName().toString();

      /**
       * An include file that handles the "look" and navigation of a web page. Include at top (where
       * you would normally begin the HTML code). If used, the include "foot.jsp" should be included
       * at the end of the HTML code. It will close any table, body and html tags left open in this
       * one. Any custom HTML code is thus placed between the two.
       *
       * <p>The following variables must exist prior to this file being included:
       *
       * <p>String title - Title of the web page int tab - Which to display as 'selected'. 0 -
       * Console 1 - Jobs 2 - Profiles 3 - Logs 4 - Reports 5 - Settings 6 - Help
       *
       * <p>SimpleHandler handler - In general this is provided by the include page 'handler.jsp'
       * which should be included prior to this one.
       *
       * @author Kristinn Sigurdsson
       */
      String shortJobStatus = null;
      if (handler.getCurrentJob() != null) {
        shortJobStatus = TextUtils.getFirstWord(handler.getCurrentJob().getStatus());
      }
      String favicon = System.getProperties().getProperty("heritrix.favicon", "h.ico");

      out.write("\n");

      StatisticsTracker stats = null;
      if (handler.getCurrentJob() != null) {
        // Assume that StatisticsTracker is being used.
        stats = (StatisticsTracker) handler.getCurrentJob().getStatisticsTracking();
      }

      out.write("\n");
      out.write("\n\n");
      out.write("<html>\n    ");
      out.write("<head>\n    \t");
      out.write(
          "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n        ");
      out.write("<title>Heritrix: ");
      out.print(title);
      out.write("</title>\n        ");
      out.write("<link rel=\"stylesheet\" \n            href=\"");
      out.print(request.getContextPath());
      out.write("/css/heritrix.css\">\n        ");
      out.write("<link rel=\"icon\" href=\"");
      out.print(request.getContextPath());
      out.write("/images/");
      out.print(favicon);
      out.write("\" type=\"image/x-icon\" />\n        ");
      out.write("<link rel=\"shortcut icon\" href=\"");
      out.print(request.getContextPath());
      out.write("/images/");
      out.print(favicon);
      out.write("\" type=\"image/x-icon\" />\n        ");
      out.write("<script src=\"/js/util.js\">\n        ");
      out.write("</script>\n    ");
      out.write("</head>\n\n    ");
      out.write("<body>\n        ");
      out.write(
          "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n            ");
      out.write("<tr>\n                ");
      out.write("<td>\n                    ");
      out.write(
          "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\">\n                        ");
      out.write("<tr>\n                            ");
      out.write(
          "<td height=\"60\" width=\"155\" valign=\"top\" nowrap>\n                                ");
      out.write(
          "<table border=\"0\" width=\"155\" cellspacing=\"0\" cellpadding=\"0\" height=\"60\">\n                                    ");
      out.write("<tr>\n                                        ");
      out.write(
          "<td align=\"center\" height=\"40\" valign=\"bottom\">\n                                            ");
      out.write("<a border=\"0\" \n                                            href=\"");
      out.print(request.getContextPath());
      out.write("/index.jsp\">");
      out.write("<img border=\"0\" src=\"");
      out.print(request.getContextPath());
      out.write("/images/logo.gif\" height=\"37\" width=\"145\">");
      out.write("</a>\n                                        ");
      out.write("</td>\n                                    ");
      out.write("</tr>\n                                    ");
      out.write("<tr>\n                                        ");
      out.write("<td class=\"subheading\">\n                                            ");
      out.print(title);
      out.write("\n                                        ");
      out.write("</td>\n                                    ");
      out.write("</tr>\n                                ");
      out.write("</table>\n                            ");
      out.write("</td>\n                            ");
      out.write(
          "<td width=\"5\" nowrap>\n                                &nbsp;&nbsp;\n                            ");
      out.write("</td>\n                            ");
      out.write("<td width=\"460\" align=\"left\" nowrap>\n                                ");
      out.write(
          "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"60\">\n                                    ");
      out.write("<tr>\n                                        ");
      out.write("<td colspan=\"2\" nowrap>\n                                            ");

      SimpleDateFormat sdf = new SimpleDateFormat("MMM. d, yyyy HH:mm:ss");
      sdf.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));

      out.write("\n                                            ");
      out.write("<b>\n                                                Status as of ");
      out.write("<a style=\"color: #000000\" href=\"");
      out.print(request.getRequestURL());
      out.write("\">");
      out.print(sdf.format(new java.util.Date()));
      out.write(" GMT");
      out.write("</a>\n                                            ");
      out.write(
          "</b>\n                                            &nbsp;&nbsp;\n                                            ");
      out.write("<span style=\"text-align:right\">\n                                            ");
      out.write(
          "<b>\n                                                Alerts: \n                                            ");
      out.write("</b>\n                                            ");
      if (heritrix.getAlertsCount() == 0) {
        out.write("\n                                                ");
        out.write("<a style=\"color: #000000; text-decoration: none\" href=\"");
        out.print(request.getContextPath());
        out.write("/console/alerts.jsp\">no alerts");
        out.write("</a>\n                                            ");
      } else if (heritrix.getNewAlertsCount() > 0) {
        out.write("\n                                                ");
        out.write("<b>");
        out.write("<a href=\"");
        out.print(request.getContextPath());
        out.write("/console/alerts.jsp\">");
        out.print(heritrix.getAlerts().size());
        out.write(" (");
        out.print(heritrix.getNewAlertsCount());
        out.write(" new)");
        out.write("</a>");
        out.write("</b>\n                                            ");
      } else {
        out.write("\n                                                ");
        out.write("<a style=\"color: #000000\" href=\"");
        out.print(request.getContextPath());
        out.write("/console/alerts.jsp\">");
        out.print(heritrix.getAlertsCount());
        out.write(" (");
        out.print(heritrix.getNewAlertsCount());
        out.write(" new)");
        out.write("</a>\n                                            ");
      }
      out.write("\n                                            ");
      out.write("</span>\n                                        ");
      out.write("</td>\n                                    ");
      out.write("</tr>\n                                    ");
      out.write("<tr>\n                                        ");
      out.write("<td valign=\"top\" nowrap>\n\t\t\t\t\t\t\t\t\t\t");
      out.print(
          handler.isRunning()
              ? "<span class='status'>Crawling Jobs</span>"
              : "<span class='status'>Holding Jobs</span>");
      out.write("<i>&nbsp;");
      out.write("</i>\n\t\t\t\t\t\t\t\t\t\t");
      out.write("</td>\n\t\t\t\t\t\t\t\t\t\t");
      out.write("<td valign=\"top\" align=\"right\" nowrap>\n\t\t\t\t\t\t\t\t\t\t");

      if (handler.isRunning() || handler.isCrawling()) {
        if (handler.getCurrentJob() != null) {
          out.write("\n\t\t\t\t\t\t\t\t\t\t");
          out.write("<span class='status'>\n\t\t\t\t\t\t\t\t\t\t");
          out.print(shortJobStatus);
          out.write("</span> job:\n\t\t\t\t\t\t\t\t\t\t");
          out.write("<i>");
          out.print(handler.getCurrentJob().getJobName());
          out.write("</i>\n\t\t\t\t\t\t\t\t\t\t");

        } else {
          out.println("No job ready <a href=\"");
          out.println(request.getContextPath());
          out.println("/jobs.jsp\" style='color: #000000'>(create new)</a>");
        }
      }

      out.write("\n\t\t\t\t\t\t\t\t\t\t");
      out.write("</td>\n                                    ");
      out.write("</tr>\n                                    ");
      out.write("<tr>\n                                        ");
      out.write("<td nowrap>\n                                            ");
      out.print(handler.getPendingJobs().size());
      out.write(
          "\n                                            jobs\n                                            ");
      out.write("<a style=\"color: #000000\" href=\"");
      out.print(request.getContextPath());
      out.write("/jobs.jsp#pending\">pending");
      out.write("</a>,\n                                            ");
      out.print(handler.getCompletedJobs().size());
      out.write("\n                                            ");
      out.write("<a style=\"color: #000000\" href=\"");
      out.print(request.getContextPath());
      out.write("/jobs.jsp#completed\">completed");
      out.write(
          "</a>\n                                            &nbsp;\n                                        ");
      out.write("</td>\n                                        ");
      out.write("<td nowrap align=\"right\">\n                                            ");
      if (handler.isCrawling()) {
        out.write("\n                                                    ");
        out.print((stats != null) ? stats.successfullyFetchedCount() : 0);
        out.write(" URIs in \n\t\t                                            ");
        out.print(
            ArchiveUtils.formatMillisecondsToConventional(
                ((stats != null) ? (stats.getCrawlerTotalElapsedTime()) : 0), false));
        out.write("\n\t\t                                            (");
        out.print(
            ArchiveUtils.doubleToString(
                ((stats != null) ? stats.currentProcessedDocsPerSec() : 0), 2));
        out.write("/sec)\n                                            ");
      }
      out.write("\n                                        ");
      out.write("</td>\n                                    ");
      out.write("</tr>\n                                ");
      out.write("</table>\n                            ");
      out.write("</td>\n                        ");
      out.write("</tr>\n                    ");
      out.write("</table>\n                ");
      out.write("</td>\n                ");
      out.write("<td width=\"100%\" nowrap>\n                    &nbsp;\n                ");
      out.write("</td>\n            ");
      out.write("</tr>\n            ");
      out.write("<tr>\n                ");
      out.write("<td bgcolor=\"#0000FF\" height=\"1\" colspan=\"4\">\n                ");
      out.write("</td>\n            ");
      out.write("</tr>\n            ");
      out.write("<tr>\n                ");
      out.write("<td colspan=\"4\" height=\"20\">\n                    ");
      out.write(
          "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"20\">\n                        ");
      out.write("<tr>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 0 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/index.jsp\" class=\"tab_text");
      out.print(tab == 0 ? "_selected" : "");
      out.write("\">Console");
      out.write("</a>\n                            ");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 1 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/jobs.jsp\" class=\"tab_text");
      out.print(tab == 1 ? "_selected" : "");
      out.write("\">Jobs");
      out.write("</a>\n                            ");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 2 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/profiles.jsp\" class=\"tab_text");
      out.print(tab == 2 ? "_selected" : "");
      out.write("\">Profiles");
      out.write("</a>\n                            ");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 3 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/logs.jsp\" class=\"tab_text");
      out.print(tab == 3 ? "_selected" : "");
      out.write("\">Logs");
      out.write("</a>\n                            ");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 4 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/reports.jsp\" class=\"tab_text");
      out.print(tab == 4 ? "_selected" : "");
      out.write("\">Reports");
      out.write("</a>\n                            ");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 5 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/setup.jsp\" class=\"tab_text");
      out.print(tab == 5 ? "_selected" : "");
      out.write("\">Setup");
      out.write("</a>\n                            ");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab_seperator\">&nbsp;");
      out.write("</td>\n                            ");
      out.write("<td class=\"tab");
      out.print(tab == 6 ? "_selected" : "");
      out.write("\">\n                                ");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/help.jsp\" class=\"tab_text");
      out.print(tab == 6 ? "_selected" : "");
      out.write("\">Help");
      out.write("</a>\n                             ");
      out.write("</td>\n                            ");
      out.write("<td width=\"100%\">\n                            ");
      out.write("</td>\n                        ");
      out.write("</tr>\n                    ");
      out.write("</table>\n                ");
      out.write("</td>\n            ");
      out.write("</tr>\n            ");
      out.write("<tr>\n                ");
      out.write("<td bgcolor=\"#0000FF\" height=\"1\" colspan=\"4\">");
      out.write("</td>\n            ");
      out.write("</tr>\n         ");
      out.write("</table>\n                    ");
      out.write("<!-- MAIN BODY -->\n");
      out.write("\n\n");
      out.write("<div class=\"margined\">\n    ");
      out.write("<h1>Heritrix online help");
      out.write("</h1>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/about.jsp\">About Heritrix");
      out.write("</a>");
      out.write("</b>");
      out.write("</br>\n    Includes license and current environment information.\n");
      out.write("</p>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write("<a target=\"_blank\" \n    href=\"");
      out.print(request.getContextPath());
      out.write("/docs/articles/user_manual/index.html\">User\n        Manual");
      out.write("</a>");
      out.write("</b>");
      out.write(
          "<br> Covers creating, configuring, launching,\n        monitoring and analysing crawl jobs. For all users.\n");
      out.write("</p>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write("<a target=\"_blank\" \n        href=\"");
      out.print(request.getContextPath());
      out.write("/docs/articles/developer_manual/index.html\">Developer Manual");
      out.write("</a>");
      out.write("</b>");
      out.write(
          "<br> Covers how to write add on modules for Heritrix\n        and provides in depth coverage of Heritrix's architecture. For\n        advanced users.\n");
      out.write("</p>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write("<a target=\"_blank\" \n        href=\"");
      out.print(request.getContextPath());
      out.write("/docs/articles/releasenotes/index.html\">Release Notes");
      out.write("</a>");
      out.write("</b>");
      out.write("<br>\n");
      out.write("</p>\n");
      out.write("<p>\n\t");
      out.write("<b>");
      out.write(
          "<a href=\"http://crawler.archive.org/issue-tracking.html\" target=\"_blank\">Issue Tracking");
      out.write("</a>");
      out.write("</b>");
      out.write(
          "<br />\n\tIf you have found a bug or would like to see new features in Heritrix, check the following links:\n\t");
      out.write("<ul>\n\t\t");
      out.write("<li>");
      out.write(
          "<a href=\"http://sourceforge.net/tracker/?atid=539099&amp;group_id=73833&amp;func=browse\" target=\"_blank\">Bugs");
      out.write("</a>");
      out.write("</li>\n\t\t");
      out.write("<li>");
      out.write(
          "<a href=\"http://sourceforge.net/tracker/?atid=539102&amp;group_id=73833&amp;func=browse\" target=\"_blank\">Feature Requests");
      out.write("</a>");
      out.write("</li>\n\t");
      out.write("</ul>\n");
      out.write("</p>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write(
          "<a href=\"http://crawler.archive.org/mail-lists.html\" target=\"_blank\">Mailing Lists");
      out.write("</a>");
      out.write("</b>");
      out.write("<br />\n    For general discussion on Heritrix, use our ");
      out.write(
          "<a href=\"http://groups.yahoo.com/group/archive-crawler/\" target=\"_blank\">Crawler Discussion List");
      out.write("</a>.\n");
      out.write("</p>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/help/regexpr.jsp\">Regular Expressions");
      out.write("</a>");
      out.write("</b>");
      out.write(
          "<br />\n    Information about the regular expressions used in Heritrix and a tool to double check that your regular expressions are valid and that they correctly identify the desired strings.\n");
      out.write("</p>\n");
      out.write("<p>\n    ");
      out.write("<b>");
      out.write("<a href=\"");
      out.print(request.getContextPath());
      out.write("/help/codes.jsp\">URI Fetch Status Codes");
      out.write("</a>");
      out.write("</b>");
      out.write(
          "<br />\n    This reference details what each of the fetch status codes assigned to URIs means.\n");
      out.write("</p>\n");
      out.write("<hr />\n");
      out.write("<font size=\"-1\">Heritrix version @VERSION@");
      out.write("</font>\n");
      out.write("</div>\n");

      /**
       * An include file that handles the "look" and navigation of a web page. Wrapps up things
       * begun in the "head.jsp" include file. See it for more details.
       *
       * @author Kristinn Sigurdsson
       */
      out.write("\n");
      out.write("<br/>\n");
      out.write("<br/>\n        ");
      out.write(
          "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n            ");
      out.write("<tr>\n            ");
      out.write("<td bgcolor=\"#0000FF\" height=\"1\" colspan=\"4\">");
      out.write("</td>\n            ");
      out.write("</tr>\n            ");
      out.write("<tr>\n            ");
      out.write("<td class=\"instance_name\">Identifier: ");
      out.print(currentHeritrixName);
      out.write("</td>\n            ");
      out.write("</tr>\n        ");
      out.write("</table>\n                    ");
      out.write("<!-- END MAIN BODY -->\n    ");
      out.write("</body>\n");
      out.write("</html>");
      out.write("\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
Example #7
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=GBK");
      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("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

      String path = request.getContextPath();
      String basePath =
          request.getScheme()
              + "://"
              + request.getServerName()
              + ":"
              + request.getServerPort()
              + path
              + "/";

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

      String title = request.getParameter("title");
      String content = request.getParameter("content");
      String filename = request.getParameter("filename");
      String fileurl = request.getParameter("fileurl");

      Gcxknews gcxknews = new Gcxknews();
      gcxknews.setTitle(title);
      gcxknews.setContent(content);
      gcxknews.setPubtime(new Date());
      gcxknews.setFilename(filename);
      gcxknews.setFileurl(fileurl);

      try {

        BasicDAO.save(gcxknews);
        out.println(JavaScript.alertandRedirect("保存成功", "gcxknewslist.jsp"));

      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        out.println(JavaScript.alertandBack("保存失败"));
      }

      out.write("\r\n");
      out.write("\r\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);
    }
  }
Example #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("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;
      _jspx_resourceInjector =
          (org.apache.jasper.runtime.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n");
      out.write("   \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("\n");
      out.write("<html>\n");
      out.write("<body>\n");
      out.write('\n');
      out.write('\n');

      PrintWriter write =
          new PrintWriter(
              new BufferedWriter(new FileWriter((getServletContext().getRealPath("/output.csv")))));
      int i;
      String[] NoofBusstop = request.getParameterValues("NoofbusStop");
      String[] routeID = request.getParameterValues("routeID");
      String[] routeInterval = request.getParameterValues("routeInterval");
      String[] busStopID = request.getParameterValues("busStopID");
      String[] busStopName = request.getParameterValues("busStopName");
      String[] busStopDescription = request.getParameterValues("busStopDescription");
      String[] busStopOrder = request.getParameterValues("busStopOrder");
      String[] busStopStatus = request.getParameterValues("busStopStatus");
      String[] busStopPeopleNum = request.getParameterValues("busStopPeopleNum");

      int a = 0;
      int b = 0;
      int count = 0;
      int NoofBusstops = 0;
      out.println(
          "\"routeID\",\"routeInterval \",\"busStopID\",\"busStopName\",\"busStopDescription\",\"busStopOrder\",\"busStopStatus\",\"busStopPeopleNum\"");
      write.println(
          "\"routeID\",\"routeInterval \",\"busStopID\",\"busStopName\",\"busStopDescription\",\"busStopOrder\",\"busStopStatus\",\"busStopPeopleNum\"");

      out.println("<BR>");
      for (i = 0; i < busStopID.length; i++) {

        NoofBusstops = Integer.parseInt(NoofBusstop[b]);
        count++;
        if (count > NoofBusstops) {
          a++;
          b++;
          count = 1;
        }

        out.println(
            routeID[a]
                + ","
                + routeInterval[a]
                + ","
                + busStopID[i]
                + ",\""
                + busStopName[i]
                + "\",\""
                + busStopDescription[i]
                + "\","
                + busStopOrder[i]
                + ","
                + busStopStatus[i]
                + ","
                + busStopPeopleNum[i]
                + "<BR>");

        write.println(
            routeID[a]
                + ","
                + routeInterval[a]
                + ","
                + busStopID[i]
                + ",\""
                + busStopName[i]
                + "\",\""
                + busStopDescription[i]
                + "\","
                + busStopOrder[i]
                + ","
                + busStopStatus[i]
                + ","
                + busStopPeopleNum[i]);
      }

      write.close();

      /*
      out.println(request.getParameter("routeInterval")+"<BR>");
      out.println(request.getParameter("busStopID")+"<BR>");
      out.println(request.getParameter("busStopName")+"<BR>");
      out.println(request.getParameter("busStopDescription")+"<BR>");
      out.println(request.getParameter("busStopOrder")+"<BR>");
      out.println(request.getParameter("busStopStatus")+"<BR>");
      out.println(request.getParameter("busStopPeopleNum")+"<BR>");
      */

      out.write("\n");
      out.write("\n");
      out.write("</body>\n");
      out.write("</html>");
    } 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 {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
  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; 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;
      _jspx_resourceInjector =
          (org.apache.jasper.runtime.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write('\n');

      JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
      ClusterStatus status = tracker.getClusterStatus();
      String trackerName = StringUtils.simpleHostname(tracker.getJobTrackerMachine());

      out.write("\n<html>\n<head>\n<title>");
      out.print(trackerName);
      out.write(
          " Hadoop Locality Statistics</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hadoop.css\">\n</head>\n<body>\n<h1>");
      out.print(trackerName);
      out.write(" Hadoop Locality Statistics</h1>\n\n<b>State:</b> ");
      out.print(status.getJobTrackerState());
      out.write("<br>\n<b>Started:</b> ");
      out.print(new Date(tracker.getStartTime()));
      out.write("<br>\n<b>Version:</b> ");
      out.print(VersionInfo.getVersion());
      out.write(",\n                r");
      out.print(VersionInfo.getRevision());
      out.write("<br>\n<b>Compiled:</b> ");
      out.print(VersionInfo.getDate());
      out.write(" by\n                 ");
      out.print(VersionInfo.getUser());
      out.write("<br>\n<b>Identifier:</b> ");
      out.print(tracker.getTrackerIdentifier());
      out.write("<br>\n\n<hr>\n\n");

      Collection<JobInProgress> jobs = new ArrayList<JobInProgress>();
      jobs.addAll(tracker.completedJobs());
      jobs.addAll(tracker.runningJobs());
      jobs.addAll(tracker.failedJobs());
      int dataLocalMaps = 0;
      int rackLocalMaps = 0;
      int totalMaps = 0;
      int totalReduces = 0;
      for (JobInProgress job : jobs) {
        Counters counters = job.getCounters();
        dataLocalMaps += counters.getCounter(JobInProgress.Counter.DATA_LOCAL_MAPS);
        rackLocalMaps += counters.getCounter(JobInProgress.Counter.RACK_LOCAL_MAPS);
        totalMaps += counters.getCounter(JobInProgress.Counter.TOTAL_LAUNCHED_MAPS);
        totalReduces += counters.getCounter(JobInProgress.Counter.TOTAL_LAUNCHED_REDUCES);
      }
      int dataLocalMapPct = totalMaps == 0 ? 0 : (100 * dataLocalMaps) / totalMaps;
      int rackLocalMapPct = totalMaps == 0 ? 0 : (100 * rackLocalMaps) / totalMaps;
      int dataRackLocalMapPct =
          totalMaps == 0 ? 0 : (100 * (dataLocalMaps + rackLocalMaps)) / totalMaps;

      out.write("\n<p>\n<b>Data Local Maps:</b> ");
      out.print(dataLocalMaps);
      out.write(' ');
      out.write('(');
      out.print(dataLocalMapPct);
      out.write("%) <br>\n<b>Rack Local Maps:</b> ");
      out.print(rackLocalMaps);
      out.write(' ');
      out.write('(');
      out.print(rackLocalMapPct);
      out.write("%) <br>\n<b>Data or Rack Local:</b> ");
      out.print(dataLocalMaps + rackLocalMaps);
      out.write(' ');
      out.write('(');
      out.print(dataRackLocalMapPct);
      out.write("%) <br>\n<b>Total Maps:</b> ");
      out.print(totalMaps);
      out.write(" <br>\n<b>Total Reduces:</b> ");
      out.print(totalReduces);
      out.write(" <br>\n</p>\n\n");

      out.println(ServletUtil.htmlFooter());

      out.write('\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 {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Example #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=GBK");
      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("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

      int id = Integer.parseInt(request.getParameter("id"));
      String name = request.getParameter("name");
      String xuehao = request.getParameter("number");
      String sex = request.getParameter("sex");
      String sszy = request.getParameter("master");
      String bbzy = request.getParameter("doctor");
      String sd = request.getParameter("masterTeacher");
      String nbbd = request.getParameter("doctorTeacher");
      String rxcj = request.getParameter("score");
      String cjpm = request.getParameter("cjpm");
      String beizhu = request.getParameter("beizhu");
      String male = "男";
      String female = "女";

      Sbld sbldstudent = (Sbld) BasicDAO.queryById(Sbld.class, id);
      sbldstudent.setId(id);
      sbldstudent.setName(name);
      sbldstudent.setXuehao(xuehao);
      if (sex.equals("male")) {
        sbldstudent.setSex(male);
      } else {
        sbldstudent.setSex(female);
      }
      sbldstudent.setSszy(sszy);
      sbldstudent.setBbzy(bbzy);
      sbldstudent.setSd(sd);
      sbldstudent.setNbbd(nbbd);
      sbldstudent.setRxcj(rxcj);
      sbldstudent.setCjpm(cjpm);
      sbldstudent.setBeizhu(beizhu);
      try {

        BasicDAO.update(sbldstudent);
        out.println(JavaScript.alertandRedirect("保存成功", "ApplicationInfo.jsp"));

      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        out.println(JavaScript.alertandBack("保存失败"));
      }

    } 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);
    }
  }
  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; 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;
      _jspx_resourceInjector =
          (org.apache.jasper.runtime.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

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

      JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
      String trackerName = StringUtils.simpleHostname(tracker.getJobTrackerMachine());

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

      String jobId = request.getParameter("jobid");
      if (jobId == null) {
        out.println("<h2>Missing 'jobid'!</h2>");
        return;
      }
      JobID jobIdObj = JobID.forName(jobId);
      String kind = request.getParameter("kind");
      String cause = request.getParameter("cause");

      out.write("\n\n<html>\n<title>Hadoop ");
      out.print(jobId);
      out.write(" failures on ");
      out.print(trackerName);
      out.write("</title>\n<body>\n<h1>Hadoop <a href=\"jobdetails.jsp?jobid=");
      out.print(jobId);
      out.write('"');
      out.write('>');
      out.print(jobId);
      out.write("</a>\nfailures on <a href=\"jobtracker.jsp\">");
      out.print(trackerName);
      out.write("</a></h1>\n\n");

      printFailures(out, tracker, jobIdObj, kind, cause);

      out.write("\n\n<hr>\n<a href=\"jobtracker.jsp\">Go back to JobTracker</a><br>\n");

      out.println(ServletUtil.htmlFooter());

      out.write('\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 {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Example #12
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    Throwable exception = (Throwable) request.getAttribute("javax.servlet.jsp.jspException");
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    String _value = null;
    try {

      if (_jspx_inited == false) {
        synchronized (this) {
          if (_jspx_inited == false) {
            _jspx_init();
            _jspx_inited = true;
          }
        }
      }
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GBK");
      pageContext =
          _jspxFactory.getPageContext(this, request, response, "/error.jsp", true, 8192, true);

      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();

      // HTML // begin [file="/search/accountroleinfo.jsp";from=(2,96);to=(3,0)]
      out.write("\r\n");

      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(3,56);to=(4,0)]
      out.write("\r\n");

      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(4,55);to=(5,0)]
      out.write("\r\n");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(5,0);to=(5,49)]
      /* ----  power:checkpower ---- */
      com.kingsoft.gmsystem.web.taglib.PowerTag _jspx_th_power_checkpower_0 =
          new com.kingsoft.gmsystem.web.taglib.PowerTag();
      _jspx_th_power_checkpower_0.setPageContext(pageContext);
      _jspx_th_power_checkpower_0.setParent(null);
      _jspx_th_power_checkpower_0.setModulecode("accountroleinfo");
      try {
        int _jspx_eval_power_checkpower_0 = _jspx_th_power_checkpower_0.doStartTag();
        if (_jspx_eval_power_checkpower_0 == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
          throw new JspTagException(
              "Since tag handler class com.kingsoft.gmsystem.web.taglib.PowerTag does not implement BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
        if (_jspx_eval_power_checkpower_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
          do {
            // end
            // begin [file="/search/accountroleinfo.jsp";from=(5,0);to=(5,49)]
          } while (_jspx_th_power_checkpower_0.doAfterBody()
              == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
        }
        if (_jspx_th_power_checkpower_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
          return;
      } finally {
        _jspx_th_power_checkpower_0.release();
      }
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(5,49);to=(6,0)]
      out.write("\r\n");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(6,2);to=(19,0)]

      String account =
          new String(Util.setNullToEmpty(request.getParameter("account")).getBytes("ISO-8859-1"));
      String roleName =
          new String(Util.setNullToEmpty(request.getParameter("roleName")).getBytes("ISO-8859-1"));
      String zonecode = request.getParameter("zonecode2");
      String game_code = request.getParameter("game_code");
      String gatewayName = request.getParameter("gatewayName");

      GMHelper gh = new GMHelper();
      List gatewayList = gh.getGatewayList();
      Iterator it = gatewayList.iterator();
      Iterator accountRoleIterator = null;
      if (null != request.getAttribute("accountRoleList"))
        accountRoleIterator = ((ArrayList) request.getAttribute("accountRoleList")).iterator();
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(19,2);to=(27,14)]
      out.write(
          "\r\n<html>\r\n\t<!-- InstanceBegin template=\"/Templates/normal.dwt\" codeOutsideHTMLIsLocked=\"false\" -->\r\n\t<head>\r\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=GBK\">\r\n\t\t<!-- InstanceBeginEditable name=\"doctitle\" -->\r\n\t\t<title>玩家帐号角色互查</title>\r\n\t\t<!-- InstanceEndEditable -->\r\n\t\t<link href=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(27,17);to=(27,41)]
      out.print(request.getContextPath());
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(27,43);to=(29,8)]
      out.write(
          "/css/public.css\" rel=\"stylesheet\" type=\"text/css\">\r\n\t\t<script language=\"JavaScript\"\r\n\t\t\tsrc=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(29,11);to=(29,35)]
      out.print(request.getContextPath());
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(29,37);to=(31,16)]
      out.write(
          "/js/public.js\"></script>\r\n\t\t<script language=\"JavaScript\">\r\n\t\t\tvar AbsPath=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(31,19);to=(31,43)]
      out.print(request.getContextPath());
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(31,45);to=(34,2)]
      out.write(
          "\";   \r\n\t\t</script>\r\n\t\t<!-- InstanceBeginEditable name=\"head\" -->\r\n\t\t");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(34,4);to=(34,4)]
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(34,6);to=(36,15)]
      out.write("\r\n<script language=\"JavaScript\">\r\nvar game_code=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(36,18);to=(36,48)]
      out.print(Util.setNullToEmpty(game_code));
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(36,50);to=(37,14)]
      out.write("\";\r\nvar zonecode=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(37,17);to=(37,46)]
      out.print(Util.setNullToEmpty(zonecode));
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(37,48);to=(38,18)]
      out.write("\";\r\nvar gatewayNames=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(38,21);to=(38,53)]
      out.print(Util.setNullToEmpty(gatewayName));
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(38,55);to=(41,0)]
      out.write("\";\r\nvar gatewayAry = new Array();\r\n\r\n");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(41,2);to=(49,0)]

      HashMap hm = null;
      int cnt = 0;
      while (it.hasNext()) {
        hm = (HashMap) it.next();
        out.println(
            "gatewayAry["
                + cnt++
                + "] =new Array('"
                + hm.get("game_id")
                + "','"
                + hm.get("zonecode")
                + "','"
                + hm.get("gateway_name")
                + "','"
                + hm.get("area")
                + "','"
                + hm.get("group")
                + "','"
                + hm.get("region")
                + "'); ");
      }
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(49,2);to=(126,19)]
      out.write(
          "\r\n\r\nfunction checkValue()\r\n{\r\n\tvar strErr=\"\";\r\n\tif(IsEmpty(\"account\")&&IsEmpty(\"roleName\")) strErr+=\"*玩家帐号或角色信息不能同时为空\\n\";\r\n\tif(strErr!=\"\"){\r\n\t\talert(strErr);\t\r\n\t\treturn false;\r\n\t}else{\t\t\r\n\t\tvar objDiv = document.all(\"gateway\");\r\n\t\tvar aryCheck = objDiv.all.tags(\"INPUT\");\r\n\t\tvar intCheckLength = aryCheck.length;\r\n\t\tvar gateways = \"\";\r\n\t\tfor (i = 0; i < intCheckLength; i++) {\t\r\n\t\t\tif (aryCheck[i].checked) {\r\n\t\t\t\tgateways += aryCheck[i].name + \",\";\r\n\t\t\t}\r\n\t\t}\r\n\t\tdocument.all(\"gatewayName\").value = gateways;\r\n\t\treturn true;\r\n\t}\r\n}\r\n\r\nfunction onChangeGameId()\r\n{\r\n\tvar objSel=document.all(\"zonecode2\");\r\n\tvar objSelTemp=document.all(\"zonecodeTemp\");\r\n\tvar objOption;\r\n\tobjSel.length=0;\r\n\tvar j=0;\r\n\tfor(i=0;i<objSelTemp.length;i++)\r\n\t{\r\n\t\tobjOption=objSelTemp.options[i];\r\n\t\tif(objOption.game_id==document.all(\"game_code\").value)\r\n\t\t{\r\n\t\t \tj+=1;\r\n\t\t \tif(j==1){\r\n\t\t\tobjSel.options[objSel.length]=new Option(0+\".所有区\",'all');\r\n\t\t\tobjSel.options[objSel.length-1].setAttribute(\"game_id\",objOption.game_id);\r\n\t\t \t}\r\n\t\t\tobjSel.options[objSel.length]=new Option(j+\".\"+objOption.text,objOption.value);\r\n\t\t\tobjSel.options[objSel.length-1].setAttribute(\"game_id\",objOption.game_id);\r\n\t\t}\t\t\r\n\t}\r\n}\r\n</script>\r\n\t</head>\r\n\t<!-- InstanceEndEditable -->\r\n\r\n\t<body>\r\n\t\t<table width=\"100%\" height=\"100%\" border=\"0\" align=\"center\"\r\n\t\t\tcellspacing=\"0\">\r\n\t\t\t<tr>\r\n\t\t\t\t<td height=\"20\" bgcolor=\"#BBDDFD\">\r\n\t\t\t\t\t&nbsp;&nbsp;当前位置:\r\n\t\t\t\t\t<!-- InstanceBeginEditable name=\"position\" -->\r\n\t\t\t\t\t<span class=\"title\">查询功能</span> &gt;&gt;\r\n\t\t\t\t\t<span class=\"title\">玩家帐号角色互查</span>\r\n\t\t\t\t\t<!-- InstanceEndEditable -->\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td align=\"center\" valign=\"top\">\r\n\t\t\t\t\t<!-- InstanceBeginEditable name=\"main\" -->\r\n\t\t\t\t\t<div id=\"divPrompt\"\r\n\t\t\t\t\t\tstyle=\"width: 250px; position: absolute; display: none; left: 340px; top: 300px; height: 44px;\">\r\n\t\t\t\t\t\t<table width=\"100%\" height=\"100%\" border=\"1\" align=\"center\"\r\n\t\t\t\t\t\t\tcellspacing=\"0\" bordercolor=\"#0000FF\" bgcolor=\"#FFFFFF\">\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td align=\"center\" valign=\"middle\">\r\n\t\t\t\t\t\t\t\t\t正在查询和等待返回结果,请稍候......\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t</table>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\t<form action=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(126,22);to=(126,46)]
      out.print(request.getContextPath());
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(126,48);to=(139,8)]
      out.write(
          "/GMCServlet?action=accountroleinfo\" method=\"post\" onsubmit=\"return checkValue()\">\r\n\t\t\t\t\t<table width=\"100%\" border=\"0\" cellspacing=\"0\">\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td align=\"center\">\r\n\t\t\t\t\t\t\t\t所属游戏\r\n\t\t\t\t\t\t\t\t<select id=\"selectGamename\" name=\"game_code\"\r\n\t\t\t\t\t\t\t\t\tonmouseover=\"this.focus()\" onchange=\"onChangeGameId()\">\r\n\t\t\t\t\t\t\t\t\t<OPTION value='88'>\r\n\t\t\t\t\t\t\t\t\t\t剑网3\r\n\t\t\t\t\t\t\t\t\t</OPTION>\r\n\t\t\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t\t\t所在区\r\n\t\t\t\t\t\t\t\t<select name=\"zonecode2\"></select>\r\n\t\t\t\t\t\t\t\t");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(139,8);to=(140,58)]
      /* ----  display:display ---- */
      com.kingsoft.gmsystem.web.taglib.UserTag _jspx_th_display_display_0 =
          new com.kingsoft.gmsystem.web.taglib.UserTag();
      _jspx_th_display_display_0.setPageContext(pageContext);
      _jspx_th_display_display_0.setParent(null);
      _jspx_th_display_display_0.setDisplayCode("select_zone_all");
      _jspx_th_display_display_0.setProperty("zonecodeTemp");
      _jspx_th_display_display_0.setParameter("display:none");
      try {
        int _jspx_eval_display_display_0 = _jspx_th_display_display_0.doStartTag();
        if (_jspx_eval_display_display_0 == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_BUFFERED)
          throw new JspTagException(
              "Since tag handler class com.kingsoft.gmsystem.web.taglib.UserTag does not implement BodyTag, it can't return BodyTag.EVAL_BODY_TAG");
        if (_jspx_eval_display_display_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
          do {
            // end
            // HTML // begin [file="/search/accountroleinfo.jsp";from=(140,58);to=(141,8)]
            out.write("\r\n\t\t\t\t\t\t\t\t");

            // end
            // begin [file="/search/accountroleinfo.jsp";from=(141,8);to=(141,26)]
          } while (_jspx_th_display_display_0.doAfterBody()
              == javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN);
        }
        if (_jspx_th_display_display_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      } finally {
        _jspx_th_display_display_0.release();
      }
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(141,26);to=(149,16)]
      out.write(
          "\r\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"gatewayName\"/>\r\n\t\t\t\t\t\t\t\t所在服\r\n\t\t\t\t\t\t\t\t<div id=\"gateway\">\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t玩家帐号\r\n\t\t\t\t\t\t\t\t<input name=\"account\" type=\"text\" class=\"text\"\r\n\t\t\t\t\t\t\t\t\tvalue=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(149,19);to=(149,26)]
      out.print(account);
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(149,28);to=(152,63)]
      out.write(
          "\" onmouseover=\"this.focus()\" size=\"20\"\r\n\t\t\t\t\t\t\t\t\tmaxlength=\"30\">\r\n\t\t\t\t\t\t\t\t玩家角色\r\n\t\t\t\t\t\t\t\t<input type=\"text\" name=\"roleName\" class=\"text\" value=\"");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(152,66);to=(152,74)]
      out.print(roleName);
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(152,76);to=(154,45)]
      out.write(
          "\"\r\n\t\t\t\t\t\t\t\t\tonmouseover=\"this.focus()\" size=\"20\" maxlength=\"30\">\r\n\t\t\t\t\t\t\t\t<input type=\"checkbox\" name=\"isLike\" ");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(154,48);to=(154,128)]
      out.print(Util.setNullToEmpty(request.getParameter("isLike")).equals("") ? "" : "checked");
      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(154,130);to=(183,9)]
      out.write(
          ">模糊查询\r\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"btnSearch\" value=\"查询\"/>\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td align=\"center\">\r\n\t\t\t\t\t\t\t\t<br>\r\n\t\t\t\t\t\t\t\t<table width=\"773\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\"\r\n\t\t\t\t\t\t\t\t\tclass=\"tablelist\">\r\n\t\t\t\t\t\t\t\t\t<tr align=\"left\" bgcolor=\"#419ADC\">\r\n\t\t\t\t\t\t\t\t\t\t<td height=\"31\" colspan=\"6\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t<font color=#ffffff><b>&nbsp;&#8226;&nbsp;玩家帐号基本信息</b>\r\n\t\t\t\t\t\t\t\t\t\t\t</font>\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t玩家帐号\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t玩家角色\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t所在区\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t所在服\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t");

      // end
      // begin [file="/search/accountroleinfo.jsp";from=(183,11);to=(187,9)]

      if (null != accountRoleIterator) {
        while (accountRoleIterator.hasNext()) {
          hm = (HashMap) accountRoleIterator.next();

          // end
          // HTML // begin [file="/search/accountroleinfo.jsp";from=(187,11);to=(191,11)]
          out.write(
              "\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t");

          // end
          // begin [file="/search/accountroleinfo.jsp";from=(191,14);to=(191,32)]
          out.print(hm.get("account"));
          // end
          // HTML // begin [file="/search/accountroleinfo.jsp";from=(191,34);to=(194,11)]
          out.write(
              "\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t");

          // end
          // begin [file="/search/accountroleinfo.jsp";from=(194,14);to=(194,33)]
          out.print(hm.get("RoleName"));
          // end
          // HTML // begin [file="/search/accountroleinfo.jsp";from=(194,35);to=(197,11)]
          out.write(
              "\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t");

          // end
          // begin [file="/search/accountroleinfo.jsp";from=(197,14);to=(197,33)]
          out.print(hm.get("ZoneName"));
          // end
          // HTML // begin [file="/search/accountroleinfo.jsp";from=(197,35);to=(200,11)]
          out.write(
              "\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td width=\"25%\" height=\"25\" align=\"right\" nowrap>\r\n\t\t\t\t\t\t\t\t\t\t\t");

          // end
          // begin [file="/search/accountroleinfo.jsp";from=(200,14);to=(200,36)]
          out.print(hm.get("GatewayName"));
          // end
          // HTML // begin [file="/search/accountroleinfo.jsp";from=(200,38);to=(203,9)]
          out.write(
              "\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t");

          // end
          // begin [file="/search/accountroleinfo.jsp";from=(203,11);to=(206,9)]

        }
      }

      // end
      // HTML // begin [file="/search/accountroleinfo.jsp";from=(206,11);to=(260,0)]
      out.write(
          "\r\n\t\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t\t<script language=\"JavaScript\">\r\ndocument.getElementById(\"zonecode2\").onchange = function onChangeZoneCode(){\r\n\tvar objSel = document.getElementById(\"zonecode2\");\r\n\tvar objOpt = objSel.options[objSel.selectedIndex];\r\n\tvar tmp = \"\";\r\n\tfor(var cnt=0;cnt<gatewayAry.length;cnt++){\r\n\t\tif(gatewayAry[cnt][0]==objOpt.game_id&&gatewayAry[cnt][1]==objOpt.value){\t\r\n\t\t\ttmp +=\" <input type='checkbox' name='\"+gatewayAry[cnt][5]+\"'>\"+gatewayAry[cnt][2];\r\n\t\t}\r\n\t}\r\n\tdocument.getElementById(\"gateway\").innerHTML = tmp;\r\n}\r\n\r\n\t  if(game_code!=\"\"){\r\n\t\tSetSelValue(\"game_code\",game_code);\r\n        onChangeGameId();\r\n        SetSelValue(\"zonecode2\",zonecode);\r\n\t  }else{\r\n          onChangeGameId();\r\n       }\r\n      if(zonecode!=\"\"){\r\n\t\tonChangeZoneCode();\r\n\t\tif(gatewayNames!=\"\"){\r\n\t\t\tvar objDiv = document.all(\"gateway\");\r\n\t\t\tvar aryCheck = objDiv.all.tags(\"INPUT\");\r\n\t\t\tvar intCheckLength = aryCheck.length;\r\n\t\t\tvar gateways = \"\";\r\n\t\t\tfor (i = 0; i < intCheckLength; i++) {\t\r\n\t\t\t\tif (gatewayNames.indexOf(aryCheck[i].name+\",\")>-1) {\r\n\t\t\t\t\taryCheck[i].checked=true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\t\t\r\n\t\t\r\n   \t  }\r\n\t</script>\r\n\t\t\t\t\t<!-- InstanceEndEditable -->\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td height=\"16\" align=\"center\" bgcolor=\"#BBDDFD\">\r\n\t\t\t\t\tCopyright &copy; 2005 Kingsoft Corp,All Rights Reserved\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t</body>\r\n\t<!-- InstanceEnd -->\r\n</html>\r\n");

      // end

    } catch (Throwable t) {
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
Example #13
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");
      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("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");

      Collection imageList = (Collection) request.getAttribute("ImageList");
      ImageRefDb irdb = null;
      boolean odd = true;
      if (imageList == null) {
        out.println("no images");
        return;
      }
      if (imageList.size() == 0) {
        out.println("no images");
        return;
      }

      out.println("<table border='1'>");

      Iterator it = imageList.iterator();
      String imageLayout = (String) request.getAttribute("ImageLayout");

      if (imageLayout == null) imageLayout = "sideBar";
      int max_columns = 2;

      if ("home".equals(imageLayout)) max_columns = 4;

      int column_counter = 0;
      while (it.hasNext()) {
        if (column_counter == 0) out.println("<tr>");

        // if (odd) { out.println("<tr><td valign='top'>"); }
        // else { out.println("<td valign='top'>"); }

        irdb = (ImageRefDb) it.next();
        if (irdb.getDescription() == null) irdb.setDescription("");
        if (irdb.getNotes() == null) irdb.setNotes("");

        if ("sideBar".equals(imageLayout))
          out.println(
              "<td valign='top' width='205'><a href='imageView.do?id="
                  + irdb.getId()
                  + "'><img src=\"DbImageReader?id="
                  + irdb.getId()
                  + "\" alt=\"Image\"  width=\"200\"/></a><br>"
                  + "<b>"
                  + irdb.getDescription()
                  + "</b> "
                  + irdb.getNotes()
                  + "</td>");
        if ("home".equals(imageLayout)) {
          long cust_id = irdb.getCust_id();
          long note_id = irdb.getNote_id();

          if (cust_id > 0)
            out.println(
                "<td valign='top'  width='205'><a href='addressEdit.do?mode=show&id="
                    + cust_id
                    + "'><img src=\"DbImageReader?id="
                    + irdb.getId()
                    + "\" alt=\"Image\"  width=\"200\"/></a><br>"
                    + "<b>"
                    + irdb.getDescription()
                    + "</b> "
                    + irdb.getNotes()
                    + "</td>");
          else if (note_id > 0)
            out.println(
                "<td valign='top'  width='205'><a href='notes.do?mode=edit&id="
                    + note_id
                    + "'><img src=\"DbImageReader?id="
                    + irdb.getId()
                    + "\" alt=\"Image\"  width=\"200\"/></a><br>"
                    + "<b>"
                    + irdb.getDescription()
                    + "</b> "
                    + irdb.getNotes()
                    + "</td>");
          else
            out.println(
                "<td valign='top' width='205'><img src=\"DbImageReader?id="
                    + irdb.getId()
                    + "\" alt=\"Image\"  width=\"200\"/><br>"
                    + "<b>"
                    + irdb.getDescription()
                    + "</b> "
                    + irdb.getNotes()
                    + "</td>");
        }
        // if (odd) { out.println("</td>"); }
        // else { out.println("</td></tr>"); }
        column_counter++;
        if (column_counter == max_columns) {
          out.println("</tr>");
          column_counter = 0;
        }

        // odd=!odd;
      }

      if (column_counter < max_columns) out.println("</tr>");
      out.println("</table>");

      out.write("\r\n");
      out.write("\r\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);
    }
  }
Example #14
0
  public void generateFileDetails(JspWriter out, HttpServletRequest req, Configuration conf)
      throws IOException, InterruptedException {

    int chunkSizeToView = 0;
    long startOffset = 0;
    int datanodePort;

    String blockIdStr = null;
    long currBlockId = 0;
    blockIdStr = req.getParameter("blockId");
    if (blockIdStr == null) {
      out.print("Invalid input (blockId absent)");
      return;
    }
    currBlockId = Long.parseLong(blockIdStr);

    String datanodePortStr = req.getParameter("datanodePort");
    if (datanodePortStr == null) {
      out.print("Invalid input (datanodePort absent)");
      return;
    }
    datanodePort = Integer.parseInt(datanodePortStr);

    String namenodeInfoPortStr = req.getParameter("namenodeInfoPort");
    int namenodeInfoPort = -1;
    if (namenodeInfoPortStr != null) namenodeInfoPort = Integer.parseInt(namenodeInfoPortStr);

    String chunkSizeToViewStr = req.getParameter("chunkSizeToView");
    if (chunkSizeToViewStr != null && Integer.parseInt(chunkSizeToViewStr) > 0) {
      chunkSizeToView = Integer.parseInt(chunkSizeToViewStr);
    } else {
      chunkSizeToView = JspHelper.getDefaultChunkSize(conf);
    }

    String startOffsetStr = req.getParameter("startOffset");
    if (startOffsetStr == null || Long.parseLong(startOffsetStr) < 0) startOffset = 0;
    else startOffset = Long.parseLong(startOffsetStr);

    String filename = HtmlQuoting.unquoteHtmlChars(req.getParameter("filename"));
    if (filename == null || filename.length() == 0) {
      out.print("Invalid input");
      return;
    }

    String blockSizeStr = req.getParameter("blockSize");
    long blockSize = 0;
    if (blockSizeStr == null || blockSizeStr.length() == 0) {
      out.print("Invalid input");
      return;
    }
    blockSize = Long.parseLong(blockSizeStr);

    String tokenString = req.getParameter(JspHelper.DELEGATION_PARAMETER_NAME);
    UserGroupInformation ugi = JspHelper.getUGI(req, conf);
    DFSClient dfs = JspHelper.getDFSClient(ugi, jspHelper.nameNodeAddr, conf);
    List<LocatedBlock> blocks =
        dfs.namenode.getBlockLocations(filename, 0, Long.MAX_VALUE).getLocatedBlocks();
    // Add the various links for looking at the file contents
    // URL for downloading the full file
    String downloadUrl =
        "http://"
            + req.getServerName()
            + ":"
            + +req.getServerPort()
            + "/streamFile"
            + URLEncoder.encode(filename, "UTF-8")
            + "?"
            + JspHelper.DELEGATION_PARAMETER_NAME
            + "="
            + tokenString;
    out.print("<a name=\"viewOptions\"></a>");
    out.print("<a href=\"" + downloadUrl + "\">Download this file</a><br>");

    DatanodeInfo chosenNode;
    // URL for TAIL
    LocatedBlock lastBlk = blocks.get(blocks.size() - 1);
    long blockId = lastBlk.getBlock().getBlockId();
    try {
      chosenNode = jspHelper.bestNode(lastBlk);
    } catch (IOException e) {
      out.print(e.toString());
      dfs.close();
      return;
    }
    String fqdn = InetAddress.getByName(chosenNode.getHost()).getCanonicalHostName();
    String tailUrl =
        "http://"
            + fqdn
            + ":"
            + chosenNode.getInfoPort()
            + "/tail.jsp?filename="
            + URLEncoder.encode(filename, "UTF-8")
            + "&namenodeInfoPort="
            + namenodeInfoPort
            + "&chunkSizeToView="
            + chunkSizeToView
            + "&referrer="
            + URLEncoder.encode(req.getRequestURL() + "?" + req.getQueryString(), "UTF-8")
            + JspHelper.getDelegationTokenUrlParam(tokenString);
    out.print("<a href=\"" + tailUrl + "\">Tail this file</a><br>");

    out.print("<form action=\"/browseBlock.jsp\" method=GET>");
    out.print("<b>Chunk size to view (in bytes, up to file's DFS block size): </b>");
    out.print("<input type=\"hidden\" name=\"blockId\" value=\"" + currBlockId + "\">");
    out.print("<input type=\"hidden\" name=\"blockSize\" value=\"" + blockSize + "\">");
    out.print("<input type=\"hidden\" name=\"startOffset\" value=\"" + startOffset + "\">");
    out.print("<input type=\"hidden\" name=\"filename\" value=\"" + filename + "\">");
    out.print("<input type=\"hidden\" name=\"datanodePort\" value=\"" + datanodePort + "\">");
    out.print(
        "<input type=\"hidden\" name=\"namenodeInfoPort\" value=\"" + namenodeInfoPort + "\">");
    out.print(
        "<input type=\"text\" name=\"chunkSizeToView\" value="
            + chunkSizeToView
            + " size=10 maxlength=10>");
    out.print("&nbsp;&nbsp;<input type=\"submit\" name=\"submit\" value=\"Refresh\">");
    out.print("</form>");
    out.print("<hr>");
    out.print("<a name=\"blockDetails\"></a>");
    out.print("<B>Total number of blocks: " + blocks.size() + "</B><br>");
    // generate a table and dump the info
    out.println("\n<table>");
    for (LocatedBlock cur : blocks) {
      out.print("<tr>");
      blockId = cur.getBlock().getBlockId();
      blockSize = cur.getBlock().getNumBytes();
      String blk = "blk_" + Long.toString(blockId);
      out.print("<td>" + Long.toString(blockId) + ":</td>");
      DatanodeInfo[] locs = cur.getLocations();
      for (int j = 0; j < locs.length; j++) {
        String datanodeAddr = locs[j].getName();
        datanodePort =
            Integer.parseInt(
                datanodeAddr.substring(datanodeAddr.indexOf(':') + 1, datanodeAddr.length()));
        fqdn = InetAddress.getByName(locs[j].getHost()).getCanonicalHostName();
        String blockUrl =
            "http://"
                + fqdn
                + ":"
                + locs[j].getInfoPort()
                + "/browseBlock.jsp?blockId="
                + Long.toString(blockId)
                + "&blockSize="
                + blockSize
                + "&filename="
                + URLEncoder.encode(filename, "UTF-8")
                + "&datanodePort="
                + datanodePort
                + "&genstamp="
                + cur.getBlock().getGenerationStamp()
                + "&namenodeInfoPort="
                + namenodeInfoPort
                + "&chunkSizeToView="
                + chunkSizeToView;
        out.print(
            "<td>&nbsp</td>" + "<td><a href=\"" + blockUrl + "\">" + datanodeAddr + "</a></td>");
      }
      out.println("</tr>");
    }
    out.println("</table>");
    out.print("<hr>");
    String namenodeHost = jspHelper.nameNodeAddr.getHostName();
    out.print(
        "<br><a href=\"http://"
            + InetAddress.getByName(namenodeHost).getCanonicalHostName()
            + ":"
            + namenodeInfoPort
            + "/dfshealth.jsp\">Go back to DFS home</a>");
    dfs.close();
  }
Example #15
0
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    PageContext pageContext = 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; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, false, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("<!--\n");
      out.write("Copyright 2012 The Infinit.e Open Source Project\n");
      out.write("\n");
      out.write("Licensed under the Apache License, Version 2.0 (the \"License\");\n");
      out.write("you may not use this file except in compliance with the License.\n");
      out.write("You may obtain a copy of the License at\n");
      out.write("\n");
      out.write("  http://www.apache.org/licenses/LICENSE-2.0\n");
      out.write("\n");
      out.write("Unless required by applicable law or agreed to in writing, software\n");
      out.write("distributed under the License is distributed on an \"AS IS\" BASIS,\n");
      out.write("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
      out.write("See the License for the specific language governing permissions and\n");
      out.write("limitations under the License.\n");
      out.write("-->\n");
      out.write("\n");
      out.write("\n");
      out.write("<!--\n");
      out.write("Copyright 2012 The Infinit.e Open Source Project\n");
      out.write("\n");
      out.write("Licensed under the Apache License, Version 2.0 (the \"License\");\n");
      out.write("you may not use this file except in compliance with the License.\n");
      out.write("You may obtain a copy of the License at\n");
      out.write("\n");
      out.write("  http://www.apache.org/licenses/LICENSE-2.0\n");
      out.write("\n");
      out.write("Unless required by applicable law or agreed to in writing, software\n");
      out.write("distributed under the License is distributed on an \"AS IS\" BASIS,\n");
      out.write("WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
      out.write("See the License for the specific language governing permissions and\n");
      out.write("limitations under the License.\n");
      out.write("-->\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write('\n');
      out.write('\n');
      out.write('\n');

      // !---------- Read AppConstants.js to get the API_ROOT value  ----------!
      if (API_ROOT == null) {
        URL baseUrl =
            new URL(request.getScheme(), request.getServerName(), request.getServerPort(), "");
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByName("javascript");
        String appConstantFile = null;

        InputStream in = null;
        // Use file from local deployment always
        try {
          in = new FileInputStream(application.getRealPath("/") + "AppConstants.js");
          appConstantFile = IOUtils.toString(in);
        } catch (Exception e) {
          // System.out.println("Exception: " + e.getMessage());
        }

        // Eval the file as JavaScript through or JS engine and call getEndPointUrl
        try {
          engine.eval(appConstantFile);
          engine.eval("output = getEndPointUrl();");
          API_ROOT = (String) engine.get("output");
        } catch (Exception e) {
          // System.out.println("Exception: " + e.getMessage());
        }
        if (null == API_ROOT) {
          // Default to localhost
          API_ROOT = "http://localhost:8080/api/";
        }

        if (API_ROOT.contains("localhost")) {
          localCookie = true;
        } else {
          localCookie = false;
        }
      }

      boolean isLoggedIn = false;
      messageToDisplay = "";

      // Page request is a post back from the login form
      if (request.getParameter("username") != null && request.getParameter("password") != null) {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        isLoggedIn = getLogin(username, password, request, response);

        // Temp fix, refresh the page to retrieve the new cookie that was set
        out.println("<meta http-equiv=\"refresh\" content=\"0\">");
      }
      // Make sure user is already logged in and retrieve their user id
      else {
        isLoggedIn = isLoggedIn(request, response);
      }

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

      messageToDisplay = "";

      //
      if (isLoggedIn) {
        // Determine which action is being called for by the user
        String action = "";
        if (request.getParameter("action") != null)
          action = request.getParameter("action").toLowerCase();
        if (request.getParameter("dispatchAction") != null)
          action = request.getParameter("dispatchAction").toLowerCase();

        try {
          if (action.equals("logout")) {
            logOut(request, response);
            out.println("<meta http-equiv=\"refresh\" content=\"0;url=index.jsp\">");
          }
        } catch (Exception e) {
          // System.out.println(e.getMessage());
        }
      }

      out.write("\n");
      out.write("\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
      out.write("\t<link rel=\"stylesheet\" type=\"text/css\" href=\"inc/manager.css\" />\n");
      out.write("\t<title>Infinit.e.Manager - Home</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      out.write("\n");
      out.write("<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" >\n");
      out.write("<tr valign=\"middle\">\n");
      out.write("\t<td width=\"100%\" background=\"image/infinite_logo_bg.png\">\n");
      out.write("\t\t<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" >\n");
      out.write("\t\t\t<tr valign=\"bottom\">\n");
      out.write(
          "\t\t\t\t<td width=\"200\"><a href=\"index.jsp\"><img src=\"image/infinite_logo.png\" border=\"0\"></a></td>\n");
      out.write("\t\t\t\t<td>\n");
      out.write(
          "\t\t\t\t\t<a href=\"people.jsp\" class=\"headerLink\" title=\"Add/Edit Users\">People</a> &nbsp; &nbsp;\n");
      out.write(
          "\t\t\t\t\t<a href=\"communities.jsp\" class=\"headerLink\" title=\"Add/Edit Communities\">Communities</a> &nbsp; &nbsp;\n");
      out.write(
          "\t\t\t\t\t<a href=\"sources.jsp\" class=\"headerLink\" title=\"Add/Edit Sources\">Sources</a> &nbsp; &nbsp;\n");
      out.write(
          "\t\t\t\t\t<!-- <a href=\"widgets.jsp\" class=\"headerLink\" title=\"Add/Edit Widgets\">Widgets</a> &nbsp; &nbsp; -->\n");
      out.write(
          "\t\t\t\t\t<!-- <a href=\"hadoop.jsp\" class=\"headerLink\" title=\"Add/Edit Hadoop Jars\">Hadoop</a> &nbsp; &nbsp; -->\n");
      out.write(
          "\t\t\t\t\t<!-- <a href=\"shares.jsp\" class=\"headerLink\" title=\"Add/Edit Shares\">Shares</a> &nbsp; &nbsp; -->\n");
      out.write(
          "\t\t\t\t\t<a href=\"index.jsp\" class=\"headerLink\" title=\"Home\">Home</a> &nbsp; &nbsp;\n");
      out.write(
          "\t\t\t\t\t<a href=\"?action=logout\" class=\"headerLink\" title=\"Logout\">Logout</a>\n");
      out.write("\t\t\t\t</td>\n");
      out.write(
          "\t\t\t\t<td align=\"right\" width=\"120\" background=\"image/ikanow_logo_smaller_bg.png\"></td>\n");
      out.write("\t\t\t</tr>\n");
      out.write("\t\t</table>\n");
      out.write("\t</td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("\t<td bgcolor=\"#ffffff\">\n");
      out.write('\n');
      out.write('\n');

      if (!isLoggedIn) {

        out.write('\n');
        out.write('	');
        out.write('	');
        out.write("<!-- Begin login_form.jsp  -->\n");
        out.write("\n");
        out.write("<br />\n");
        out.write("<br />\n");
        out.write("<br />\n");
        out.write("<br />\n");
        out.write("<center>\n");
        out.write("<form method=\"post\" name=\"login_form\">\n");
        out.write(
            "<table class=\"standardTable\" cellpadding=\"5\" cellspacing=\"1\" width=\"35%\" >\n");
        out.write("\t<tr>\n");
        out.write("\t\t<td colspan=\"2\" align=\"center\">\n");
        out.write("\t\t\t<font color=\"white\"><b>Login to Infinit.e.Manager</b></font>\n");
        out.write("\t\t</td>\n");
        out.write("\t</tr>\n");
        out.write("\t<tr>\n");
        out.write("\t\t<td bgcolor=\"white\" width=\"40%\">User Name:</td>\n");
        out.write(
            "\t\t<td bgcolor=\"white\" width=\"60%\"><input type=\"text\" name=\"username\" size=\"40\"></td>\n");
        out.write("\t</tr>\n");
        out.write("\t<tr>\n");
        out.write("\t\t<td bgcolor=\"white\" width=\"40%\">Password:</td>\n");
        out.write(
            "\t\t<td bgcolor=\"white\" width=\"60%\"><input type=\"password\" name=\"password\" size=\"40\"></td>\n");
        out.write("\t</tr>\n");
        out.write("\t<tr>\n");
        out.write("\t\t<td colspan=\"2\" align=\"right\"><input type=\"submit\"></td>\n");
        out.write("\t</tr>\n");
        out.write("</table>\n");
        out.write("</form>\n");
        out.write("</center>\n");
        out.write("<br />\n");
        out.write("<br />\n");
        out.write("<br />\n");
        out.write("<br />\n");
        out.write("<!-- End login_form.jsp  -->");
        out.write('\n');

      } else {

        out.write("\n");
        out.write(
            "\t<table class=\"standardTable\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\" >\n");
        out.write("\t<tr>\n");
        out.write("\t\t<td width=\"100%\" bgcolor=\"#ffffff\">\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t\n");
        out.write("\t\t\t<center>\n");
        out.write(
            "\t\t\t<table class=\"standardTable\" cellpadding=\"5\" cellspacing=\"1\" width=\"50%\">\n");
        out.write("\t\t\t\t<tr>\n");
        out.write("\t\t\t\t\t<td>&nbsp</td>\n");
        out.write("\t\t\t\t</tr>\n");
        out.write("\t\t\t\t<tr>\n");
        out.write("\t\t\t\t\t<td bgcolor=\"white\">\n");
        out.write("\t\t\t\t\t\t<ul>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"people.jsp\" title=\"Add/Edit Users\">People</a></b> - Add/Edit Users</li>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"communities.jsp\" title=\"Add/Edit Users\">Communities</a></b> - Add/Edit Communities and Membership</li>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"sources.jsp\" title=\"Add/Edit Users\">Sources</a></b> - Add/Edit Sources\n");
        out.write(
            "\t\t\t\t\t\t\t\t<ul><li><b><a href=\"sourcemonitor.jsp\" title=\"Monitor Sources\" target=\"_blank\">Source Monitoring</a></b> (new tab)</li></ul>\n");
        out.write("\t\t\t\t\t\t\t</li>\n");
        out.write("\t\t\t\t\t\t</ul>\n");
        out.write("\t\t\t\t\t\t<ul>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"fileUploader.jsp\" title=\"Add/Edit Users\" target=\"_blank\">File Uploader</a></b> - Add/Edit Files or JSON (new tab)</li>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"widgetUploader.jsp\" title=\"Add/Edit Users\" target=\"_blank\">Widget Uploader</a></b> - Add/Edit Widgets (new tab)</li>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"pluginManager.jsp\" title=\"Add/Edit Users\" target=\"_blank\">Plugin Manager</a></b> - Add/Edit Hadoop Plugins (new tab)</li>\t\t\t\t\t\t\n");
        out.write("\t\t\t\t\t\t</ul>\n");
        out.write("\t\t\t\t\t\t<ul>\n");
        out.write(
            "\t\t\t\t\t\t\t<li><b><a href=\"chrome.html\" title=\"Install Chrome Source Extension\" target=\"_blank\">Infinit.e Chrome Extension</a></b> - Create Sources from Chrome</li>\n");
        out.write("\t\t\t\t\t\t</ul>\n");
        out.write("\t\t\t\t\t</td>\n");
        out.write("\t\t\t\t</tr>\n");
        out.write("\t\t\t</table>\n");
        out.write("\t\t\t</center>\n");
        out.write("\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t\t<br />\n");
        out.write("\t\t</td>\n");
        out.write("\t<tr>\n");
        out.write("\t</table>\n");
      }

      out.write('\n');
      out.write('\n');
      out.write("\t\n");
      out.write("\t</td>\n");
      out.write("<tr>\n");
      out.write("<tr>\n");
      out.write("\t<td align=\"right\" bgcolor=\"#000000\">\n");
      out.write("\t\t&nbsp;\n");
      out.write(
          "\t\t<!-- <a href=\"http://www.ikanow.com\" title=\"www.ikanow.com\"><img src=\"image/ikanow_logo_small.png\" border=\"0\"></a> -->\n");
      out.write("\t</td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("\n");
      out.write("\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);
    }
  }
  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, "/error.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('');
      out.write('\r');
      out.write('\n');
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!-- Body -->\r\n");
      out.write(
          "\t\t<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("\t\t  <tr>\r\n");
      out.write(
          "\t\t\t<td width=\"100%\" align=\"left\" valign=\"top\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("              <tr>\r\n");
      out.write("                <td width=\"1%\">&nbsp;</td>\r\n");
      out.write(
          "                <td width=\"99%\"><span class=\"websitename\">รายงานสถิติข้อมูล</span></td>\r\n");
      out.write("              </tr>\r\n");
      out.write("              <tr>\r\n");
      out.write("                <td height=\"18\">&nbsp;</td>\r\n");
      out.write("                <td>&nbsp;</td>\r\n");
      out.write("              </tr>\r\n");
      out.write("              <tr>\r\n");
      out.write("                <td>&nbsp;</td>\r\n");
      out.write(
          "                <td><table width=\"750\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("                  <tr>\r\n");
      out.write(
          "                    <td width=\"24\" align=\"left\" valign=\"top\">&nbsp;</td>\r\n");
      out.write(
          "                    <td width=\"100%\" align=\"left\" valign=\"top\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("                      <tr>\r\n");
      out.write(
          "                        <td width=\"14%\" height=\"25\"><p><strong>รายงานศูนย์เทคโนโลยีสารสนเทศ</strong></p></td>\r\n");
      out.write("                      </tr>\r\n");
      out.write("                      <tr>\r\n");
      out.write("                        <td height=\"25\">\r\n");
      out.write(
          "                           <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("\t\t\t\t\t\t\t");

      StaticAndReportAction sar = new StaticAndReportAction();
      out.println(sar.getReportMenu(request, "33"));

      out.write("\r\n");
      out.write("                           </table>\r\n");
      out.write("                        </td>\r\n");
      out.write("                      </tr>\r\n");
      out.write("                    </table></td>\r\n");
      out.write("                    <td width=\"363\" valign=\"top\">&nbsp;</td>\r\n");
      out.write("                  </tr>\r\n");
      out.write("                  \r\n");
      out.write("                </table></td>\r\n");
      out.write("              </tr>\r\n");
      out.write("            </table></td>\r\n");
      out.write("\t\t  </tr>\r\n");
      out.write("\t\t</table>");
    } 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);
    }
  }
  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("application/json;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;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

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

      Connection con = DbConnector.initConnection();
      if (request.getParameter("id") != null) {
        ResultSet rs =
            con.createStatement()
                .executeQuery(
                    "Select email from masteruserinfo where masterid='"
                        + request.getParameter("id")
                        + "'");
        if (rs.next()) {
          out.println(new JSONObject().put("User", rs.getString(1)));
        } else {
          out.println(new JSONObject().put("User", "-1"));
        }
      }

      if (request.getParameter("email") != null) {
        ResultSet rs =
            con.createStatement()
                .executeQuery(
                    "Select masterid from masteruserinfo where email='"
                        + request.getParameter("email")
                        + "'");
        if (rs.next()) {
          out.println(new JSONObject().put("User", rs.getString(1)));
        } else {
          out.println(new JSONObject().put("User", "-1"));
        }
      }

      out.write('\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);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
  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; charset=ISO-8859-1");
      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;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("<title>MESSAGING</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");

      DBConnect db1 = new DBConnect();
      Chat c = new Chat();
      ArrayList<Message> m1 = new ArrayList<Message>();
      m1 = c.fetch();
      int i;
      Message m = new Message();
      // <input type="text" name="last_name" placeholder="Last Name" /><br>

      for (i = 0; i < m1.size(); i++) {
        m = m1.get(i);
        out.println("<h3> TO : " + m.getRID() + "</h3>");
        out.println("<h3> MESSAGE :" + m.getMessage() + "</h3>");
        out.println("<h3> FROM : " + m.getSID() + "</h3>");
      }

      out.write("\n");
      out.write("</body>\n");
      out.write("</html>");
    } 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);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Example #19
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");
      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');

      String cSec = checkSecurity(2, session, response, request);
      if ("sendRedirect".equals(cSec)) return;

      boolean bDebug = false;

      String sAction = getParam(request, "FormAction");
      String sForm = getParam(request, "FormName");
      String seditorialsErr = "";

      java.sql.Connection conn = null;
      java.sql.Statement stat = null;
      String sErr = loadDriver();
      conn = cn();
      stat = conn.createStatement();
      if (!sErr.equals("")) {
        try {
          out.println(sErr);
        } catch (Exception e) {
        }
      }

      out.write('\n');
      out.write(
          "\n\n<html>\n<head>\n<title>Book Store</title>\n<meta name=\"GENERATOR\"\n\tcontent=\"YesSoftware CodeCharge v.1.2.0 / JSP.ccp build 05/21/2001\" />\n<meta http-equiv=\"pragma\" content=\"no-cache\" />\n<meta http-equiv=\"expires\" content=\"0\" />\n<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n</head>\n<body\n\tstyle=\"background-color: #FFFFFF; color: #000000; font-family: Arial, Tahoma, Verdana, Helveticabackground-color: #FFFFFF; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "Header.jsp", out, true);
      out.write("\n<table>\n\t<tr>\n\n\t\t<td valign=\"top\">\n\t\t");
      editorials_Show(request, response, session, out, seditorialsErr, sForm, sAction, conn, stat);
      out.write("\n\n\t\t</td>\n\t</tr>\n</table>\n\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "Footer.jsp", out, true);
      out.write(
          "\n<center><font face=\"Arial\"><small>This dynamic\nsite was generated with <a href=\"http://www.codecharge.com\">CodeCharge</a></small></font></center>\n</body>\n</html>\n");

      out.write('\n');

      if (stat != null) stat.close();
      if (conn != null) conn.close();

      out.write('\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);
    }
  }
  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);
    }
  }
Example #21
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;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;
      _jspx_resourceInjector =
          (org.apache.jasper.runtime.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

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

      DataSource ds = null;
      Connection con = null;
      PreparedStatement ps = null;
      InitialContext ic;
      try {
        ic = new InitialContext();
        ds = (DataSource) ic.lookup("java:/jdbc/AVMS");
        // ds = (DataSource)ic.lookup( "java:/jboss" );
        con = ds.getConnection();
        ps = con.prepareStatement("SELECT * FROM dbo.ROLE");
        // pr = con.prepareStatement("SELECT * FROM dbo.JMS_USERS");
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
          out.println("<br> " + rs.getString("role_name") + " | " + rs.getString("role_desc"));
          // out.println("<br> " +rs.getString("USERID") + " | " +rs.getString("PASSWD"));
        }
        rs.close();
        ps.close();
      } catch (Exception e) {
        out.println("Exception thrown :: " + e);
      } finally {
        if (con != null) {
          con.close();
        }
      }
      out.write('\n');
      out.write('\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 {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
  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; 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("\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<title>\n");
      out.write("Section 1\n");
      out.write("</title>\n");
      out.write("<style type=\"text/css\">\n");
      out.write("<!--\n");
      out.write(
          ".normalfont {font-size: 11pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\";}\n");
      out.write(
          ".bigfont {font-size: 14pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\";}\n");
      out.write(
          ".bigbigfont {font-size: 16pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\";}\n");
      out.write(
          ".darkbackgroundwithnormalfont {background-image: url(../gifs/brushed_metal_dkblue.jpg); font-size: 11pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\"; color: black; }\n");
      out.write(
          ".darkbackgroundwithhugefont {background-image: url(../gifs/brushed_metal_dkblue.jpg); font-size: 15pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\"; color: black; }\n");
      out.write(
          ".normalfontwithred {font-size: 11pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\"; color: red;}\n");
      out.write(".centertable {text-align: center; vertical-align: middle;}\n");
      out.write("a {text-decoration: none;}\n");
      out.write(
          ".headerfont {font-size: 18pt; font-family: \"Geneva, Arial, Helvetica, sans-serif\";}\n");
      out.write("button, button:focus, button:active {\n");
      out.write("    /* NOTE Remove all decorations */\n");
      out.write("    border: none;\n");
      out.write("    display: inline;\n");
      out.write("    margin: 0em;\n");
      out.write("    padding: 0em;\n");
      out.write("    outline: none;\n");
      out.write("    outline-offset: 0em;\n");
      out.write("    /* NOTE Look like a link */\n");
      out.write("    background: none;\n");
      out.write("    color: blue;\n");
      out.write("    cursor: pointer;\n");
      out.write("    font: inherit;\n");
      out.write("    text-decoration: none;\n");
      out.write("}\n");
      out.write("-->\n");
      out.write("</style>\n");
      out.write("</head>\n");
      out.write("<!-- bgcolor=\"aqua\" -->\n");
      out.write(
          "<body class=\"bodybackground\" style=\"margin-top: 0; margin-left: 0; margin-bottom: 4px; margin-right: 4px\">\n");
      out.write(
          "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"875px\" style=\"height: 100%\">\n");
      out.write("<tr valign=\"top\">\n");
      out.write("<td style=\"width: 190px;\" class=\"marginbackground\">\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write(
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("<title>Insert title here</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      out.write("\n");
      out.write(
          "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"normalfont\" style=\"height: 100%\" >\n");
      out.write("<tr style=\"height: 61px; border-bottom-width: 0px; \" valign=\"top\">\n");
      out.write("<td>\n");
      out.write("\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("<tr style=\"height: 10px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr class=\"darkbackgroundwithnormalfont\" style=\"height: 20px;\">\n");
      out.write("<td align=\"center\">\n");
      out.write("<b>\n");
      String e = (String) request.getSession().getAttribute("name");
      out.println(e);
      out.write("\n");
      out.write("</b>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("<tr style=\"height: 10px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr style=\"height: 35px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&#8226;&nbsp;\n");
      out.write("<a href=\"loginpath?id=professor_home_link\" style=\"color: darkblue;\">\n");
      out.write("Home Page\n");
      out.write("</a>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr style=\"height: 35px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&#8226;&nbsp;\n");
      out.write("<a href=\"professor_welcome_path?id=sections\" style=\"color: darkblue;\">\n");
      out.write("Sections\n");
      out.write("</a>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr style=\"height: 35px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&#8226;&nbsp;\n");
      out.write("<a href=\"professor_welcome_path?id=assignments\" style=\"color: darkblue;\">\n");
      out.write("Assignments\n");
      out.write("</a>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr style=\"height: 35px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&#8226;&nbsp;\n");
      out.write("<a href=\"prof_account_settings.jsp\" style=\"color: darkblue;\">\n");
      out.write("Account Settings\n");
      out.write("</a>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr style=\"height: 35px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&#8226;&nbsp;\n");
      out.write("<a href=\"loginpath?id=logout_link\" style=\"color: darkblue;\">\n");
      out.write("Log Out\n");
      out.write("</a>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<!-- more links here? -->\n");
      out.write("\n");
      out.write("<tr style=\"height: 10px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("<td>\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("<tr style=\"height: 35px;\">\n");
      out.write("<td>\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n");
      out.write("<a href=\"\" style=\"color: darkblue;\">\n");
      out.write("Help\n");
      out.write("</a>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("\n");
      out.write("</table>\n");
      out.write("\n");
      out.write("\n");
      out.write("</body>\n");
      out.write("</html>");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("</td>\n");
      out.write("<td style=\"width: 3px; background-color: black;\">&nbsp;</td>\n");
      out.write(
          "<td valign=\"top\" class=\"lightbackgroundwithnormalfont\" style=\"width: 686px;\">\n");
      out.write(
          "<CENTER><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" class=\"smallfont\" style=\"color: black;\">\n");
      out.write("<tr class=\"darkbackgroundwithhugefont\" style=\"height: 35px\">\n");
      out.write("<td colspan=\"3\" valign=\"middle\" align=\"center\">\n");
      out.write("<b>\n");
      out.write("Database Project\n");
      out.write("</b>\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("<tr style=\"height: 5px\">\n");
      out.write("<td colspan=\"3\">\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("</table></CENTER>\n");
      out.write("<hr/>\n");
      out.write("\n");
      out.write("\n");
      out.write("<!-- jsp here to get section name -->\n");
      String section = (String) request.getAttribute("section");
      String crn = (String) request.getAttribute("CRN");
      out.write("\n");
      out.write("\n");
      out.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n");
      out.write("<b class=\"headerfont\">");
      out.println(section);
      out.write(": New Assignment</b><br/><br/>\n");
      out.write("\n");
      out.write("<form method=\"post\" action=\"make_assignment_servlet?id=");
      out.println(crn);
      out.write("\">\n");
      out.write("Enter a name for the assignment:<input type=\"text\" name=\"name\"><br/>\n");
      out.write("Enter Deadline (MM/DD/YYYY):<input type=\"text\" name=\"deadline\"><br/>\n");
      out.write("Enter a description of the assignment:<br/>\n");
      out.write("<textarea name=\"description\"></textarea><br/>\n");
      out.write(
          "Number of questions:<input type=\"text\" size=\"3\" name=\"numQuestions\"><br/>\n");
      out.write("\n");
      out.write("<input type=\"Submit\" name=\"id\" value=\"Save Assignment\">\n");
      out.write("\n");
      out.write("</form>\n");
      out.write("\n");
      out.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">\n");
      out.write("<tr style=\"height: 5px\">\n");
      out.write("<td colspan=\"3\">\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("</td>\n");
      out.write("<td style=\"width: 3px; background-color: black;\">&nbsp;</td>\n");
      out.write("<td style=\"width: 190px\" class=\"marginbackground\">\n");
      out.write("&nbsp;\n");
      out.write("</td>\n");
      out.write("</tr>\n");
      out.write("</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);
    }
  }
Example #23
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;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;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE html>\n");
      out.write("<html>\n");
      out.write("    <head>\n");
      out.write(
          "        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("        <title>Fine</title>\n");
      out.write("        <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">    \n");
      out.write("\n");
      out.write("    </head>\n");
      out.write("    <body style = \"background-image: url(lib2.jpg)\">         \n");
      out.write("    <center>\n");
      out.write("        <h1>Update Fines information</h1>\n");
      out.write("        <form name=\"Update\" action=\"Fines_upd.jsp\">\n");
      out.write("            <table border=\"0\" width=\"3\" cellspacing=\"2\">\n");
      out.write("                <thead>\n");
      out.write("                    <tr>\n");
      out.write("                        <th>Update Fines</th>\n");
      out.write("                        <th></th>\n");
      out.write("                    </tr>\n");
      out.write("                </thead>\n");
      out.write("                <tbody>\n");
      out.write("                    <tr>\n");
      out.write("                        <td>Update Fine table with todays Data</td>\n");
      out.write(
          "                        <td><input type=\"submit\" value=\"Update / View Fines\" name=\"SUBMIT\"/></td>\n");
      out.write("                    </tr>\n");
      out.write("                </tbody>\n");
      out.write("            </table>           \n");
      out.write("        </form>\n");
      out.write("        <h1>Check your Fines Here</h1>\n");
      out.write("        <form name=\"Fines\" action=\"Fines.jsp\">\n");
      out.write("            <table border=\"0\" width=\"3\" cellspacing=\"2\">\n");
      out.write("                <thead>\n");
      out.write("                    <tr>\n");
      out.write("                        <th>Get Fine Details</th>\n");
      out.write("                        <th></th>\n");
      out.write("                    </tr>\n");
      out.write("                </thead>\n");
      out.write("                <tbody>\n");
      out.write("                    <tr>\n");
      out.write("                        <td>Card No</td>\n");
      out.write(
          "                        <td><input type=\"text\" name=\"Card_no\" value=\"\"/></td>\n");
      out.write("                    </tr>\n");
      out.write("                    <tr>\n");
      out.write("                        <td></td>\n");
      out.write(
          "                        <td><input type=\"submit\" value=\"Get Fines\" name=\"SUBMIT\" /></td>\n");
      out.write("                    </tr>\n");
      out.write("                </tbody>\n");
      out.write("            </table>        \n");
      out.write("            ");

      Connection con = null;
      String[] selected_Checkboxes = request.getParameterValues("chk");
      PreparedStatement pst = null;
      ResultSet result = null;
      ResultSet resUpd = null;
      con =
          DriverManager.getConnection(
              "jdbc:mysql://localhost:3306/lbms_db?zeroDateTimeBehavior=convertToNull",
              "root",
              "admin12");
      String Card_no = request.getParameter("Card_no");
      String button = null;
      Date dt = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
      String current_date = sdf.format(dt);
      if (Card_no != null && selected_Checkboxes == null) {
        String selSql =
            "SELECT  l.card_no, SUM(f.fine_amt) AS total_fine, f.paid  "
                + "FROM book_loans l, fines f  "
                + "WHERE l.loan_id = f.loan_id AND "
                + "l.card_no = "
                + Card_no
                + " "
                + "GROUP BY l.card_no";
        pst = con.prepareStatement(selSql);
        result = pst.executeQuery();
        String box = null;
        String paid;
        String pay;
        Boolean chk = false;
        out.println("<table>");
        pay = "<form action='Fines.jsp'>";
        out.println(pay);
        out.println("<tr>");
        out.println("<th>Card No</th>");
        out.println("<th>Fine_Amt</th>");
        out.println("<th>Paid OR Not</th>");
        out.println("</tr>");
        while (result.next()) {
          chk = true;
          paid = "No";
          if (result.getBoolean("f.paid")) {
            paid = "Yes";
          }

          out.println("<tr>");
          out.println(
              "<td>"
                  + result.getInt("l.card_no")
                  + "</td><td>"
                  + result.getString("total_fine")
                  + "</td><td>"
                  + paid
                  + "</td>");
          out.print("<td>");
          box = "<input name='chk' value=" + result.getInt("l.card_no") + " type='checkbox'>";
          out.print(box);
          out.print("</td>");
          out.print("</tr>");
        }

        if (chk == true) {
          out.println("<tr>");
          out.print("<td>");
          button = "<input type='submit' value='Pay Fine' name='Pay'>";
          out.print(button);
          out.print("</td>");
          out.println("</tr>");
        } else {

          out.write(
              "<dialog open> <font color = 'green'>No Fine information. You owe nothing! Thank You</font> </dialog>");
        }
        out.println("</form>");
        out.println("</table>");
      } else if (selected_Checkboxes != null) {
        String sqlLoan = null;
        ResultSet resultLoan = null;
        String sqlUpdFine = null;
        PreparedStatement pstUpd = null;
        String sqlBook = null;
        ResultSet rsltBook = null;
        char chkouts = 'N';

        int length_chk = selected_Checkboxes.length;
        for (int i = 0; i < length_chk; i++) {
          // Check whether the Book is returned before paying the fine.
          sqlBook =
              "SELECT COUNT(loan_id) AS no_chkouts FROM book_loans WHERE card_no = "
                  + selected_Checkboxes[i]
                  + " AND date_in = '0000-00-00' AND due_date < "
                  + current_date
                  + "";
          pst = con.prepareStatement(sqlBook);
          rsltBook = pst.executeQuery();
          while (rsltBook.next()) {
            if (rsltBook.getInt("no_chkouts") > 0) {
              chkouts = 'Y';
            }
          }
          if (chkouts == 'Y') {

            out.write(
                "<dialog open> <font color = 'red'>You have outstanding due checkouts!. Please return the books and then Pay the fine</font> </dialog>");
          }
          // Get the corresponding loan_Ids for each customer from Fines table

          sqlLoan =
              "SELECT loan_id FROM book_loans WHERE card_no = "
                  + selected_Checkboxes[i]
                  + " AND date_in IS NOT NULL AND due_date < date_in";
          pst = con.prepareStatement(sqlLoan);
          resultLoan = pst.executeQuery();
          while (resultLoan.next()) {
            sqlUpdFine =
                "UPDATE fines SET paid = true WHERE loan_id = " + resultLoan.getInt("loan_id") + "";
            pstUpd = con.prepareStatement(sqlUpdFine);
            pstUpd.executeUpdate();
            out.println("Payment Updated Successfully");
          }
        }
      }

      out.write("\n");
      out.write("        </form>        \n");
      out.write("    </center>\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);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
  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;

      /*
       * Licensed to the Apache Software Foundation (ASF) under one
       * or more contributor license agreements.  See the NOTICE file
       * distributed with this work for additional information
       * regarding copyright ownership.  The ASF licenses this file
       * to you under the Apache License, Version 2.0 (the
       * "License"); you may not use this file except in compliance
       * with the License.  You may obtain a copy of the License at
       *
       *     http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */

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

      final NamenodeJspHelper.NodeListJsp nodelistjsp = new NamenodeJspHelper.NodeListJsp();
      NameNode nn = (NameNode) application.getAttribute("name.node");
      String namenodeRole = nn.getRole().toString();
      FSNamesystem fsn = nn.getNamesystem();
      String namenodeLabel =
          nn.getNameNodeAddress().getHostName() + ":" + nn.getNameNodeAddress().getPort();

      out.write(
          "\n\n<html>\n\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hadoop.css\">\n<title>Hadoop ");
      out.print(namenodeRole);
      out.write(' ');
      out.print(namenodeLabel);
      out.write("</title>\n  \n<body>\n<h1>");
      out.print(namenodeRole);
      out.write(' ');
      out.write('\'');
      out.print(namenodeLabel);
      out.write("'</h1>\n");
      out.print(NamenodeJspHelper.getVersionTable(fsn));
      out.write(
          "\n<br />\n<b><a href=\"/nn_browsedfscontent.jsp\">Browse the filesystem</a></b><br>\n<b><a href=\"/logs/\">");
      out.print(namenodeRole);
      out.write(
          " Logs</a></b><br>\n<b><a href=/dfshealth.jsp> Go back to DFS home</a></b>\n<hr>\n");
      nodelistjsp.generateNodesList(out, nn, request);
      out.write('\n');
      out.write('\n');

      out.println(ServletUtil.htmlFooter());

      out.write('\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);
    }
  }
Example #25
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);
    }
  }