コード例 #1
1
  public String buildInterfaceTable(String rule, String[] serviceList) throws FilterParseException {
    StringBuffer buffer = new StringBuffer();
    Filter filter = new Filter();
    Map interfaces = filter.getIPServiceMap(rule);

    Iterator i = interfaces.keySet().iterator();
    while (i.hasNext()) {
      String key = (String) i.next();
      buffer.append("<tr><td valign=\"top\">").append(key).append("</td>");
      buffer.append("<td>");

      if (serviceList != null && serviceList.length != 0) {
        Map services = (Map) interfaces.get(key);
        Iterator j = services.keySet().iterator();
        while (j.hasNext()) {
          String svc = (String) j.next();
          for (int idx = 0; idx < serviceList.length; idx++) {
            if (svc.equals(serviceList[idx])) {
              buffer.append(svc).append("<br>");
            }
          }
        }
      } else {
        buffer.append("All services");
      }
      buffer.append("</td>");

      buffer.append("</tr>");
    }

    return buffer.toString();
  }
コード例 #2
0
ファイル: BshServlet.java プロジェクト: harry159821/sl4a
  /*
  	Show context number lines of string before and after target line.
  	Add HTML formatting to bold the target line.
  */
  String showScriptContextHTML(String s, int lineNo, int context) {
    StringBuffer sb = new StringBuffer();
    BufferedReader br = new BufferedReader(new StringReader(s));

    int beginLine = Math.max(1, lineNo - context);
    int endLine = lineNo + context;
    for (int i = 1; i <= lineNo + context + 1; i++) {
      if (i < beginLine) {
        try {
          br.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e.toString());
        }
        continue;
      }
      if (i > endLine) break;

      String line;
      try {
        line = br.readLine();
      } catch (IOException e) {
        throw new RuntimeException(e.toString());
      }

      if (line == null) break;
      if (i == lineNo) sb.append("<font color=\"red\">" + i + ": " + line + "</font><br/>");
      else sb.append(i + ": " + line + "<br/>");
    }

    return sb.toString();
  }
コード例 #3
0
 /** Converts a space delimitered string to a list of strings */
 private static String[] getStringList(String str) {
   if (str == null) return null;
   ArrayList list = new ArrayList();
   int i = 0;
   int length = str.length();
   StringBuffer sb = null;
   while (i < length) {
     char ch = str.charAt(i);
     if (ch == ' ') {
       // A space was hit. Add string to list
       if (sb != null) {
         list.add(sb.toString());
         sb = null;
       }
     } else if (ch == '\\') {
       // It is a delimiter. Add next character
       if (i + 1 < length) {
         ch = str.charAt(++i);
         if (sb == null) sb = new StringBuffer();
         sb.append(ch);
       }
     } else {
       if (sb == null) sb = new StringBuffer();
       sb.append(ch);
     }
     i++; // Next character
   }
   // Make sure to add the last part to the list too
   if (sb != null) {
     list.add(sb.toString());
   }
   if (list.size() == 0) return null;
   String[] results = new String[list.size()];
   return (String[]) list.toArray(results);
 }
コード例 #4
0
ファイル: index_jsp.java プロジェクト: h4ck3rm1k3/Infinit.e
  // createPageString -
  // Create list of pages for search results
  private String createPageString(
      int numberOfItems, int itemsPerPage, int currentPage, String baseUrl) {
    StringBuffer pageString = new StringBuffer();

    // Calculate the total number of pages
    int totalPages = 1;
    if (numberOfItems > itemsPerPage) {
      double pages = Math.ceil(numberOfItems / (double) itemsPerPage);
      totalPages = (int) Math.ceil(pages);
    }

    //
    if (totalPages > 1) {
      for (int i = 1; i <= totalPages; i++) {
        if (i == currentPage) {
          pageString.append(i);
        } else {
          pageString.append("<a href=\"" + baseUrl + i + "\" title=\"" + i + "\">" + i + "</a>");
        }

        if (i != totalPages) pageString.append(" ");
      }
    } else {
      pageString.append("1");
    }

    return pageString.toString();
  }
