use of org.apache.jena.atlas.json.JsonValue in project jena by apache.
the class TestAdmin method checkExistsNotActive.
private static void checkExistsNotActive(String name) {
adminPing(name);
try {
askPing(name);
fail("askPing did not cause an Http Exception");
} catch (HttpException ex) {
}
JsonValue v = getDatasetDescription(name);
assertFalse(v.getAsObject().get("ds.state").getAsBoolean().value());
}
use of org.apache.jena.atlas.json.JsonValue in project jena by apache.
the class TestAdmin method list_backups_1.
@Test
public void list_backups_1() {
try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opListBackups)) {
assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
JsonValue v = JSON.parseAny(in);
assertNotNull(v.getAsObject().get("backups"));
}
}
use of org.apache.jena.atlas.json.JsonValue in project jena by apache.
the class json method main.
public static void main(String... args) {
if (args.length == 0)
args = new String[] { "-" };
try {
for (String fn : args) {
JsonValue json = null;
try {
json = JSON.readAny(fn);
} catch (JsonParseException ex) {
String name = fn.equals("-") ? "<stdin>" : fn;
System.err.println(name + ": " + JsonParseException.formatMessage(ex.getMessage(), ex.getLine(), ex.getColumn()));
continue;
}
JSON.write(IndentedWriter.stdout, json);
IndentedWriter.stdout.ensureStartOfLine();
}
} finally {
IndentedWriter.stdout.flush();
}
}
use of org.apache.jena.atlas.json.JsonValue in project jena by apache.
the class ActionServerStatus method description.
private void description(HttpAction action) throws IOException {
ServletOutputStream out = action.response.getOutputStream();
action.response.setContentType(contentTypeJSON);
action.response.setCharacterEncoding(charsetUTF8);
JsonBuilder builder = new JsonBuilder();
builder.startObject();
describeServer(builder, action.request.getLocalPort());
describeDatasets(builder, action.getDataAccessPointRegistry());
builder.finishObject();
JsonValue v = builder.build();
JSON.write(out, v);
out.println();
out.flush();
}
use of org.apache.jena.atlas.json.JsonValue in project jena by apache.
the class ActionSleep method perform.
@Override
protected void perform(HttpAction action) {
Runnable task = createRunnable(action);
AsyncTask aTask = Async.execASyncTask(action, AsyncPool.get(), "sleep", task);
JsonValue v = Async.asJson(aTask);
Async.setLocationHeader(action, aTask);
ServletOps.sendJsonReponse(action, v);
}
Aggregations