Package com.tinkerpop.rexster.extension

Examples of com.tinkerpop.rexster.extension.ExtensionResponse


    }

    protected ExtensionResponse tryAppendRexsterAttributesIfJson(final ExtensionResponse extResponse,
                                                                 final ExtensionMethod methodToCall,
                                                                 final String mediaType) {
        ExtensionResponse newExtensionResponse = extResponse;
        if (mediaType.equals(MediaType.APPLICATION_JSON)
                && methodToCall.getExtensionDefinition().tryIncludeRexsterAttributes()) {

            final Object obj = extResponse.getJerseyResponse().getEntity();
            if (obj instanceof JSONObject) {
                final JSONObject entity = (JSONObject) obj;

                if (entity != null) {
                    try {
                        entity.put(Tokens.VERSION, Tokens.REXSTER_VERSION);
                        entity.put(Tokens.QUERY_TIME, this.sh.stopWatch());
                    } catch (JSONException jsonException) {
                        // nothing bad happening here
                        logger.error("Couldn't add Rexster attributes to response for an extension.");
                    }

                    newExtensionResponse = new ExtensionResponse(
                            Response.fromResponse(extResponse.getJerseyResponse()).entity(entity).build());

                }
            }
        }
View Full Code Here


  @ExtensionDescriptor(description = "add vertices to the graph.")
  public ExtensionResponse postVertices(
    @RexsterContext RexsterResourceContext context,
    @RexsterContext Graph graph) {

    ExtensionResponse response = handlePost(graph, context, VERTEX);

    if (graph instanceof TransactionalGraph) {
      TransactionalGraph tgraph = (TransactionalGraph) graph;
      tgraph.commit();
    }
View Full Code Here

TOP

Related Classes of com.tinkerpop.rexster.extension.ExtensionResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.