Пример #1
0
 // request a table from the servlet
 WebResponse getTable(String table, boolean text) throws Exception {
   initServletRunner();
   WebRequest request = new GetMethodWebRequest("http://null/DaemonStatus");
   request.setParameter("table", table);
   if (text) {
     request.setParameter("output", "text");
   }
   return sClient.getResponse(request);
 }
 static String getStringParameter(WebRequest request, String name) {
   String p;
   if ((p = request.getParameter(name)) != null) {
     return p;
   } else {
     return "";
   }
 }
 static int parseIntParameter(WebRequest request, String name, int ifMissing) {
   String p;
   if ((p = request.getParameter(name)) != null) {
     try {
       return asInt(p);
     } catch (NumberFormatException ee) {
       logger.error(
           new StringWriter()
               .append("Could not cast event property '")
               .append(name)
               .append(": ")
               .append(p)
               .append("' to int")
               .toString());
       return ifMissing;
     }
   } else {
     return ifMissing;
   }
 }