コード例 #5
0
ファイル: CDCClientServlet.java プロジェクト: aldaris/opensso
 // Get cookies string from HTTP request object
 private String getCookiesFromRequest(HttpServletRequest request) {
   Cookie cookies[] = CookieUtils.getCookieArrayFromReq(request);
   // above call would return pure sid in iPlanetDirectoryPro cookie
   // independent of container encoding
   StringBuffer cookieStr = null;
   String strCookies = null;
   if (cookies != null) {
     for (int nCookie = 0; nCookie < cookies.length; nCookie++) {
       String cookieName = cookies[nCookie].getName();
       String cookieVal = cookies[nCookie].getValue();
       if (debug.messageEnabled()) {
         debug.message("CDCClientServlet.getCookiesFromRequest:" + "Cookie name = " + cookieName);
         debug.message("CDCClientServlet.getCookiesFromRequest:" + "Cookie val= " + cookieVal);
       }
       if (cookieStr == null) {
         cookieStr = new StringBuffer();
       } else {
         cookieStr.append(";");
       }
       cookieStr.append(cookieName).append(EQUAL_TO).append(cookieVal);
     }
   }
   if (cookieStr != null) {
     strCookies = cookieStr.toString();
   }
   return strCookies;
 }
コード例 #6
0
 public static String filter(String input) {
   if (!hasSpecialChars(input)) {
     return (input);
   }
   StringBuffer filtered = new StringBuffer(input.length());
   char c;
   for (int i = 0; i < input.length(); i++) {
     c = input.charAt(i);
     switch (c) {
       case '<':
         filtered.append("&lt;");
         break;
       case '>':
         filtered.append("&gt;");
         break;
       case '"':
         filtered.append("&quot;");
         break;
       case '&':
         filtered.append("&amp;");
         break;
       default:
         filtered.append(c);
     }
   }
   return (filtered.toString());
 }
コード例 #7
0
  /** Return a String representation of this object. */
  public String toString() {

    if (filterConfig == null) return ("KeepSession()");
    StringBuffer sb = new StringBuffer("KeepSession(");
    sb.append(filterConfig);
    sb.append(")");
    return (sb.toString());
  }
コード例 #8
0
 private String getExternalLink(final String url, final String label, final String css) {
   StringBuffer link = new StringBuffer();
   link.append("<a href=\"" + url + "\" ");
   if (css != null) {
     link.append("class=\"" + css + "\" ");
   }
   link.append(">");
   link.append(label);
   link.append("</a>");
   return link.toString();
 }
コード例 #9
0
 private String getAttributeList(Enumeration attributes) {
   StringBuffer list = new StringBuffer("  <UL>\n");
   if (!attributes.hasMoreElements()) {
     list.append("    <LI>No attributes found.");
   } else {
     while (attributes.hasMoreElements()) {
       list.append("    <LI>");
       list.append(attributes.nextElement());
       list.append("\n");
     }
   }
   list.append("  </UL>");
   return (list.toString());
 }
コード例 #10
0
ファイル: kbSRU.java プロジェクト: STITCHplus/kbSRU
 public StringBuffer construct_lucene_solr(StringBuffer result, SolrDocument d) {
   for (String field : (d.getFieldNames())) {
     if ((!field.endsWith("_str")) && (!field.equalsIgnoreCase("fullrecord"))) {
       Iterator j = d.getFieldValues(field).iterator();
       while (j.hasNext()) {
         result.append("<" + field + ">");
         result.append(helpers.xmlEncode((String) j.next().toString()));
         field = field.split(" ")[0];
         result.append("</" + field + ">");
       }
     }
   }
   return (result);
 }
コード例 #11
0
ファイル: log_jsp.java プロジェクト: bangarharshit/openfire
 private static String hilite(String input) {
   if (input == null || "".equals(input)) {
     return input;
   }
   if (input.indexOf("org.jivesoftware.") > -1) {
     StringBuffer buf = new StringBuffer();
     buf.append("<span class=\"hilite\">").append(input).append("</span>");
     return buf.toString();
   } else if (input.trim().startsWith("---") && input.trim().endsWith("---")) {
     StringBuffer buf = new StringBuffer();
     buf.append("<span class=\"hilite-marker\">").append(input).append("</span>");
     return buf.toString();
   }
   return input;
 }
コード例 #12
0
ファイル: BshServlet.java プロジェクト: harry159821/sl4a
  /** Convert special characters to entities for XML output */
  public static String escape(String value) {
    String search = "&<>";
    String[] replace = {"&amp;", "&lt;", "&gt;"};

    StringBuffer buf = new StringBuffer();

    for (int i = 0; i < value.length(); i++) {
      char c = value.charAt(i);
      int pos = search.indexOf(c);
      if (pos < 0) buf.append(c);
      else buf.append(replace[pos]);
    }

    return buf.toString();
  }
