Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 static String getStringParameter(WebRequest request, String name) {
   String p;
   if ((p = request.getParameter(name)) != null) {
     return p;
   } else {
     return "";
   }
 }
Ejemplo n.º 3
0
 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;
   }
 }