Exemplo n.º 1
0
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Reading All Request Parameters";
    out.println(
        ServletUtilities.headWithTitle(title)
            + "<BODY BGCOLOR=\"#FDF5E6\">\n"
            + "<H1 ALIGN=CENTER>"
            + title
            + "</H1>\n"
            + "<TABLE BORDER=1 ALIGN=CENTER>\n"
            + "<TR BGCOLOR=\"#FFAD00\">\n"
            + "<TH>Parameter Name<TH>Parameter Value(s)");
    Enumeration paramNames = request.getParameterNames();
    while (paramNames.hasMoreElements()) {
      String paramName = (String) paramNames.nextElement();
      out.println("<TR><TD>" + paramName + "\n<TD>");
      String[] paramValues = request.getParameterValues(paramName);
      if (paramValues.length == 1) {
        String paramValue = paramValues[0];
        if (paramValue.length() == 0) out.print("<I>No Value</I>");
        else out.print(paramValue);
      } else {
        out.println("<UL>");
        for (int i = 0; i < paramValues.length; i++) {
          out.println("<LI>" + paramValues[i]);
        }
        out.println("</UL>");
      }
    }
    out.println("</TABLE>\n</BODY></HTML>");
  }
Exemplo n.º 2
0
 private void getPermissions(HttpServletRequest request, Role item) {
   String[] per = request.getParameterValues("permissions");
   item.clearPermissions();
   for (int i = 0; i < per.length; i++) {
     item.addPermission(Long.parseLong(per[i]));
   }
 }
Exemplo n.º 3
0
 private void getPositions(HttpServletRequest request, Role item) {
   String[] pos = request.getParameterValues("positions");
   item.clearPositions();
   for (int i = 0; i < pos.length; i++) {
     item.addPosition(Long.parseLong(pos[i]));
   }
 }
Exemplo n.º 4
0
 /**
  * Return the values of the given parameter (ignoring case) for the given request.
  *
  * @param req the HttpServletRequest
  * @param paramName the name of the parameter to find.
  * @return the values of the given parameter for the given request.
  */
 public static String[] getParameterValuesIgnoreCase(HttpServletRequest req, String paramName) {
   Enumeration e = req.getParameterNames();
   while (e.hasMoreElements()) {
     String s = (String) e.nextElement();
     if (s.equalsIgnoreCase(paramName)) return req.getParameterValues(s);
   }
   return null;
 }
  /**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
   *
   * @param request servlet request
   * @param response servlet response
   */
  protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();

    LookupService lookupService = new LookupService();
    coshms.ejb.pathalogy.PathalogyRemote pthRemoteSB = lookupService.lookupPathalogyBean();

    java.util.ArrayList pthTestDomainList = new java.util.ArrayList();
    int tStatus = 0;

    if (request.getParameter("status") != null) {
      tStatus = 1;
    }
    String[] cid = request.getParameterValues("contentId");
    String[] cname = request.getParameterValues("cname");
    String[] unit = request.getParameterValues("unit");
    String[] minvalue = request.getParameterValues("minvalue");
    String[] maxvalue = request.getParameterValues("maxvalue");

    for (int i = 0; i < cname.length; i++) {
      PthTestContentsInfo pthTestCon =
          new PthTestContentsInfo(
              "",
              Integer.parseInt(cid[i]),
              cname[i],
              Double.parseDouble(minvalue[i]),
              Double.parseDouble(maxvalue[i]),
              unit[i]);
      pthTestDomainList.add(pthTestCon);
    }
    int empId = 1;

    if (pthRemoteSB.pthTestDomainEdit(
        pthTestDomainList,
        request.getParameter("tname"),
        tStatus,
        Integer.parseInt(request.getParameter("tcost")),
        empId,
        Integer.parseInt(request.getParameter("testId"))))
      response.sendRedirect("pthMessage.jsp?message=Pathalogy Test Edit Successfully");
    else response.sendRedirect("pthMessage.jsp?message=Try Again");
    out.close();
  }
Exemplo n.º 6
0
  /** @service the servlet service request. called once for each servlet request. */
  public void service(HttpServletRequest servReq, HttpServletResponse servRes) throws IOException {
    String name;
    String value[];
    String val;

    servRes.setHeader("AUTHORIZATION", "user fred:mypassword");
    ServletOutputStream out = servRes.getOutputStream();

    HttpSession session = servReq.getSession(true);
    session.setAttribute("timemilis", new Long(System.currentTimeMillis()));
    if (session.isNew()) {
      out.println("<p> Session is new ");
    } else {
      out.println("<p> Session is not new ");
    }
    Long l = (Long) session.getAttribute("timemilis");
    out.println("<p> Session id = " + session.getId());
    out.println("<p> TimeMillis = " + l);

    out.println("<H2>Servlet Params</H2>");
    Enumeration e = servReq.getParameterNames();
    while (e.hasMoreElements()) {
      name = (String) e.nextElement();
      value = servReq.getParameterValues(name);
      out.println(name + " : ");
      for (int i = 0; i < value.length; ++i) {
        out.println(value[i]);
      }
      out.println("<p>");
    }

    out.println("<H2> Request Headers : </H2>");
    e = servReq.getHeaderNames();
    while (e.hasMoreElements()) {
      name = (String) e.nextElement();
      val = (String) servReq.getHeader(name);
      out.println("<p>" + name + " : " + val);
    }
    try {
      BufferedReader br = servReq.getReader();
      String line = null;
      while (null != (line = br.readLine())) {
        out.println(line);
      }
    } catch (IOException ie) {
      ie.printStackTrace();
    }

    session.invalidate();
  }
Exemplo n.º 7
0
 protected void logParams() {
   Enumeration en = req.getParameterNames();
   while (en.hasMoreElements()) {
     String name = (String) en.nextElement();
     String vals[];
     String dispval;
     if (StringUtil.indexOfIgnoreCase(name, "passw") >= 0) {
       dispval = req.getParameter(name).length() == 0 ? "" : "********";
     } else if (log.isDebug2() && (vals = req.getParameterValues(name)).length > 1) {
       dispval = StringUtil.separatedString(vals, ", ");
     } else {
       dispval = req.getParameter(name);
     }
     log.debug(name + " = " + dispval);
   }
 }
Exemplo n.º 8
0
 // Get parameter map either directly from an Servlet 2.4 compliant implementation
 // or by looking it up explictely (thanks to codewax for the patch)
 private Map<String, String[]> getParameterMap(HttpServletRequest pReq) {
   try {
     // Servlet 2.4 API
     return pReq.getParameterMap();
   } catch (UnsupportedOperationException exp) {
     // Thrown by 'pseudo' 2.4 Servlet API implementations which fake a 2.4 API
     // As a service for the parameter map is build up explicitely
     Map<String, String[]> ret = new HashMap<String, String[]>();
     Enumeration params = pReq.getParameterNames();
     while (params.hasMoreElements()) {
       String param = (String) params.nextElement();
       ret.put(param, pReq.getParameterValues(param));
     }
     return ret;
   }
 }
Exemplo n.º 9
0
  public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    // 取得Session对象
    // 如果Session不存在,为本次会话创建此对象
    HttpSession session = req.getSession(true);
    Integer itemCount = (Integer) session.getValue("itemCount");
    // 如果session是新的
    if (itemCount == null) itemCount = new Integer(0);

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

    // 接收传来的参数
    String[] itemsSelected;
    String itemName;
    itemsSelected = req.getParameterValues("item");

    if (itemsSelected != null) {
      for (int i = 0; i < itemsSelected.length; i++) {
        itemName = itemsSelected[i];
        System.out.println(itemName);
        itemCount = new Integer(itemCount.intValue() + 1);
        // 购买的条目
        session.putValue("item" + itemCount, itemName);
        // 总条目
        session.putValue("itemCount", itemCount);
      }
    }

    out.println("<html>");
    out.println("<title>");
    out.println("item list");
    out.println("</title>");
    out.println("<body><h4>Session List:</h4><hr><br><br>");
    for (int i = 1; i <= itemCount.intValue(); i++) {
      out.println((String) session.getValue("item" + i) + "<hr>");
    }
    out.println("</body>");
    out.println("</html>");
    out.close();
  }