コード例 #13
0
 private String getShortcutScript(HashMap<String, String> usedButtonShortCuts) {
   StringBuffer shortcuts = new StringBuffer();
   shortcuts.append(" function buttonListShorcuts() {\n");
   Iterator<String> ik = usedButtonShortCuts.keySet().iterator();
   Iterator<String> iv = usedButtonShortCuts.values().iterator();
   while (ik.hasNext() && iv.hasNext()) {
     shortcuts
         .append("  keyArray[keyArray.length] = new keyArrayItem(\"")
         .append(ik.next())
         .append("\", \"")
         .append(iv.next())
         .append("\", null, \"altKey\", false, \"onkeydown\");\n");
   }
   shortcuts.append(" return true;\n}");
   return shortcuts.toString();
 }
コード例 #14
0
ファイル: CDCClientServlet.java プロジェクト: aldaris/opensso
 /**
  * Gathers the parameters in the request as a HTTP URL string. to form <code>requestParams</code>
  * String. It collects all the parameters from the original request except the original goto url
  * and any advice parameters. Note: All the paramters will be url decoded by default., we should
  * make sure that these values are encoded again It also putsthe advice params in a separate
  * <code>policyAdviceList</code> String.
  *
  * @param request an HttpServletRequest object that contains the request the client has made of
  *     the servlet.
  */
 private void parseRequestParams(HttpServletRequest request) {
   StringBuffer adviceList = null;
   StringBuffer parameterString = new StringBuffer(100);
   for (Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) {
     String paramName = (String) e.nextElement();
     if (adviceParams.contains(paramName.toLowerCase())) {
       if (adviceList == null) {
         adviceList = new StringBuffer();
       } else {
         adviceList.append(AMPERSAND);
       }
       String[] values = request.getParameterValues(paramName);
       for (int i = 0; values != null && i < values.length; i++) {
         adviceList.append(paramName).append(EQUAL_TO).append(values[i]);
       }
     } else {
       if (!paramName.equals(GOTO_PARAMETER)) {
         String[] values = request.getParameterValues(paramName);
         for (int i = 0; values != null && i < values.length; i++) {
           parameterString
               .append(AMPERSAND)
               .append(paramName)
               .append(EQUAL_TO)
               .append(URLEncDec.encode(values[i]));
         }
       }
     }
   }
   if (debug.messageEnabled()) {
     debug.message("CDCClientServlet.parseRequestParams:" + "Advice List is = " + adviceList);
     debug.message(
         "CDCClientServlet.parseRequestParams:"
             + "Parameter String is = "
             + parameterString.toString());
   }
   if (adviceList == null) {
     policyAdviceList = null;
   } else {
     policyAdviceList = adviceList.toString();
   }
   if (parameterString.length() > 0) {
     requestParams = (parameterString.deleteCharAt(0).toString());
   } else {
     requestParams = parameterString.toString();
   }
 }
コード例 #15
0
ファイル: AddProjectServlet.java プロジェクト: ideaesb/paws
  private String getMessageTable(StringBuffer msg) {
    StringBuffer sb = new StringBuffer();

    if (msg.length() > 0) {
      // sb.append("<a href=\"javascript:clearmsgs()\">Clear Messages</a>");
      sb.append("<table class=\"msgbox\">");
      // sb.append("<tr><th>");
      // sb.append("<input type=\"submit\" value=\"Clear Messages\"
      // onclick=\"clearmsgs()\"></input>");
      // sb.append("</th></tr>");
      sb.append("<tr><td>");
      sb.append(msg.toString());
      sb.append("</td></tr>");
      sb.append("</table>");
    }
    return sb.toString();
  }
コード例 #16
0
  private String getLink(
      final String event,
      final String label,
      final String css,
      String defaultValue,
      String selectedValue,
      String tooltip) {
    String status = Utilities.escapeHTML(Utilities.filterOutHTMLTags(tooltip));

    StringBuffer link = new StringBuffer();
    defaultValue = defaultValue == null ? AbstractChip.FALSE : defaultValue;
    selectedValue = selectedValue == null ? AbstractChip.TRUE : selectedValue;
    link.append("<input type=\"hidden\" name=\"" + event + "\" value=\"" + defaultValue + "\" />");
    link.append(
        "<a href=\"#\" onMouseover=\"window.status='"
            + status
            + "'; return true;\" onMouseout=\"window.status=''; return true;\" ");
    if (css != null) {
      link.append("class=\"" + css + "\" ");
    }
    link.append("hidefocus=\"true\" ");
    link.append(
        "onclick=\"document.editorForm.elements['"
            + event
            + "'].value='"
            + selectedValue
            + "';setScrollAndSubmit();return false;\">");
    link.append(label);
    link.append("</a>");
    return link.toString();
  }
