Ejemplo n.º 1
0
  @Override
  protected OBJECT get_data(ConnectionApi api, OBJECT selector_values, OBJECT props)
      throws WebApplicationException {
    String url = (String) selector_values.get("JSON URL feed");
    String path = (String) selector_values.get("JSON URL path");
    OBJECT o = api.call(url);

    try {
      return new OBJECT("value", o.find(path));
    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("CUSTOM JSON RESPONSE WAS " + o.toJSON());
      throw new WebApplicationException("Unable to find data.");
    }
  }
Ejemplo n.º 2
0
 @Override
 protected OBJECT get_data(ConnectionApi api, OBJECT selector_values, OBJECT props)
     throws WebApplicationException {
   String s = (String) selector_values.get("enter number");
   double value = 0;
   try {
     value = Double.parseDouble(s);
   } catch (Exception e) {
   }
   return new OBJECT("value", value);
 }