Exemplo n.º 10
0
  private void setProjectBean(HttpServletRequest request) {
    pb.setProjectname(request.getParameter("projectname"));
    pb.setTraining(request.getParameter("training"));
    pb.setEducation(request.getParameter("education"));
    pb.setOutreach(request.getParameter("outreach"));
    pb.setObserving(request.getParameter("observing"));
    pb.setDataservices(request.getParameter("dataservices"));
    pb.setVariability(request.getParameter("variability"));
    pb.setOperational(request.getParameter("operational"));
    pb.setResearch(request.getParameter("research"));
    pb.setVhistorical(request.getParameter("vhistorical"));
    pb.setVprojections(request.getParameter("vprojections"));
    pb.setAsurface(request.getParameter("asurface"));
    pb.setUpperair(request.getParameter("upperair"));
    pb.setComposition(request.getParameter("composition"));
    pb.setOsurface(request.getParameter("osurface"));
    pb.setSubsurface(request.getParameter("subsurface"));
    pb.setTerrestrial(request.getParameter("terrestrial"));
    pb.setSeasonal(request.getParameter("seasonal"));
    pb.setAnnual(request.getParameter("annual"));
    pb.setDecadal(request.getParameter("decadal"));
    pb.setEffect(request.getParameter("effect"));
    pb.setImpacts(request.getParameter("impacts"));
    pb.setEhistorical(request.getParameter("ehistorical"));
    pb.setEprojections(request.getParameter("eprojections"));
    pb.setAdaptation(request.getParameter("adaptation"));
    pb.setPhs(request.getParameter("phs"));
    pb.setFwr(request.getParameter("fwr"));
    pb.setEne(request.getParameter("ene"));
    pb.setTcc(request.getParameter("tcc"));
    pb.setCpd(request.getParameter("cpd"));
    pb.setScr(request.getParameter("scr"));
    pb.setAfi(request.getParameter("afi"));
    pb.setRat(request.getParameter("rat"));
    pb.setEco(request.getParameter("eco"));
    pb.setOth(request.getParameter("oth"));
    pb.setGuidance(request.getParameter("guidance"));
    pb.setGvariability(request.getParameter("gvariability"));
    pb.setGeffects(request.getParameter("geffects"));
    pb.setApps(request.getParameter("apps"));
    pb.setAvariability(request.getParameter("avariability"));
    pb.setAeffects(request.getParameter("aeffects"));
    pb.setPolicies(request.getParameter("policies"));
    pb.setAssessment(request.getParameter("assessment"));
    pb.setFresh(request.getParameter("fresh"));
    pb.setCoastal(request.getParameter("coastal"));
    pb.setMarine(request.getParameter("marine"));
    pb.setCentral(request.getParameter("central"));
    pb.setHawaii(request.getParameter("hawaii"));
    pb.setBig(request.getParameter("big"));
    pb.setMaui(request.getParameter("maui"));
    pb.setOahu(request.getParameter("oahu"));
    pb.setKauai(request.getParameter("kauai"));
    pb.setHother(request.getParameter("hother"));
    pb.setWestern(request.getParameter("western"));
    pb.setGuam(request.getParameter("guam"));
    pb.setCnmi(request.getParameter("cnmi"));
    pb.setFsm(request.getParameter("fsm"));
    pb.setRmi(request.getParameter("rmi"));
    pb.setPalau(request.getParameter("palau"));
    pb.setWother(request.getParameter("wother"));
    pb.setSouth(request.getParameter("south"));
    pb.setAsam(request.getParameter("asam"));
    pb.setSamoa(request.getParameter("samoa"));
    pb.setTonga(request.getParameter("tonga"));
    pb.setFiji(request.getParameter("fiji"));
    pb.setOz(request.getParameter("oz"));
    pb.setNz(request.getParameter("nz"));
    pb.setFp(request.getParameter("fp"));
    pb.setSother(request.getParameter("sother"));
    pb.setOtherregions(request.getParameter("otherregions"));
    pb.setStatus(request.getParameter("status"));
    pb.setLeadagencies(request.getParameterValues("leadagencies"));
    pb.setPartneragencies(request.getParameterValues("partneragencies"));
    pb.setProjectdescription(request.getParameter("projectdescription"));
    pb.setWorksheetfilename(request.getParameter("worksheetfilename"));
    pb.setTag(request.getParameter("tag"));
    pb.setCode(request.getParameter("code"));

    // separately handle contacts, email until figure out a better more efficient
    // way of passing names, emails as arrays to be picked up by request.getParameterValues...

    String[] contacts = new String[3];
    String[] emails = new String[3];

    contacts[0] = StringUtils.trimToEmpty(request.getParameter("contact1"));
    // System.out.println("AddProjectServlet.setProjectBean contacts[0] set to " + contacts[0] );
    contacts[1] = StringUtils.trimToEmpty(request.getParameter("contact2"));
    // System.out.println("AddProjectServlet.setProjectBean contacts[1] set to " + contacts[1] );
    contacts[2] = StringUtils.trimToEmpty(request.getParameter("contact3"));
    // System.out.println("AddProjectServlet.setProjectBean contacts[2] set to " + contacts[2] );

    emails[0] = StringUtils.trimToEmpty(request.getParameter("email1"));
    // System.out.println("AddProjectServlet.setProjectBean emails[0] set to " + emails[0] );
    emails[1] = StringUtils.trimToEmpty(request.getParameter("email2"));
    // System.out.println("AddProjectServlet.setProjectBean emails[1] set to " + emails[1] );
    emails[2] = StringUtils.trimToEmpty(request.getParameter("email3"));
    // System.out.println("AddProjectServlet.setProjectBean emails[2] set to " + emails[2] );

    pb.setContactName(contacts);
    pb.setEmailsAddress(emails);
    pb.setContactList();
    // System.out.println("Project " + pb.getProjectnumber() + ", " + pb.getProjectname() + "
    // contacts and emails have been set from request parameters " );
    // System.out.println("Contacts = " + pb.getContacts(""));

  }
Exemplo n.º 11
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);
    }
  }
