use of dontweave.gson.JsonObject in project h2o-2 by h2oai.
the class GroupedAverage method serve.
@Override
public Response serve() {
JsonObject json = new JsonObject();
Frame fr = source.deepSlice(null, null);
UKV.put(destination_key, fr);
return Response.done(json);
}
use of dontweave.gson.JsonObject in project h2o-2 by h2oai.
the class WebAPI method exportModel.
/**
* Exports a model to a JSON file.
*/
static void exportModel() throws Exception {
HttpClient client = new HttpClient();
GetMethod get = new GetMethod(URL + "/2/ExportModel.json?model=MyInitialNeuralNet");
int status = client.executeMethod(get);
if (status != 200)
throw new Exception(get.getStatusText());
JsonObject response = (JsonObject) new JsonParser().parse(new InputStreamReader(get.getResponseBodyAsStream()));
JsonElement model = response.get("model");
JsonWriter writer = new JsonWriter(new FileWriter(JSON_FILE));
writer.setLenient(true);
writer.setIndent(" ");
Streams.write(model, writer);
writer.close();
get.releaseConnection();
}
use of dontweave.gson.JsonObject in project h2o-2 by h2oai.
the class SetTimezone method serve.
// Reply value is the current setting
@Override
protected Response serve() {
invoke();
String s = ParseTime.getTimezone().getID();
JsonObject response = new JsonObject();
response.addProperty("tz", s);
return Response.done(response);
}
use of dontweave.gson.JsonObject in project h2o-2 by h2oai.
the class Shutdown method serve.
@Override
public Response serve() {
java.util.Timer t = new java.util.Timer("Shutdown Timer");
t.schedule(new TimerTask() {
@Override
public void run() {
UDPRebooted.T.shutdown.send(H2O.SELF);
H2O.exit(0);
}
}, 100);
JsonObject json = new JsonObject();
json.addProperty(STATUS, "shutting down");
return Response.done(json);
}
use of dontweave.gson.JsonObject in project h2o-2 by h2oai.
the class TypeaheadRequest method serve.
@Override
protected final Response serve() {
JsonArray array = serve(_filter.value(), _limit.value());
JsonObject response = new JsonObject();
response.add(ITEMS, array);
return Response.done(response);
}
Aggregations