use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestHttpOp method queryGet_02.
@Test(expected = HttpException.class)
public void queryGet_02() {
try {
// No query.
TypedInputStream in = HttpOp.execHttpGet(queryURL + "?query=");
IO.close(in);
} catch (HttpException ex) {
assertEquals(ex.getResponseCode(), HttpSC.BAD_REQUEST_400);
throw ex;
}
}
use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestHttpOp method httpPost_04.
@Test
public void httpPost_04() {
Params params = new Params();
params.addParam("query", "ASK{}");
TypedInputStream in = HttpOp.execHttpPostFormStream(queryURL, params, WebContent.contentTypeResultsJSON);
IO.close(in);
}
use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestHttpOp method httpGet_02.
@Test(expected = HttpException.class)
public void httpGet_02() {
try {
TypedInputStream in = HttpOp.execHttpGet(urlRoot() + "does-not-exist");
IO.close(in);
} catch (HttpException ex) {
assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode());
throw ex;
}
}
use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class TestHttpOp method queryGet_01.
// SPARQL Query
@Test
public void queryGet_01() {
TypedInputStream in = HttpOp.execHttpGet(simpleQuery);
IO.close(in);
}
use of org.apache.jena.atlas.web.TypedInputStream in project jena by apache.
the class RDFConnectionRemote method fetchDataset.
@Override
public Dataset fetchDataset() {
if (destination == null)
throw new ARQException("Dataset operations not available - no dataset URL provided");
Dataset ds = DatasetFactory.createTxnMem();
Txn.executeWrite(ds, () -> {
TypedInputStream s = exec(() -> HttpOp.execHttpGet(destination, WebContent.defaultDatasetAcceptHeader));
Lang lang = RDFLanguages.contentTypeToLang(s.getContentType());
RDFDataMgr.read(ds, s, lang);
});
return ds;
}
Aggregations