use of org.apache.http.entity.EntityTemplate in project jena by apache.
the class TestMultipleEmbedded method graphToHttpEntity.
/** Create an HttpEntity for the graph */
protected static HttpEntity graphToHttpEntity(final Graph graph) {
final RDFFormat syntax = RDFFormat.TURTLE_BLOCKS;
ContentProducer producer = new ContentProducer() {
@Override
public void writeTo(OutputStream out) {
RDFDataMgr.write(out, graph, syntax);
}
};
EntityTemplate entity = new EntityTemplate(producer);
ContentType ct = syntax.getLang().getContentType();
entity.setContentType(ct.getContentType());
return entity;
}
use of org.apache.http.entity.EntityTemplate in project jena by apache.
the class TestEmbeddedFuseki method graphToHttpEntity.
/** Create an HttpEntity for the graph */
protected static HttpEntity graphToHttpEntity(final Graph graph) {
final RDFFormat syntax = RDFFormat.TURTLE_BLOCKS;
ContentProducer producer = new ContentProducer() {
@Override
public void writeTo(OutputStream out) {
RDFDataMgr.write(out, graph, syntax);
}
};
EntityTemplate entity = new EntityTemplate(producer);
ContentType ct = syntax.getLang().getContentType();
entity.setContentType(ct.getContentType());
return entity;
}
use of org.apache.http.entity.EntityTemplate in project jena by apache.
the class DatasetGraphAccessorHTTP method graphToHttpEntity.
/** Create an HttpEntity for the graph */
protected HttpEntity graphToHttpEntity(final Graph graph) {
final RDFFormat syntax = getOutboundSyntax();
ContentProducer producer = new ContentProducer() {
@Override
public void writeTo(OutputStream out) {
RDFDataMgr.write(out, graph, syntax);
}
};
EntityTemplate entity = new EntityTemplate(producer);
String ct = syntax.getLang().getContentType().getContentType();
entity.setContentType(ct);
return entity;
}
use of org.apache.http.entity.EntityTemplate in project jena by apache.
the class RDFConnectionRemote method datasetToHttpEntity.
/** Create an HttpEntity for the dataset */
protected HttpEntity datasetToHttpEntity(DatasetGraph dataset, RDFFormat syntax) {
EntityTemplate entity = new EntityTemplate((out) -> RDFDataMgr.write(out, dataset, syntax));
String ct = syntax.getLang().getContentType().getContentType();
entity.setContentType(ct);
return entity;
}
use of org.apache.http.entity.EntityTemplate in project jena by apache.
the class RDFConnectionRemote method graphToHttpEntity.
/** Create an HttpEntity for the graph */
protected HttpEntity graphToHttpEntity(Graph graph, RDFFormat syntax) {
EntityTemplate entity = new EntityTemplate((out) -> RDFDataMgr.write(out, graph, syntax));
String ct = syntax.getLang().getContentType().getContentType();
entity.setContentType(ct);
return entity;
}
Aggregations