Search in sources :

Example 6 with EntityTemplate

use of org.apache.http.entity.EntityTemplate in project jena by apache.

the class TestDatasetOps method datasetToHttpEntity.

/** Create an HttpEntity for the graph */
protected HttpEntity datasetToHttpEntity(final DatasetGraph dsg) {
    final RDFFormat syntax = RDFFormat.NQUADS;
    EntityTemplate entity = new EntityTemplate((out) -> RDFDataMgr.write(out, dsg, syntax));
    String ct = syntax.getLang().getContentType().getContentType();
    entity.setContentType(ct);
    return entity;
}
Also used : EntityTemplate(org.apache.http.entity.EntityTemplate)

Aggregations

EntityTemplate (org.apache.http.entity.EntityTemplate)6 OutputStream (java.io.OutputStream)3 ContentProducer (org.apache.http.entity.ContentProducer)3 RDFFormat (org.apache.jena.riot.RDFFormat)3 ContentType (org.apache.jena.atlas.web.ContentType)2