Search in sources :

Example 16 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class ListTimezones method serve.

@Override
protected Response serve() {
    String s = ParseTime.listTimezones();
    JsonObject response = new JsonObject();
    response.addProperty("tzlist", s);
    return Response.done(response);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 17 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class LogAndEcho method serve.

@Override
protected Response serve() {
    String s = _message.value();
    Log.info(s);
    JsonObject response = new JsonObject();
    response.addProperty("message", s);
    return Response.done(response);
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 18 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class LogView method serve.

@Override
protected Response serve() {
    String s = water.util.Log.getLogPathFileName();
    JsonObject result = new JsonObject();
    File f = new File(s);
    String contents = Utils.readFile(f);
    if (contents == null) {
        contents = "Not yet initialized, please refresh...";
    }
    result.addProperty("log", "<pre>" + contents + "</pre>");
    Response response = Response.done(result);
    response.addHeader("<a class='btn btn-primary' href='LogDownload.html'>Download all logs</a>");
    return response;
}
Also used : JsonObject(dontweave.gson.JsonObject)

Example 19 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class UniqueFrameId method toJSON.

public JsonObject toJSON() {
    final String json = new String(writeJSON(new AutoBuffer()).buf());
    if (json.length() == 0)
        return new JsonObject();
    JsonObject jo = (JsonObject) new JsonParser().parse(json);
    jo.addProperty("id", this.getId());
    return jo;
}
Also used : JsonObject(dontweave.gson.JsonObject) JsonParser(dontweave.gson.JsonParser)

Example 20 with JsonObject

use of dontweave.gson.JsonObject in project h2o-2 by h2oai.

the class UniqueId method toJSON.

public JsonObject toJSON() {
    JsonObject result = new JsonObject();
    result.addProperty("key", this.getKey());
    result.addProperty("creation_epoch_time_millis", this.getCreationEpochTimeMillis());
    result.addProperty("id", this.getId());
    return result;
}
Also used : JsonObject(dontweave.gson.JsonObject)

Aggregations

JsonObject (dontweave.gson.JsonObject)41 JsonElement (dontweave.gson.JsonElement)5 JsonParser (dontweave.gson.JsonParser)4 JsonArray (dontweave.gson.JsonArray)3 Frame (water.fvec.Frame)3 Job (water.Job)2 Value (water.Value)2 JsonPrimitive (dontweave.gson.JsonPrimitive)1 JsonWriter (dontweave.gson.stream.JsonWriter)1 FileWriter (java.io.FileWriter)1 InputStreamReader (java.io.InputStreamReader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Date (java.util.Date)1 TimerTask (java.util.TimerTask)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 GetMethod (org.apache.commons.httpclient.methods.GetMethod)1 Path (org.apache.hadoop.fs.Path)1 Key (water.Key)1 Timer (water.Timer)1 FrameSummary (water.api.Frames.FrameSummary)1