ajs6f commented on a change in pull request #628: JENA-1776: Set Content-Length
when sending a graph or dataset
URL: https://github.com/apache/jena/pull/628#discussion_r344506461
##########
File path:
jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java
##########
@@ -492,8 +495,33 @@ protected HttpEntity graphToHttpEntity(Graph graph) {
return graphToHttpEntity(graph, outputTriples);
}
- /** Create an HttpEntity for the graph */
+ /** Create an HttpEntity for the graph. */
protected HttpEntity graphToHttpEntity(Graph graph, RDFFormat syntax) {
+ // Length - leaves connection reusable.
+ return graphToHttpEntityWithLength(graph, syntax);
+ }
+
+ /**
+ * Create an HttpEntity for the graph. The HTTP entity will have the
length but this
+ * requires serialising the graph at the point when this function is
called.
+ */
+ private HttpEntity graphToHttpEntityWithLength(Graph graph, RDFFormat
syntax) {
+ String ct = syntax.getLang().getContentType().getContentType();
+ ByteArrayOutputStream out = new ByteArrayOutputStream(128*1024);
Review comment:
No huge difference, but just out of curiosity, why not `try-with-resource`
here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services