コード例 #17
0
ファイル: JspLoader.java プロジェクト: pedroigorsilva/is
  public String getClassPath() {
    StringBuffer cpath = new StringBuffer();
    String sep = System.getProperty("path.separator");

    for (int i = 0; i < jars.size(); i++) {
      cpath.append((String) jars.elementAt(i) + sep);
    }

    return cpath.toString();
  }
コード例 #18
0
ファイル: indexControleur.java プロジェクト: abdocmd/clinique
 private String cryptPassword(String pass) {
   byte[] uniqueKey = pass.getBytes();
   byte[] hash = null;
   try {
     hash = MessageDigest.getInstance("MD5").digest(uniqueKey);
   } catch (Exception e) { // Il ne doit jamais avoir d'erreurs ici
     e.printStackTrace();
   }
   StringBuffer hashString = new StringBuffer();
   for (int i = 0; i < hash.length; ++i) {
     String hex = Integer.toHexString(hash[i]);
     if (hex.length() == 1) {
       hashString.append('0');
       hashString.append(hex.charAt(hex.length() - 1));
     } else {
       hashString.append(hex.substring(hex.length() - 2));
     }
   }
   return hashString.toString();
 }
コード例 #19
0
ファイル: AddProjectServlet.java プロジェクト: ideaesb/paws
  private void addProject(
      HttpServletRequest request, HttpServletResponse response, boolean updateFlag)
      throws ServletException, IOException {
    // First order of business is to capture the form parameters into the project bean
    setProjectBean(request);
    // execute the insert
    String id = request.getParameter("id");
    try {
      if (updateFlag) parameterDAO.deleteProject(id);
      project = pb.insert();
    } catch (Exception e) {
      msg.append("A B O R T.  The following database error has occured:<br />");
      msg.append(
          "<strong><span style=\"background-color: #FFFF00\">" + e + "</span></strong><br />");
    } finally {
      if (project > 0) {
        // success
        msg.append(
            "Project <strong><span style=\"background-color: #FFFF00\">" + pb.getProjectname());
        if (updateFlag) {
          msg.append("</span></strong> was U P D A T E D <br />");
        } else {
          msg.append("</span></strong> was I N S E R T E D<br />");
        }

      } else {
        msg.append(
            "F A I L E D to Insert/Update Project "
                + pb.getProjectname()
                + " into database!!!!!!!!!!!<br />");
      }
    }
  }
コード例 #20
0
  public String buildServiceOptions(String rule) throws SQLException {
    List services = NotificationFactory.getInstance().getServiceNames();
    Collections.sort(
        services,
        new Comparator() {
          public int compare(Object o1, Object o2) {
            return ((String) o1).compareToIgnoreCase((String) o2);
          }
        });
    StringBuffer buffer = new StringBuffer();

    for (int i = 0; i < services.size(); i++) {
      if (rule != null && rule.indexOf((String) services.get(i)) > 0) {
        buffer.append(
            "<option selected VALUE='" + services.get(i) + "'>" + services.get(i) + "</option>");
      } else {
        buffer.append("<option VALUE='" + services.get(i) + "'>" + services.get(i) + "</option>");
      }
    }

    return buffer.toString();
  }
コード例 #21
0
ファイル: log_jsp.java プロジェクト: bangarharshit/openfire
 private static String parseDate(String input) {
   if (input == null || "".equals(input)) {
     return input;
   }
   if (input.length() < 19) {
     return input;
   }
   String d = input.substring(0, 19);
   // try to parse it
   try {
     StringBuffer buf = new StringBuffer(input.length());
     synchronized (formatter) {
       Date date = formatter.parse(d);
       buf.append("<span class=\"date\" title=\"").append(formatter.format(date)).append("\">");
     }
     buf.append(d).append("</span>");
     buf.append(input.substring(19, input.length()));
     return buf.toString();
   } catch (ParseException pe) {
     return input;
   }
 }
