/** * Report an access path range count and elapsed time back to the user agent. * * @param resp * The response. * @param rangeCount * The mutation count. * @param elapsed * The elapsed time (milliseconds). * * @throws IOException */ static protected void buildAndCommitRangeCountResponse( final HttpServletResponse resp, final long rangeCount, final long elapsed) throws IOException { final StringWriter w = new StringWriter(); final XMLBuilder t = new XMLBuilder(w); t.root("data").attr("rangeCount", rangeCount) .attr("milliseconds", elapsed).close(); buildAndCommitResponse(resp, HTTP_OK, MIME_APPLICATION_XML, w.toString()); }
/** * Report an access path range count and elapsed time back to the user agent. * * @param resp * The response. * @param rangeCount * The mutation count. * @param elapsed * The elapsed time (milliseconds). * * @throws IOException */ static protected void buildAndCommitRangeCountResponse( final HttpServletResponse resp, final long rangeCount, final long elapsed) throws IOException { final StringWriter w = new StringWriter(); final XMLBuilder t = new XMLBuilder(w); t.root("data").attr("rangeCount", rangeCount) .attr("milliseconds", elapsed).close(); buildAndCommitResponse(resp, HTTP_OK, MIME_APPLICATION_XML, w.toString()); }
final XMLBuilder t = new XMLBuilder(stringWriter); t.root("data").attr("modified", nmodified) .attr("milliseconds", elapsed).close();
final XMLBuilder t = new XMLBuilder(stringWriter); t.root("data").attr("modified", nmodified) .attr("milliseconds", elapsed).close();
final XMLBuilder t = new XMLBuilder(w); t.root("data").attr("result", result).attr("milliseconds", elapsed) .close();
final XMLBuilder t = new XMLBuilder(w); t.root("data").attr("result", result).attr("milliseconds", elapsed) .close();
/** * @todo This does not actually test anything. You have to inspect the * output. */ public void testXMLBuilder() throws IOException { final StringWriter w = new StringWriter(); final XMLBuilder xml = new XMLBuilder(w); XMLBuilder.Node close = xml.root("data") .attr("id", "TheRoot") .attr("name", "Test") .node("child", "My Child") .node("child") .attr("name", "My Child") .close() .node("child") .attr("name", "My Child") .text("Content") .close() .close(); assertTrue(close == null); if(log.isInfoEnabled()) log.info(w.toString()); }
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
@Override public Void call() throws Exception { BigdataSailRepositoryConnection conn = null; try { conn = getQueryConnection(); final StringWriter w = new StringWriter(); final RepositoryResult<Resource> it = conn.getContextIDs(); try { final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("contexts"); while (it.hasNext()) { root.node("context").attr("uri", it.next()).close(); } root.close(); } finally { it.close(); } buildResponse(QueryServlet.HTTP_OK, QueryServlet.MIME_APPLICATION_XML, w.toString()); return null; } finally { if (conn != null) { conn.close(); } } }
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
@Override public Void call() throws Exception { BigdataSailRepositoryConnection conn = null; try { conn = getQueryConnection(); final StringWriter w = new StringWriter(); final RepositoryResult<Resource> it = conn.getContextIDs(); try { final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("contexts"); while (it.hasNext()) { root.node("context").attr("uri", it.next()).close(); } root.close(); } finally { it.close(); } buildResponse(QueryServlet.HTTP_OK, QueryServlet.MIME_APPLICATION_XML, w.toString()); return null; } finally { if (conn != null) { conn.close(); } } }
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response"); final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response"); final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");
final XMLBuilder t = new XMLBuilder(w); final Node root = t.root("response");