예제 #1
0
  /**
   * The servlet method that responds to an HTTP GET. This method returns a summary page containing
   * information on the pipeline or stage specified by the p and s query parameters.
   *
   * @param req The HttpServletRequest provided by the servlet container.
   * @param res The HttpServletResponse provided by the servlet container.
   */
  public void doGet(HttpRequest req, HttpResponse res) {
    super.loadParameters(req);

    // Get the parameters.
    int x = StringUtil.getInt(req.getParameter("plugin"), -1);

    // Return the page
    res.write(getPage(p, s, x));
    res.setContentType("html");
    res.disableCaching();
    res.send();
  }
예제 #2
0
파일: Query.java 프로젝트: johnperry/MIRC2
  /**
   * Construct a Query from an XML document in the form described on the RSNA MIRC wiki.
   *
   * @param queryDoc the MIRCquery XML DOM object.
   */
  public Query(Document queryDoc) {
    super();
    Element root = queryDoc.getDocumentElement();
    unknown = root.getAttribute("unknown").trim().equals("yes");
    bgcolor = root.getAttribute("bgcolor").trim();
    display = root.getAttribute("display").trim();
    icons = root.getAttribute("icons").trim();
    orderby = root.getAttribute("orderby").trim();
    firstresult = StringUtil.getInt(root.getAttribute("firstresult"));
    if (firstresult <= 0) firstresult = 1;
    maxresults = StringUtil.getInt(root.getAttribute("maxresults"));
    if (maxresults <= 0) maxresults = 1;

    StringBuffer sb = new StringBuffer();
    Node child = root.getFirstChild();
    while (child != null) {
      if (child.getNodeType() == Node.ELEMENT_NODE) {
        String dbname = child.getNodeName();
        String text = getTextContent(child);
        if (!text.equals("")) {
          this.put(dbname, text);
          containsNonFreetextQueries = true;
        }
        if (dbname.equals("temp")) isTempQuery = true;
      } else if (child.getNodeType() == Node.TEXT_NODE) {
        sb.append(" " + child.getTextContent());
      }
      child = child.getNextSibling();
    }
    String freetext = sb.toString().replaceAll("\\s+", " ").trim();
    isBlankQuery = freetext.equals("");
    isSpecialQuery = root.getAttribute("special").trim().equals("yes");
    this.put("freetext", freetext);
    setAgeRange(root);
    // log();
  }