コード例 #22
0
  public String buildPathSelect(String currentPath) throws ServletException {
    StringBuffer buffer = new StringBuffer("<select NAME=\"path\">");

    Map pathsMap = null;

    try {
      pathsMap = new TreeMap(DestinationPathFactory.getInstance().getPaths());
      Iterator iterator = pathsMap.keySet().iterator();
      while (iterator.hasNext()) {
        String key = (String) iterator.next();
        if (key.equals(currentPath)) {
          buffer.append("<option SELECTED VALUE=" + key + ">" + key + "</option>");
        } else {
          buffer.append("<option VALUE=" + key + ">" + key + "</option>");
        }
      }
    } catch (Exception e) {
      throw new ServletException("couldn't get destination path list.", e);
    }
    buffer.append("</select>");

    return buffer.toString();
  }
コード例 #23
0
  public String buildEventSelect(Notification notice) throws IOException, FileNotFoundException {
    // The list of events needs to be transposed to (label, uei) in
    // order to sort it by label for display.
    List eventVendors =
        EventConfigurationManager.getEventsByVendor(NotificationWizardServlet.WT_VENDOR_NAME);
    StringBuffer buffer = new StringBuffer();
    SortedMap sortedEvents = (SortedMap) new TreeMap();

    List excludeList = NotificationWizardServlet.getExcludeList();

    for (Iterator iter = eventVendors.iterator(); iter.hasNext(); ) {
      com.jjlabs.model.EventVendor e = (com.jjlabs.model.EventVendor) iter.next();
      sortedEvents.put(e.getLabel(), e);
    }

    Iterator j = sortedEvents.keySet().iterator();

    while (j.hasNext()) {
      String label = (String) j.next();
      com.jjlabs.model.EventVendor e = (com.jjlabs.model.EventVendor) sortedEvents.get(label);
      String uei = e.getUei();
      String trimmedUei = NotificationWizardServlet.stripUei(uei);

      if (!excludeList.contains(trimmedUei)) {
        boolean foundUei = NotificationWizardServlet.isEventInNotification(notice, e);
        int id = e.getId();

        if (foundUei) {
          buffer.append("<option selected VALUE=\"" + id + "\">" + label + "</option>");
        } else {
          buffer.append("<option value=\"" + id + "\">" + label + "</option>");
        }
      }
    }

    return buffer.toString();
  }
コード例 #24
0
ファイル: kbSRU.java プロジェクト: STITCHplus/kbSRU
 public StringBuffer construct_lucene_dc(StringBuffer result, SolrDocument d) {
   for (String field : (d.getFieldNames())) {
     StringTokenizer dcfields = new StringTokenizer(this.config.getProperty("dcfields", ","));
     while (dcfields.hasMoreTokens()) {
       String dcfield = dcfields.nextToken().trim().replaceAll(",", "");
       if (field.equalsIgnoreCase(dcfield)) {
         Iterator j = d.getFieldValues(field).iterator();
         String rename = this.config.getProperty("solr." + field);
         if (rename != null) {
           field = rename;
         } else {
           field = "dc:" + field;
         }
         while (j.hasNext()) {
           result.append("<" + field + ">");
           result.append(helpers.xmlEncode((String) j.next()));
           field = field.split(" ")[0];
           result.append("</" + field + ">");
         }
       }
     }
   }
   return (result);
 }
コード例 #25
0
ファイル: WeatherSearch.java プロジェクト: halkurum/Projects
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {

    PrintWriter out = response.getWriter();
    String location = URLDecoder.decode(request.getParameter("location"));
    String type = URLDecoder.decode(request.getParameter("type"));
    String unit = URLDecoder.decode(request.getParameter("unit"));
    String awsURL =
        "http://default-environment-ii9naedwp8.elasticbeanstalk.com/?location="
            + URLEncoder.encode(location)
            + "&type="
            + type
            + "&unit="
            + unit;
    // out.write(awsURL);
    String myurl = URLEncoder.encode(awsURL);
    // out.write("\n"+myurl);
    URL url = new URL(awsURL);
    URLConnection urlConnection = url.openConnection();

    InputStream awsResponse = urlConnection.getInputStream();
    InputStreamReader iSReader = new InputStreamReader(awsResponse);
    StringBuffer sb = new StringBuffer();
    String xmlLine;
    BufferedReader buf = new BufferedReader(iSReader);
    try {
      while ((xmlLine = buf.readLine()) != null) {
        sb.append(xmlLine);
      }
    } catch (IOException ex) {
      ex.printStackTrace();
    }
    xmlLine = sb.toString();

    response.setContentType("application/json; charset=UTF-8");
    int indent = 6;
    try {
      JSONObject jsonObj = XML.toJSONObject(xmlLine);
      String json1 = jsonObj.toString(indent);
      out.write(json1);
    } catch (JSONException ex) {
      ex.printStackTrace();
    }
  }
