CypherExecutor.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:WhiteLab2.0-Neo4J-Plugin 作者:
public Response getQueryResult(final Query query) {
    StreamingOutput stream = new StreamingOutput() {
        @Override
        public void write( OutputStream os ) throws IOException, WebApplicationException {
            JsonGenerator jg = objectMapper.getFactory().createGenerator(os, JsonEncoding.UTF8);
            jg.setPrettyPrinter(new DefaultPrettyPrinter());
            jg.writeStartObject();
            if (query != null && query.toCypher().length() > 0) {
                writeQueryDetails(jg, query);
                System.out.println(query.toCypher());
                executeQuery(jg, query);
            } else {
                jg.writeStringField("error", "No query supplied.");
            }
            jg.writeEndObject();
            jg.flush();
            jg.close();
        }
    };

    return Response.ok().entity( stream ).type( MediaType.APPLICATION_JSON ).build();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号