use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestDatasetOps method gsp_x_ct.
private void gsp_x_ct(String urlDataset, String acceptheader, String contentTypeResponse) {
HttpEntity e = datasetToHttpEntity(data);
HttpOp.execHttpPut(urlDataset(), e);
// Do manually so the test can validate the expected ContentType
try (TypedInputStream in = HttpOp.execHttpGet(urlDataset, acceptheader)) {
assertEqualsIgnoreCase(contentTypeResponse, in.getContentType());
Lang lang = RDFLanguages.contentTypeToLang(in.getContentType());
DatasetGraph dsg = DatasetGraphFactory.create();
StreamRDF dest = StreamRDFLib.dataset(dsg);
RDFParser.source(in).lang(lang).parse(dest);
}
}
use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestHttpOperations method query_by_get_1.
// XXX and directly on dataset
@Test
public void query_by_get_1() {
String qs = Convert.encWWWForm("ASK{}");
String u = serviceQuery() + "?query=" + qs;
try (TypedInputStream in = HttpOp.execHttpGet(u)) {
Assert.assertNotNull(in);
}
}
use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestAdmin method getDatasetDescription.
private static JsonValue getDatasetDescription(String dsName) {
try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opDatasets + "/" + dsName)) {
assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
JsonValue v = JSON.parse(in);
return v;
}
}
use of org.apache.jena.atlas.web.TypedInputStream 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.web.TypedInputStream in project jena by apache.
the class HttpQuery method execPost.
private InputStream execPost() throws QueryExceptionHTTP {
URL target = null;
try {
target = new URL(serviceURL);
} catch (MalformedURLException malEx) {
throw new QueryExceptionHTTP(0, "Malformed URL: " + malEx);
}
log.trace("POST " + target.toExternalForm());
ARQ.getHttpRequestLogger().trace(target.toExternalForm());
try {
// Get the actual response stream
TypedInputStream stream = HttpOp.execHttpPostFormStream(serviceURL, this, contentTypeResult, client, getContext());
if (stream == null)
throw new QueryExceptionHTTP(404);
return execCommon(stream);
} catch (HttpException httpEx) {
throw rewrap(httpEx);
}
}
Aggregations