Exemplo n.º 12
0
  public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      PrintWriter out = response.getWriter();

      nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 crm_db = new nseer_db_backup1(dbApplication);
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && crm_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        FileKind FileKind = new FileKind();
        ValidataNumber validata = new ValidataNumber();
        ValidataRecord vr = new ValidataRecord();

        counter count = new counter(dbApplication);
        ValidataTag vt = new ValidataTag();
        String register_ID = (String) dbSession.getAttribute("human_IDD");
        String config_id = request.getParameter("config_id");
        String pay_ID = request.getParameter("pay_ID");
        String product_amount = request.getParameter("product_amount");
        int num = Integer.parseInt(product_amount);
        String payer_name = request.getParameter("payer_name");
        String payer_ID = request.getParameter("payer_ID");
        String reason = request.getParameter("reason");
        String not_return_tag = request.getParameter("not_return_tag");
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String demand_return_time = request.getParameter("demand_return_time");
        String sales_name = request.getParameter("sales_name");
        String sales_ID = request.getParameter("sales_ID");
        String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
        String remark = exchange.toHtml(bodyc);
        String time = "";
        java.util.Date now = new java.util.Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        time = formatter.format(now);
        String[] product_IDn = request.getParameterValues("product_ID");
        String[] amountn = request.getParameterValues("amount");
        if (num == 0 && product_IDn.length == 1) {
          response.sendRedirect("draft/crm/credit_ok_a.jsp?pay_ID=" + pay_ID);
        } else {
          int p = 0;
          for (int i = 1; i <= num; i++) {
            String tem_amount = "amount" + i;
            String amount = request.getParameter(tem_amount);
            if (amount.equals("")) amount = "0";
            if (!validata.validata(amount)) {
              p++;
            }
          }
          int n = 0;
          String product_ID_group = "";
          for (int j = 1; j < product_IDn.length; j++) {
            product_ID_group += product_IDn[j] + ",";
            if (amountn[j].equals("")) amountn[j] = "0";
            if (!validata.validata(amountn[j])) {
              p++;
            }
          }
          for (int i = 1; i <= num; i++) {
            String tem_product_ID = "product_ID" + i;
            String product_ID = request.getParameter(tem_product_ID);
            if (product_ID_group.indexOf(product_ID) != -1) n++;
          }
          if (vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("9")
              || vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("5")) {

            if (p == 0) {
              try {
                if (n == 0) {
                  boolean flag = false;
                  List rsList = GetWorkflow.getList(crm_db, "crm_config_workflow", "05");
                  String[] elem = new String[3];
                  if (rsList.size() == 0) {
                    flag = true;
                  }
                  String sqll = "";
                  String[] aaa1 =
                      FileKind.getKind(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "crm_file",
                          "customer_ID",
                          payer_ID);

                  String stock_pay_ID =
                      NseerId.getId("stock/pay", (String) dbSession.getAttribute("unit_db_name"));
                  double demand_amount = 0.0d;
                  double list_price_sum = 0.0d;
                  double cost_price_sum = 0.0d;

                  for (int i = 1; i <= num; i++) {
                    String tem_product_name = "product_name" + i;
                    String tem_product_ID = "product_ID" + i;
                    String tem_available_amount = "available_amount" + i;
                    String tem_amount = "amount" + i;
                    String tem_list_price = "list_price" + i;
                    String tem_cost_price = "cost_price" + i;
                    String tem_type = "type" + i;
                    String tem_amount_unit = "amount_unit" + i;
                    String product_name = request.getParameter(tem_product_name);
                    String product_ID = request.getParameter(tem_product_ID);
                    String available_amount = request.getParameter(tem_available_amount);
                    String amount = request.getParameter(tem_amount);
                    if (amount.equals("")) amount = "0";
                    String list_price2 = request.getParameter(tem_list_price);
                    String cost_price = request.getParameter(tem_cost_price);
                    String type = request.getParameter(tem_type);
                    StringTokenizer tokenTO3 = new StringTokenizer(list_price2, ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    String amount_unit = request.getParameter(tem_amount_unit);
                    double list_price_subtotal =
                        Double.parseDouble(list_price) * Double.parseDouble(amount);
                    list_price_sum += list_price_subtotal;
                    double cost_price_subtotal =
                        Double.parseDouble(cost_price) * Double.parseDouble(amount);
                    cost_price_sum += cost_price_subtotal;
                    demand_amount += Double.parseDouble(amount);
                    String sql1 =
                        "update stock_apply_pay_details set amount='"
                            + amount
                            + "',list_price='"
                            + list_price
                            + "',list_price_subtotal='"
                            + list_price_subtotal
                            + "',cost_price='"
                            + cost_price
                            + "',subtotal='"
                            + cost_price_subtotal
                            + "' where pay_ID='"
                            + pay_ID
                            + "' and details_number='"
                            + i
                            + "'";
                    stock_db.executeUpdate(sql1);
                    if (flag) {
                      if (type.equals("物料") || type.equals("外购商品")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0','"
                                + amount
                                + "')";
                        stock_db.executeUpdate(sql2);
                      } else if (type.equals("商品") || type.equals("部件") || type.equals("委外部件")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0')";
                        stock_db.executeUpdate(sql2);
                      }

                      String sql97 =
                          "select * from crm_salecredit_balance_details where crediter_ID='"
                              + payer_ID
                              + "' and product_ID='"
                              + product_ID
                              + "'";
                      ResultSet rs97 = crm_db.executeQuery(sql97);
                      if (rs97.next()) {
                        double balance_amount =
                            rs97.getDouble("amount") + Double.parseDouble(amount);
                        double balance_cost_price_subtotal =
                            rs97.getDouble("subtotal") + cost_price_subtotal;
                        double balance_list_price_subtotal =
                            rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                        String sql96 =
                            "update crm_salecredit_balance_details set amount='"
                                + balance_amount
                                + "',check_tag='1',subtotal='"
                                + balance_cost_price_subtotal
                                + "',list_price_subtotal='"
                                + balance_list_price_subtotal
                                + "' where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_ID
                                + "'";
                        crm_db.executeUpdate(sql96);
                      } else {
                        String[] aaa =
                            FileKind.getKind(
                                (String) dbSession.getAttribute("unit_db_name"),
                                "design_file",
                                "product_ID",
                                product_ID);
                        String sql95 =
                            "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                + aaa[0]
                                + "','"
                                + aaa[1]
                                + "','"
                                + aaa1[0]
                                + "','"
                                + aaa1[1]
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + payer_ID
                                + "','"
                                + payer_name
                                + "')";
                        crm_db.executeUpdate(sql95);
                      }
                    }
                  }
                  String[] cost_pricen = request.getParameterValues("cost_price");
                  String[] list_pricen = request.getParameterValues("list_price");
                  String[] product_namen = request.getParameterValues("product_name");
                  String[] product_describen = request.getParameterValues("product_describe");
                  String[] amount_unitn = request.getParameterValues("amount_unit");
                  String[] typen = request.getParameterValues("type");
                  for (int i = 1; i < product_IDn.length; i++) {
                    StringTokenizer tokenTO3 = new StringTokenizer(list_pricen[i], ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    if (!amountn[i].equals("") && Double.parseDouble(amountn[i]) != 0) {
                      double list_price_subtotal =
                          Double.parseDouble(list_price) * Double.parseDouble(amountn[i]);
                      list_price_sum += list_price_subtotal;
                      double subtotal =
                          Double.parseDouble(cost_pricen[i]) * Double.parseDouble(amountn[i]);
                      cost_price_sum += subtotal;
                      demand_amount += Double.parseDouble(amountn[i]);
                      num++;
                      String sql1 =
                          "insert into stock_apply_pay_details(payer_chain_ID,payer_chain_name,sales_ID,sales_name,payer_ID,payer_name,payer_type,pay_ID,details_number,product_ID,product_name,product_describe,amount,amount_unit,list_price,list_price_subtotal,cost_price,subtotal,type) values ('"
                              + aaa1[0]
                              + "','"
                              + aaa1[1]
                              + "','"
                              + sales_ID
                              + "','"
                              + sales_name
                              + "','"
                              + payer_ID
                              + "','"
                              + payer_name
                              + "','销售赊货','"
                              + pay_ID
                              + "','"
                              + num
                              + "','"
                              + product_IDn[i]
                              + "','"
                              + product_namen[i]
                              + "','"
                              + product_describen[i]
                              + "','"
                              + amountn[i]
                              + "','"
                              + amount_unitn[i]
                              + "','"
                              + list_price
                              + "','"
                              + list_price_subtotal
                              + "','"
                              + cost_pricen[i]
                              + "','"
                              + subtotal
                              + "','"
                              + typen[i]
                              + "')";
                      stock_db.executeUpdate(sql1);
                      // **********************
                      if (rsList.size() == 0) {
                        if (typen[i].equals("物料") || typen[i].equals("外购商品")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0','"
                                  + amountn[i]
                                  + "')";
                          stock_db.executeUpdate(sql2);
                        } else if (typen[i].equals("商品")
                            || typen[i].equals("部件")
                            || typen[i].equals("委外部件")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0')";
                          stock_db.executeUpdate(sql2);
                        }

                        String sql97 =
                            "select * from crm_salecredit_balance_details where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_IDn[i]
                                + "'";
                        ResultSet rs97 = crm_db.executeQuery(sql97);
                        if (rs97.next()) {
                          double balance_amount =
                              rs97.getDouble("amount") + Double.parseDouble(amountn[i]);
                          double balance_cost_price_subtotal =
                              rs97.getDouble("subtotal") + subtotal;
                          double balance_list_price_subtotal =
                              rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                          String sql96 =
                              "update crm_salecredit_balance_details set amount='"
                                  + balance_amount
                                  + "',check_tag='1',subtotal='"
                                  + balance_cost_price_subtotal
                                  + "',list_price_subtotal='"
                                  + balance_list_price_subtotal
                                  + "' where crediter_ID='"
                                  + payer_ID
                                  + "' and product_ID='"
                                  + product_IDn[i]
                                  + "'";
                          crm_db.executeUpdate(sql96);
                        } else {
                          String[] aaa =
                              FileKind.getKind(
                                  (String) dbSession.getAttribute("unit_db_name"),
                                  "design_file",
                                  "product_ID",
                                  product_IDn[i]);
                          String sql95 =
                              "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                  + aaa[0]
                                  + "','"
                                  + aaa[1]
                                  + "','"
                                  + aaa1[0]
                                  + "','"
                                  + aaa1[1]
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + payer_ID
                                  + "','"
                                  + payer_name
                                  + "')";
                          crm_db.executeUpdate(sql95);
                        }
                      }
                      // ***************************
                    }
                  }
                  String sql =
                      "update stock_apply_pay set reason='"
                          + reason
                          + "',register='"
                          + register
                          + "',register_time='"
                          + register_time
                          + "',demand_return_time='"
                          + demand_return_time
                          + "',register_time='"
                          + register_time
                          + "',register='"
                          + register
                          + "',remark='"
                          + remark
                          + "',demand_amount='"
                          + demand_amount
                          + "',list_price_sum='"
                          + list_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',not_return_tag='"
                          + not_return_tag
                          + "' where pay_ID='"
                          + pay_ID
                          + "'";
                  stock_db.executeUpdate(sql);
                  if (flag) {
                    sql = "update stock_apply_pay set check_tag='1' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    if (!vr.validata(
                        (String) dbSession.getAttribute("unit_db_name"),
                        "stock_pay",
                        "reasonexact",
                        pay_ID)) {
                      String sql4 =
                          "insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,list_price_sum,cost_price_sum,register,register_time) values('"
                              + stock_pay_ID
                              + "','"
                              + reason
                              + "','"
                              + pay_ID
                              + "','"
                              + payer_name
                              + "','"
                              + demand_amount
                              + "','"
                              + list_price_sum
                              + "','"
                              + cost_price_sum
                              + "','"
                              + register
                              + "','"
                              + register_time
                              + "')";
                      stock_db.executeUpdate(sql4);
                    }

                    String sql98 = "select * from crm_file where customer_ID='" + payer_ID + "'";
                    ResultSet rs98 = crm_db.executeQuery(sql98);
                    if (rs98.next()) {
                      double salecredit_list_price_sum =
                          rs98.getDouble("salecredit_list_price_sum") + list_price_sum;
                      double salecredit_cost_price_sum =
                          rs98.getDouble("salecredit_cost_price_sum") + cost_price_sum;

                      String sql99 =
                          "update crm_file set credit_yes_or_not_tag='1',salecredit_list_price_sum='"
                              + salecredit_list_price_sum
                              + "',salecredit_cost_price_sum='"
                              + salecredit_cost_price_sum
                              + "' where customer_ID='"
                              + payer_ID
                              + "' ";
                      crm_db.executeUpdate(sql99);
                    }
                  } else {
                    sql = "update stock_apply_pay set check_tag='0' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    Iterator ite = rsList.iterator();
                    while (ite.hasNext()) {
                      elem = (String[]) ite.next();
                      sql =
                          "insert into crm_workflow(config_id,object_ID,describe1,describe2) values ('"
                              + elem[0]
                              + "','"
                              + pay_ID
                              + "','"
                              + elem[1]
                              + "','"
                              + elem[2]
                              + "')";
                      crm_db.executeUpdate(sql);
                    }
                  }

                  response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=8");
                } else {

                  response.sendRedirect(
                      "draft/crm/credit_ok.jsp?finished_tag=7&pay_ID=" + pay_ID + "");
                }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
            } else {

              response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=6&pay_ID=" + pay_ID + "");
            }
          } else {

            response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=9");
          }
        }
        stock_db.commit();
        crm_db.commit();
        stock_db.close();
        crm_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      nseer_db_backup1 fund_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 fund_db1 = new nseer_db_backup1(dbApplication);
      if (fund_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && fund_db1.conn((String) dbSession.getAttribute("unit_db_name"))) {
        counter count = new counter(dbApplication);
        ValidataRecordNumber vrn = new ValidataRecordNumber();
        ValidataTag vt = new ValidataTag();
        ValidataNumber validata = new ValidataNumber();
        try {
          String time = "";
          java.util.Date now = new java.util.Date();
          SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
          time = formatter.format(now);

          String apply_pay_ID = request.getParameter("apply_pay_ID");
          String register_time = request.getParameter("register_time");
          String register = request.getParameter("register");
          String register_ID = request.getParameter("register_ID");
          String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
          String remark = exchange.toHtml(bodyc);
          String amount = request.getParameter("amount");
          String[] file_kind = request.getParameterValues("file_kind");
          String[] cost_price_subtotal = request.getParameterValues("cost_price_subtotal");
          int p = 0;
          String file_kinda = ",";
          for (int j = 1; j < file_kind.length; j++) {
            file_kinda += file_kind[j] + ",";
            if (cost_price_subtotal[j].equals("")) cost_price_subtotal[j] = "0";
            StringTokenizer tokenTO4 = new StringTokenizer(cost_price_subtotal[j], ",");
            String cost_price_subtotal1 = "";
            while (tokenTO4.hasMoreTokens()) {
              cost_price_subtotal1 += tokenTO4.nextToken();
            }
            if (!validata.validata(cost_price_subtotal1)) {
              p++;
            }
          }
          int n = 0;
          for (int i = 1; i <= Integer.parseInt(amount); i++) {
            String tem_file_kind = "file_kind" + i;
            String file_kind2 = request.getParameter(tem_file_kind);
            if (file_kinda.indexOf(file_kind2) != -1) n++;
          }
          if (n == 0) {
            if (p == 0) {
              if (vt.validata(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "fund_apply_pay",
                          "apply_pay_ID",
                          apply_pay_ID,
                          "check_tag")
                      .equals("5")
                  || vt.validata(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "fund_apply_pay",
                          "apply_pay_ID",
                          apply_pay_ID,
                          "check_tag")
                      .equals("9")) {
                String currency_name = "";
                String personal_unit = "";
                String chain_ID = "";
                String chain_name = "";
                String funder = "";
                String funder_ID = "";
                String sql11 =
                    "select * from fund_apply_pay where apply_pay_ID='" + apply_pay_ID + "'";
                ResultSet rs11 = fund_db.executeQuery(sql11);
                while (rs11.next()) {
                  chain_ID = rs11.getString("chain_ID");
                  chain_name = rs11.getString("chain_name");
                  funder = rs11.getString("human_name");
                  funder_ID = rs11.getString("human_ID");
                  currency_name = rs11.getString("currency_name");
                  personal_unit = rs11.getString("personal_unit");
                }
                int expenses_amount = 0;
                String sql6 =
                    "select count(*) from fund_apply_pay_details where apply_pay_ID='"
                        + apply_pay_ID
                        + "'";
                ResultSet rs6 = fund_db.executeQuery(sql6);
                if (rs6.next()) {
                  expenses_amount = rs6.getInt("count(*)");
                }
                double demand_cost_price_sum = 0.0d;
                for (int i = 1; i <= expenses_amount; i++) {
                  String tem_cost_price_subtotal = "cost_price_subtotal" + i;
                  String cost_price_subtotal2 = request.getParameter(tem_cost_price_subtotal);
                  demand_cost_price_sum += Double.parseDouble(cost_price_subtotal2);
                  sql6 =
                      "update fund_apply_pay_details set cost_price_subtotal='"
                          + cost_price_subtotal2
                          + "' where apply_pay_ID='"
                          + apply_pay_ID
                          + "' and details_number='"
                          + i
                          + "'";
                  fund_db.executeUpdate(sql6);
                }
                for (int i = 1; i < file_kind.length; i++) {
                  StringTokenizer tokenTO1 = new StringTokenizer(file_kind[i], "/");
                  String file_chain_ID = "";
                  String file_chain_name = "";
                  while (tokenTO1.hasMoreTokens()) {
                    file_chain_ID = tokenTO1.nextToken();
                    file_chain_name = tokenTO1.nextToken();
                  }
                  StringTokenizer tokenTO4 = new StringTokenizer(cost_price_subtotal[i], ",");
                  String cost_price_subtotal1 = "";
                  while (tokenTO4.hasMoreTokens()) {
                    cost_price_subtotal1 += tokenTO4.nextToken();
                  }
                  demand_cost_price_sum += Double.parseDouble(cost_price_subtotal1);
                  expenses_amount++;
                  String sql1 =
                      "insert into fund_apply_pay_details(apply_pay_ID,details_number,file_chain_ID,file_chain_name,cost_price_subtotal) values ('"
                          + apply_pay_ID
                          + "','"
                          + expenses_amount
                          + "','"
                          + file_chain_ID
                          + "','"
                          + file_chain_name
                          + "','"
                          + cost_price_subtotal1
                          + "')";
                  fund_db.executeUpdate(sql1);
                }

                String sql =
                    "update fund_apply_pay set demand_cost_price_sum='"
                        + demand_cost_price_sum
                        + "',check_tag='2',register_time='"
                        + register_time
                        + "',register='"
                        + register
                        + "',remark='"
                        + remark
                        + "' where apply_pay_ID='"
                        + apply_pay_ID
                        + "'";
                fund_db.executeUpdate(sql);

                response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=2");
              } else {
                response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=3");
              }
            } else {
              response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=6");
            }
          } else {
            response.sendRedirect("draft/fund/applyPayExpenses_ok.jsp?finished_tag=7");
          }
        } catch (Exception ex) {
          ex.printStackTrace();
        }
        fund_db.commit();
        fund_db1.commit();
        fund_db.close();
        fund_db1.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Exemplo n.º 14
0
  public void processRequest(HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {
    HttpSession session = req.getSession(true);

    root = req.getContextPath();

    String addButton = req.getParameter("addButton");

    try {
      session = req.getSession(true);

      if (session.isNew()) {
        session.invalidate();
        res.setContentType("text/html;charset=UTF-8");

        PrintWriter out = res.getWriter();

        out.println(
            (new StringBuilder())
                .append("<html><HEAD><META HTTP-EQUIV='Refresh' CONTENT='0; URL=")
                .append(root)
                .append("/AID'/></HEAD></html>")
                .toString());
        out.close();
      }
    } catch (IllegalStateException e) {
      res.sendRedirect((new StringBuilder()).append(root).append("/AID").toString());
    }

    String originalQuery = (String) session.getAttribute("query");

    if (addButton != null) {
      String newQueryTerms[] = (String[]) req.getParameterValues("newQueryTerms");

      if ((newQueryTerms == null) || (newQueryTerms.length == 0)) {
        res.sendRedirect(
            res.encodeURL(
                root.concat(
                    (new StringBuilder())
                        .append("/AID?query=")
                        .append(originalQuery.replaceAll("\\s+", "+"))
                        .toString())));
      } else {
        String newQuery = originalQuery.replaceAll("\\s+", "+");

        for (int i = 0; i < newQueryTerms.length; i++) {
          newQuery =
              (new StringBuilder())
                  .append(newQuery)
                  .append("+")
                  .append(newQueryTerms[i])
                  .toString();
        }

        res.sendRedirect(
            res.encodeURL(
                root.concat(
                    (new StringBuilder()).append("/AID?query=").append(newQuery).toString())));
      }
    } else {
      String spellMatrix[] = (String[]) session.getAttribute("retSpellSuggestions");
      String termsInQuery[] = (String[]) session.getAttribute("termsInQuery");
      String wordnetMatrix[][] = (String[][]) session.getAttribute("retWordnetSynsMatrix");
      String synonymMatrix[][] = (String[][]) session.getAttribute("retSynsMatrix");
      String onlineSynMatrix[][] = (String[][]) session.getAttribute("onlineSynMatrix");

      res.setContentType("text/html;charset=UTF-8");

      PrintWriter out = res.getWriter();

      out.println(
          "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
      out.println("<html>");
      out.println("<head>");
      out.println("<title>AID Search interface</title>");
      out.println(
          (new StringBuilder())
              .append("<style type='text/css'>@import url(")
              .append(root)
              .append("/css/qckcss.css);")
              .toString());
      out.println("</style>");
      out.println(
          (new StringBuilder())
              .append("<link REL=\"SHORTCUT ICON\" HREF=\"")
              .append(root)
              .append("/images/favicon.ico\">")
              .toString());
      out.println(
          (new StringBuilder())
              .append("<script type=\"text/javascript\" src=\"")
              .append(root)
              .append("/javascript/overlib.js\">")
              .toString());
      out.println("<!-- bla -->");
      out.println("</script>");
      out.println("</head>");
      out.println(
          (new StringBuilder())
              .append("<body bgcolor=white background=\"")
              .append(root)
              .append("/images/background.gif\">")
              .toString());
      out.println("<div id=\"AIDfp\">");
      out.println("<a name=\"top\"/>");
      out.println("  <table border=\"0\" width=600>");
      out.println("<tr><td colspan=3>");
      out.println("<table>");
      out.println("\t<tr valign=\"top\" bgcolor=white><td class=\"navtext\">");
      out.println("\t<div id=\"navlinks\">");
      out.println(
          (new StringBuilder())
              .append("\t\t<img src=\"")
              .append(root)
              .append(
                  "/images/top.png\" width=\"709\" height=\"200\" border=\"0\"><!-- bla --> </img>")
              .toString());
      out.println(
          (new StringBuilder())
              .append(
                  "\t\t<div style=\"position: relative;top: -55px;margin-left: 15px;\"><a href=\"")
              .append(root)
              .append("/\">Home</a></div>")
              .toString());
      out.println(
          "\t\t<div style=\"position: relative;top: -71px;margin-left: 180px;\">Concept Finder</div>");
      out.println(
          "\t\t<div style=\"position: relative;top: -87px;margin-left: 410px;\">Search Details</div>");
      out.println(
          "\t\t<div style=\"position: relative;top: -103px;margin-left: 620px;\">History</div>");
      out.println("</div></td></tr></table>");
      out.println("</td></tr>");
      out.println(
          (new StringBuilder())
              .append("    <form name=\"selectionForm\" method=\"get\" action=\"")
              .append(res.encodeURL(req.getRequestURI()))
              .append("\">")
              .toString());
      out.println("      <tr>");
      out.println("        <td width=33% class='resultItemCenter'>");

      if (synonymMatrix != null) {
        out.println("          Found index-specific syonyms:<br>");
        out.println("          <select name='newQueryTerms' multiple>");

        for (int i = 0; i < synonymMatrix.length; i++) {
          for (int j = 0; j < synonymMatrix[i].length; j++) {
            if (synonymMatrix[i][j] != null) {
              out.println(
                  (new StringBuilder())
                      .append("            <option value='")
                      .append(synonymMatrix[i][j])
                      .append("'>")
                      .append(synonymMatrix[i][j])
                      .append("</option>")
                      .toString());
            }
          }
        }

        out.println("          </select>");
      }

      out.println("        </td>");
      out.println("        <td width=33% class='resultItemCenter'>");

      if (wordnetMatrix != null) {
        out.println("          Found Wordnet syonyms:<br>");
        out.println("          <select name='newQueryTerms' multiple>");

        for (int i = 0; i < wordnetMatrix.length; i++) {
          for (int j = 0; j < wordnetMatrix[i].length; j++) {
            if (wordnetMatrix[i][j] != null) {
              out.println(
                  (new StringBuilder())
                      .append("            <option value='")
                      .append(wordnetMatrix[i][j])
                      .append("'>")
                      .append(wordnetMatrix[i][j])
                      .append("</option>")
                      .toString());
            }
          }
        }

        out.println("          </select>");
      }

      out.println("        </td>");
      out.println("        <td width=33% class='resultItemCenter'>");

      if (onlineSynMatrix != null) {
        out.println("          Found online acronyms:<br>");
        out.println("          <select name='newQueryTerms' multiple>");

        for (int i = 0; i < onlineSynMatrix.length; i++) {
          for (int j = 0; j < onlineSynMatrix[i].length; j++) {
            if (onlineSynMatrix[i][j] != null) {
              out.println(
                  (new StringBuilder())
                      .append("            <option value='")
                      .append(onlineSynMatrix[i][j])
                      .append("'>")
                      .append(onlineSynMatrix[i][j])
                      .append("</option>")
                      .toString());
            }
          }
        }

        out.println("          </select>");
      }

      out.println("        </td>          </tr>");
      out.println("      <tr>");
      out.println("        <td class='resultItemCenter' width=100% colspan=3>");
      out.println("              <hr/>");
      out.println("        </td>");
      out.println("      </tr>");
      out.println("      <tr>");
      out.println("        <td class='resultItemCenter' width=100% colspan=3>");
      out.println("          <input type=submit name=\"addButton\" value=\"Add\">");
      out.println("        </td>");
      out.println("      </tr>");
      out.println("    </form>");
      out.println("  </table>");
      out.println("<div id=\"footer\">");
      out.println("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">");
      out.println("<tr>");
      out.println(
          (new StringBuilder())
              .append("<td width=\"1%\"><img src=\"")
              .append(root)
              .append(
                  "/images/footer-leftcurve.gif\" width=\"10\" height=\"31\" border=\"0\"/></td>")
              .toString());
      out.println("<td width=\"98%\" bgcolor=\"#\" class=\"footertext\">");
      out.println("<a href=\"#top\">Top</a>");
      out.println("        |\t\t");
      out.println(
          (new StringBuilder())
              .append("<a href=\"")
              .append(root)
              .append("/synonym\">Synonym client</a>")
              .toString());
      out.println("        |\t\t");
      out.println("<a href=\"http://www.vl-e.nl\">Vl-e</a>");
      out.println("</td>");
      out.println(
          (new StringBuilder())
              .append("<td width=\"1%\"><img src=\"")
              .append(root)
              .append(
                  "/images/footer-rightcurve.gif\" width=\"10\" height=\"31\" border=\"0\"/></td>")
              .toString());
      out.println("</tr>");
      out.println("</table>");
      out.println("</div>");
      out.println("</div>");
      out.println("</body>");
      out.println("</html>");
      out.close();
    }
  }
Exemplo n.º 15
0
  public void getEnv(VariableTable vt) {
    Enumeration e = null;
    HttpServletRequest request = (HttpServletRequest) (pageContext.getRequest());
    HttpSession session = request.getSession(false);

    String db_charset = "gb2312";
    String url_charset = null;

    vt.remove("SESSION.LOGINID");
    vt.remove("SESSION.LOGINNAME");
    vt.remove("SESSION.LOGINROLE");

    if (vt.exists("WEBCHART.DB_CHARSET")) {
      db_charset = vt.getString("WEBCHART.DB_CHARSET");
    }

    if (vt.exists("WEBCHART.URL_CHARSET")) {
      url_charset = vt.getString("WEBCHART.URL_CHARSET");
    }

    if (session != null) {
      e = session.getAttributeNames();
      while (e.hasMoreElements()) {
        String name = (String) e.nextElement();
        Object value = session.getAttribute(name);
        vt.add(name, java.sql.Types.VARCHAR);
        if (value != null) vt.setValue(name, value.toString());
      }
      vt.add("SESSION.ID", java.sql.Types.VARCHAR);
      vt.setValue("SESSION.ID", session.getId());
      vt.add("SESSION.CREATE", java.sql.Types.VARCHAR);
      vt.setValue(
          "SESSION.CREATE",
          DBOperation.toString(
              new java.util.Date(session.getCreationTime()), "yyyy-MM-dd HH:mm:ss"));
      vt.add("SESSION.ACCESS", java.sql.Types.VARCHAR);
      vt.setValue(
          "SESSION.ACCESS",
          DBOperation.toString(
              new java.util.Date(session.getLastAccessedTime()), "yyyy-MM-dd HH:mm:ss"));
    }
    e = request.getParameterNames();
    while (e.hasMoreElements()) {
      String name = (String) e.nextElement();
      String value = request.getParameter(name);
      ;
      String par_values[] = request.getParameterValues(name);
      name = name.toUpperCase();
      if (name.equalsIgnoreCase("WEBCHART.SECURITY")
          || name.equalsIgnoreCase("WEBCHART.DEFAULTACCESS")
          || name.equalsIgnoreCase("WEBCHART.ALLOW")
          || name.equalsIgnoreCase("WEBCHART.DENY")
          || name.equalsIgnoreCase("WEBCHART.IPSECURITY")
          || name.equalsIgnoreCase("WEBCHART.IPACCESS")
          || name.equalsIgnoreCase("WEBCHART.IPALLOW")
          || name.equalsIgnoreCase("WEBCHART.IPDENY")
          || name.equalsIgnoreCase("WEBCHART.XSLDOC")
          || name.equalsIgnoreCase("WEBCHART.IMAGEONLY")
          || name.equalsIgnoreCase("WEBCHART.XMLDATA")
          || name.equalsIgnoreCase("WEBCHART.LOGSQL")
          || name.equalsIgnoreCase("WEBCHART.DATATYPE")
          || name.equalsIgnoreCase("WEBCHART.URLS")
          || name.equalsIgnoreCase("WEBCHART.TOPURLS")
          || name.equalsIgnoreCase("WEBCHART.TOPCURR")
          || name.equalsIgnoreCase("WEBCHART.LEFTURLS")
          || name.equalsIgnoreCase("WEBCHART.LEFTCURR")
          || name.equalsIgnoreCase("WEBCHART.INPUTS")
          || name.equalsIgnoreCase("WEBCHART.CACHE")
          || name.equalsIgnoreCase("WEBCHART.DATA")
          || name.equalsIgnoreCase("WEBCHART.CSS")
          || name.equalsIgnoreCase("WEBCHART.RELOAD")
          || name.equalsIgnoreCase("WEBCHART.EXPIRE")
          || name.equalsIgnoreCase("WEBCHART.DMLKEY")
          || name.equalsIgnoreCase("WEBCHART.ENGINE")
          || name.equalsIgnoreCase("WEBCHART.EXCELURL")
          || name.equalsIgnoreCase("WEBCHART.DBID")
          || name.equalsIgnoreCase("WEBCHART.DBIDSEED")
          || name.equalsIgnoreCase("WEBCHART.SECUREFIELDS")
          || name.equalsIgnoreCase("WEBCHART.KEEP_CACHE_IMAGE")
          || name.equalsIgnoreCase("WEBCHART.KEEP_CACHE_TIME")
          || name.startsWith("WEBCHART.SECUREMEMO")
          || name.startsWith("WEBCHART.QUERY_")
          || name.startsWith("WEBCHART.HEADHTML_")
          || name.startsWith("WEBCHART.DATAHTML_")
          || name.startsWith("WEBCHART.VARLIST_")
          || name.startsWith("WEBCHART.FORALL_")
          || name.startsWith("WEBCHART.XMLDATA_")
          || name.startsWith("WEBCHART.TABLE_")
          || name.startsWith("WEBCHART.COLUMN_")
          || name.startsWith("SESSION.")) continue;
      if (name.startsWith("WEBCHART.") && !name.equals("WEBCHART.DOCTYPE")) continue;
      vt.add(name, java.sql.Types.VARCHAR);

      if (par_values != null && par_values.length > 1) {
        StringBuffer temp = new StringBuffer();
        for (int i = 0; i < par_values.length; i++) {
          if (par_values[i] != null && par_values[i].trim().length() > 0) {
            if (temp.length() > 0) {
              temp.append(",");
            }
            temp.append(par_values[i]);
          }
        }
        value = temp.toString();
      }
      if (url_charset != null) {
        try {
          value = new String(value.getBytes(url_charset), db_charset);
        } catch (java.io.UnsupportedEncodingException uee) {
        }
        ;
      }
      vt.setValue(name, value);
    }
    vt.add("REQUEST.REMOTEADDR", java.sql.Types.VARCHAR);
    vt.setValue("REQUEST.REMOTEADDR", getClientIPAddr());
    vt.add("REQUEST.REMOTEHOST", java.sql.Types.VARCHAR);
    vt.setValue("REQUEST.REMOTEHOST", request.getRemoteAddr());
    vt.add("REQUEST.REFERER", java.sql.Types.VARCHAR);
    vt.setValue("REQUEST.REFERER", request.getHeader("Referer"));
    vt.add("REQUEST.QUERYSTRING", java.sql.Types.VARCHAR);
    vt.setValue("REQUEST.QUERYSTRING", request.getQueryString());
  }
Exemplo n.º 16
0
  public void service(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();

    Connection con = null;

    String bnm[] = req.getParameterValues("Comics");

    String qty[] = new String[bnm.length];
    ArrayList al1 = new ArrayList();
    ArrayList al2 = new ArrayList();
    for (int i = 0; i < bnm.length; i++) {
      qty[i] = req.getParameter(bnm[i]);
      al1.add(bnm[i]);
      al2.add(qty[i]);
    }

    HttpSession HSession = req.getSession(true);

    ArrayList alo1 = (ArrayList) HSession.getValue("bNames");
    ArrayList alo2 = (ArrayList) HSession.getValue("bQty");

    al1.addAll(alo1);
    al2.addAll(alo2);

    HSession.putValue("bNames", al1);
    HSession.putValue("bQty", al2);

    out.println("<html>");
    out.println("<title>Categories..</title>");
    out.println("<body bgcolor=gold >");

    out.println("<b><font face=\"Papyrus\" size=36 color= #806F7E><center>");
    out.println("<big>Category</big></center>");

    out.println("<ul type=disc>");
    out.println("<font face=\"Maiandra GD\" color=black size=4>");
    out.println("<li type=square>Choose your category..");
    out.println("</li></font><br>");

    out.println(
        "<A href=\"FictionClick\"><font face=\"Mistral\" size=8 color=#208234><b>Fiction</b></A><br>");

    out.println(
        "<A href=\"NonFictionClick\"><font face=\"Mistral\" size=8 color=#208234><b>Non-Fiction</b></A><br>");

    out.println(
        "<A href=\"AutobiographyClick\"><font face=\"Mistral\" size=8 color=#208234><b>Autobiography</b></A><br>");

    out.println(
        "<A href=\"HistoryClick\"><font face=\"Mistral\" size=8 color=#208234><b>History</b></A><br>");

    out.println(
        "<A href=\"ComicsClick\"><font face=\"Mistral\" size=8 color=#208234><b>Comics</b></A></font><br><br>");

    out.println("<center><form action=\"http://localhost:8080/servlet/FinalList\">");
    out.println("<input type=submit value=\" Finalize List >>\"></form>");

    out.println("<font face=\"Maiandra GD\" color=black size=4>");
    out.println("Moves to final List..</center>");

    out.println("</font></body>");
    out.println("</html>");
  } // service
Exemplo n.º 17
0
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    if (!runFlag) {
      refreshCount++;
      System.out.println("Refresh " + refreshCount + " times......");

      // redirect to index.jsp
      request.getRequestDispatcher("/index.jsp").forward(request, response);

      return;
    }

    // response.setContentType("text/html;charset=GBK");
    request.setCharacterEncoding("GBK");
    // PrintWriter out = response.getWriter();

    // get global parameters from web
    projectName = request.getParameter("projectName");
    serverIp = request.getParameter("serverIp");
    startServerCmd = request.getParameter("startServerCmd");
    System.out.println("get projectName from web: " + projectName);
    System.out.println("get serverIp from web: " + serverIp);
    System.out.println("get startServerCmd from web: " + startServerCmd);

    // get stress parameters from web
    startStressCmd = request.getParameter("startStressCmd");
    stressLog = request.getParameter("stressLog");
    stressName = request.getParameter("stressName");
    System.out.println("get startStressCmd from web: " + startStressCmd);
    System.out.println("get stressName from web: " + stressName);

    // get stress IP from web
    String[] clients = request.getParameterValues("client");
    int clientsLen = clients.length;
    System.out.println("get clients count from web: " + clientsLen);
    if (clientsLen != 0) {
      for (String client : clients) {
        System.out.println("get client from web: " + client);

        // change projectName in client.config
        sc.modifyConfigFile(client, clientConfig, PROJECT_NAME, projectName);
        sc.modifyConfigFile(client, clientConfig, MONITOR_PROCESS, stressName);
        sc.modifyConfigFile(client, clientConfig, MONITOR_LOG, stressLog);
      }
    } else {
      System.err.println("get no client!!!");
      return;
    }

    // start servers
    System.out.println("start servers......");
    String startServerRet = (String) (sc.executeCmd(serverIp, startServerCmd, String.class));
    System.out.println(startServerRet);

    sc.waitto(15);

    // start stress
    System.out.println("start stress......");
    for (String client : clients) {
      System.out.println("start stress on " + client + "......");
      String startStressRet = (String) (sc.executeCmd(client, startStressCmd, String.class));
      System.out.println("result: " + startStressRet);
    }
    sc.waitto(15);

    // start clients
    for (String client : clients) {
      System.out.println("start client on " + client + "......");
      sc.executeCmd(client, startClientCmd);
    }

    // redirect to index.jsp
    request.getRequestDispatcher("/index.jsp").forward(request, response);

    runFlag = false;

    // String cmd = "cd /home/admin/ashu/ycsb && ./run.sh workload put @";\

    // if (ret1 != null && ret2 != null && ret3 != null) {
    // out.println("get host by staf: " + ret1);
    // out.println("<br>");
    // out.println("get host by staf: " + ret2);
    // out.println("<br>");
    // out.println("get host by staf: " + ret3);
    // out.println("<br>");
    // }

    // out.close();

    // Enumeration paramNames = request.getParameterNames();
    // while (paramNames.hasMoreElements()) {
    // String paramName = (String) paramNames.nextElement();
    // out.print("<TR><TD>" + paramName + "<TD>");
    // out.println("<BR>");//print new line
    // String[] paramValues = request.getParameterValues(paramName);
    // if (paramValues.length == 1) {
    // String paramValue = paramValues[0];
    // if (paramValue.length() == 0)
    // out.println("<I>No Value</I>");
    // else
    // out.println(paramValue);
    // } else {
    // out.println("<UL>");
    // for (int i = 0; i < paramValues.length; i++) {
    // out.println("<LI>" + paramValues[i]);
    // }
    // out.println("</UL>");
    // }
    // }
  }
Exemplo n.º 18
0
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    System.out.println("AddProjectServlet.doPost Entered...");

    init(response);
    PrintWriter out = response.getWriter();
    dataSource = (DataSource) request.getSession().getServletContext().getAttribute("DBCPool");
    baseurl = config.getServletContext().getInitParameter("baseurl"); // filesystem web-root
    parameterDAO.setDataSource(dataSource);
    pb.setParameterDAO(parameterDAO);
    filter.setParameterDAO(parameterDAO);

    System.out.println("AddProjectServlet.doPost done inits pb.set, filter.set...");

    if (ParameterDAO.parse(request.getParameter("clearmsgs"))) {
      msg = new StringBuffer();
    }

    String[] deleted = request.getParameterValues("delete");
    String addnew = request.getParameter("addnew");
    String updated = request.getParameter("updated");
    String undelete = request.getParameter("undelete");
    String searchbyx = request.getParameter("searchbyx");

    filter.setSearchString(StringUtils.trimToEmpty(request.getParameter("search")));
    String sortby = StringUtils.trimToEmpty(request.getParameter("sortby"));

    String order = "DESC";
    if (!ParameterDAO.parse(request.getParameter("order"))) order = "ASC";

    // if coming from addContacts, success or failure...
    if (ParameterDAO.parse(request.getAttribute("addcontacts"))
        || ParameterDAO.parse(request.getAttribute("addagencies"))
        || ParameterDAO.parse(request.getAttribute("uploadedfile"))) {
      msg.append(StringUtils.trimToEmpty((String) request.getAttribute("msg")));
    } else if (StringUtils.isNotBlank(filter.getSearchString())) {
      // triggers the simple search exclusive of any other action (safe from delete, by preceding in
      // if-then )
      // do absolutely nothing the search field will be populated just fine as expected.  Later, may
      // be add X number of projects
    } else if (deleted == null) {
      // System.out.println("AddProjectServlet.doPost Entered else if deleted == null");

      // coming from index.jsp
      if (ParameterDAO.parse(updated)) {
        addProject(request, response, true);
      } else if (ParameterDAO.parse(undelete)) {
        parameterDAO.unDeleteAllProjects();
      } else if (ParameterDAO.parse(addnew)) {
        addProject(request, response, false);
      } else if (ParameterDAO.parse(searchbyx)) {
        // we are just setting filter
        setProjectBean(request);
        filter = pb;
        System.out.println("Filter STARTS LIFE as = " + filter.toFilterString());
        // System.out.println("Filter Training INIT parsed as = " +
        // ParameterDAO.parse(filter.getTraining()));
        // System.out.println("Filter Capability Area(s) INIT as = " + filter.getCapabilityAreas());

        msg.append("Advanced Search Parameters = ");
        msg.append(
            "<div style=\"font-family: 'trebuchet ms', sans-serif;  font-size: 9px; font-style: italic; text-transform: lowercase; display: inline; \">");
        msg.append(filter.toFilterString());
        msg.append("</div><br />");
      }
    } else if (deleted.length == 0) {
      // came from projects list but nothing to do...later when table cells are editable, we may @TO
      // DO capture all edits/updates here
    } else {
      parameterDAO.deleteProject(deleted);
      int count = 0;
      for (int i = 0; i < deleted.length; i++) {
        count++;

        if (count == 1) {
          msg.append("Project(s) <strong><span style=\"background-color: #FFFF00\">");
        } else {
          msg.append(",&nbsp;<strong><span style=\"background-color: #FFFF00\">");
        }
        msg.append(
            StringEscapeUtils.escapeHtml(
                parameterDAO.getJustOneProject(deleted[i]).getProjectname()));
        msg.append("</span></strong>");
      }
      if (count > 0) msg.append(" D E L E T E D<BR />");
    }

    /////////////////////////////////////////////
    //  Draw the projects list table
    //
    out.println(getHeader());
    out.println(getMessageTable(msg));
    // System.out.println("AddProjectServlet.doPost drawing projects table " + filter.toString());

    if (StringUtils.isBlank(sortby)) {
      out.println(getProjectsListHTML());
    } else if (StringUtils.equalsIgnoreCase(sortby, "code")) {
      out.println(getProjectsListHTML("code", order));
    } else if (StringUtils.equalsIgnoreCase(sortby, "name")) {
      out.println(getProjectsListHTML("nametitle", order));
    } else if (StringUtils.equalsIgnoreCase(sortby, "description")) {
      out.println(getProjectsListHTML("description", order));
    } else if (StringUtils.equalsIgnoreCase(sortby, "status")) {
      out.println(getProjectsListHTML("status", order));
    } else {
      out.println(getProjectsListHTML());
    }

    out.println(getFooter());
    filter = new ProjectBean();
    // System.out.println("AddProjectServlet.doPost DONE");

  }
Exemplo n.º 19
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {

      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();

      nseer_db_backup1 security_db = new nseer_db_backup1(dbApplication);
      if (security_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        getRecordCount query = new getRecordCount();

        String tablename = request.getParameter("tablename");
        String[] cols = request.getParameterValues("col");

        if (cols == null) {

          response.sendRedirect("hr/config/key/key_register_ok_a.jsp");

        } else {
          String column_group = "";
          for (int i = 0; i < cols.length; i++) {
            column_group += cols[i] + ",";
          }
          column_group = column_group.substring(0, column_group.length() - 1);
          String sql1 =
              "select * from security_publicconfig_key where tablename='" + tablename + "'";
          ResultSet rs = security_db.executeQuery(sql1);
          if (rs.next()) {
            String sql =
                "update security_publicconfig_key set column_group='"
                    + column_group
                    + "' where tablename='"
                    + tablename
                    + "'";
            security_db.executeUpdate(sql);
          } else {
            String sql =
                "insert into security_publicconfig_key(tablename,column_group) values('"
                    + tablename
                    + "','"
                    + column_group
                    + "')";
            security_db.executeUpdate(sql);
          }

          response.sendRedirect("hr/config/key/key_register_ok_b.jsp");
        }
        security_db.commit();
        security_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
    }
  }
Exemplo n.º 20
0
  /**
   * Show details about the request
   *
   * @param servlet used to get teh servlet context, may be null
   * @param req the request
   * @return string showing the details of the request.
   */
  public static String showRequestDetail(HttpServlet servlet, HttpServletRequest req) {
    StringBuilder sbuff = new StringBuilder();

    sbuff.append("Request Info\n");
    sbuff.append(" req.getServerName(): ").append(req.getServerName()).append("\n");
    sbuff.append(" req.getServerPort(): ").append(req.getServerPort()).append("\n");
    sbuff.append(" req.getContextPath:").append(req.getContextPath()).append("\n");
    sbuff.append(" req.getServletPath:").append(req.getServletPath()).append("\n");
    sbuff.append(" req.getPathInfo:").append(req.getPathInfo()).append("\n");
    sbuff.append(" req.getQueryString:").append(req.getQueryString()).append("\n");
    sbuff
        .append(" getQueryStringDecoded:")
        .append(EscapeStrings.urlDecode(req.getQueryString()))
        .append("\n");
    /*try {
      sbuff.append(" getQueryStringDecoded:").append(URLDecoder.decode(req.getQueryString(), "UTF-8")).append("\n");
    } catch (UnsupportedEncodingException e1) {
      e1.printStackTrace();
    }*/
    sbuff.append(" req.getRequestURI:").append(req.getRequestURI()).append("\n");
    sbuff.append(" getRequestBase:").append(getRequestBase(req)).append("\n");
    sbuff.append(" getRequestServer:").append(getRequestServer(req)).append("\n");
    sbuff.append(" getRequest:").append(getRequest(req)).append("\n");
    sbuff.append("\n");

    sbuff.append(" req.getPathTranslated:").append(req.getPathTranslated()).append("\n");
    String path = req.getPathTranslated();
    if ((path != null) && (servlet != null)) {
      ServletContext context = servlet.getServletContext();
      sbuff.append(" getMimeType:").append(context.getMimeType(path)).append("\n");
    }
    sbuff.append("\n");
    sbuff.append(" req.getScheme:").append(req.getScheme()).append("\n");
    sbuff.append(" req.getProtocol:").append(req.getProtocol()).append("\n");
    sbuff.append(" req.getMethod:").append(req.getMethod()).append("\n");
    sbuff.append("\n");
    sbuff.append(" req.getContentType:").append(req.getContentType()).append("\n");
    sbuff.append(" req.getContentLength:").append(req.getContentLength()).append("\n");

    sbuff.append(" req.getRemoteAddr():").append(req.getRemoteAddr());
    try {
      sbuff
          .append(" getRemoteHost():")
          .append(java.net.InetAddress.getByName(req.getRemoteHost()).getHostName())
          .append("\n");
    } catch (java.net.UnknownHostException e) {
      sbuff.append(" getRemoteHost():").append(e.getMessage()).append("\n");
    }
    sbuff.append(" getRemoteUser():").append(req.getRemoteUser()).append("\n");

    sbuff.append("\n");
    sbuff.append("Request Parameters:\n");
    Enumeration params = req.getParameterNames();
    while (params.hasMoreElements()) {
      String name = (String) params.nextElement();
      String values[] = req.getParameterValues(name);
      if (values != null) {
        for (int i = 0; i < values.length; i++) {
          sbuff
              .append("  ")
              .append(name)
              .append("  (")
              .append(i)
              .append("): ")
              .append(values[i])
              .append("\n");
        }
      }
    }
    sbuff.append("\n");

    sbuff.append("Request Headers:\n");
    Enumeration names = req.getHeaderNames();
    while (names.hasMoreElements()) {
      String name = (String) names.nextElement();
      Enumeration values = req.getHeaders(name); // support multiple values
      if (values != null) {
        while (values.hasMoreElements()) {
          String value = (String) values.nextElement();
          sbuff.append("  ").append(name).append(": ").append(value).append("\n");
        }
      }
    }
    sbuff.append(" ------------------\n");

    return sbuff.toString();
  }