コード例 #26
0
ファイル: C3P0StatusServlet.java プロジェクト: xyzpool/c3p0
    public Element reportDtElem() {
      StringBuffer sb = new StringBuffer(255);
      sb.append(shortTypeName);
      sb.append(" [ dataSourceName: ");
      sb.append(pds.getDataSourceName());
      sb.append("; identityToken: ");
      sb.append(pds.getIdentityToken());
      sb.append(" ]");

      Element dtElem = doc.createElement("dt");
      dtElem.appendChild(doc.createTextNode(sb.toString()));
      return dtElem;
    }
コード例 #27
0
ファイル: HtmlComponent.java プロジェクト: juanmadryn/web-db
  /**
   * This method generates a URL for a dynamically generated image created by the component. The
   * method is called by the framework and should not be called directly.
   */
  protected String generateImageURL() {
    HtmlPage p = getPage();

    StringBuffer buf =
        new StringBuffer(
            com.salmonllc.util.URLGenerator.generateObjectstoreURL(
                p.getCurrentRequest(), getPage().getApplicationName()));
    buf.append("/");

    if (p instanceof com.salmonllc.jsp.JspController) {
      buf.append("JSP/");
      buf.append(((com.salmonllc.jsp.JspController) p).getSessionKey());
    } else {
      buf.append(p.getOrigApplicationName());
      buf.append("/");
      buf.append(p.getPageName());
    }

    buf.append("/");
    buf.append(getFullName());
    buf.append("/");

    return buf.toString();
  }
コード例 #28
0
ファイル: BshServlet.java プロジェクト: harry159821/sl4a
  Object evalScript(
      String script,
      StringBuffer scriptOutput,
      boolean captureOutErr,
      HttpServletRequest request,
      HttpServletResponse response)
      throws EvalError {
    // Create a PrintStream to capture output
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream pout = new PrintStream(baos);

    // Create an interpreter instance with a null inputstream,
    // the capture out/err stream, non-interactive
    Interpreter bsh = new Interpreter(null, pout, pout, false);

    // set up interpreter
    bsh.set("bsh.httpServletRequest", request);
    bsh.set("bsh.httpServletResponse", response);

    // Eval the text, gathering the return value or any error.
    Object result = null;
    String error = null;
    PrintStream sout = System.out;
    PrintStream serr = System.err;
    if (captureOutErr) {
      System.setOut(pout);
      System.setErr(pout);
    }
    try {
      // Eval the user text
      result = bsh.eval(script);
    } finally {
      if (captureOutErr) {
        System.setOut(sout);
        System.setErr(serr);
      }
    }
    pout.flush();
    scriptOutput.append(baos.toString());
    return result;
  }
コード例 #29
0
ファイル: doSMS.java プロジェクト: keithfkelly/Safdesk
  public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {

    String smsFrom = request.getParameter("From");
    String smsBody = request.getParameter("Body");
    String desc = null;
    String data = null;
    StringBuffer smsBuffer = new StringBuffer();
    smsBuffer.append(smsBody);
    for (int i = 0; i < smsBuffer.length(); i++) {
      if (smsBuffer.charAt(i) == '.') {
        desc = smsBuffer.substring(0, i);
        data = smsBuffer.substring(i);
      }
    }
    String x = "CALL smsInsert('" + smsFrom + "','" + desc + "','" + data + "')";
    new DB();
    try {
      DB.doU(x);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #30
0
 private InputStream getReport(
     HttpServletRequest request,
     HttpServletResponse response,
     Tab tab,
     TableModel tableModel,
     Integer columnCountLimit)
     throws ServletException, IOException {
   StringBuffer suri = new StringBuffer();
   suri.append("/xava/jasperReport");
   suri.append("?language=");
   suri.append(Locales.getCurrent().getLanguage());
   suri.append("&widths=");
   suri.append(Arrays.toString(getWidths(tableModel)));
   if (columnCountLimit != null) {
     suri.append("&columnCountLimit=");
     suri.append(columnCountLimit);
   }
   response.setCharacterEncoding(XSystem.getEncoding());
   return Servlets.getURIAsStream(request, response, suri.toString());
 }