Examples of JsonRpcResponse


Examples of com.google.wave.api.JsonRpcResponse

        "Performing query: " + searchRequest.getQuery() + " [" + searchRequest.getIndex() + ", "
            + (searchRequest.getIndex() + searchRequest.getNumResults()) + "]");
    OperationRequest operationRequest = opQueue.getPendingOperations().get(0);
    String opId = operationRequest.getId();
    OperationUtil.executeOperation(operationRequest, operationRegistry, context, user);
    JsonRpcResponse jsonRpcResponse = context.getResponses().get(opId);
    SearchResult searchResult =
        (SearchResult) jsonRpcResponse.getData().get(ParamsProperty.SEARCH_RESULTS);
    return searchResult;
  }
View Full Code Here

Examples of com.google.wave.api.JsonRpcResponse

        new OperationContextImpl(waveletProvider,
            converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
    OperationRequest operationRequest = opQueue.getPendingOperations().get(0);
    String opId = operationRequest.getId();
    OperationUtil.executeOperation(operationRequest, operationRegistry, context, user);
    JsonRpcResponse jsonRpcResponse = context.getResponses().get(opId);
    FetchProfilesResult profileResults =
        (FetchProfilesResult) jsonRpcResponse.getData().get(ParamsProperty.FETCH_PROFILES_RESULT);
    return profileResults;
  }
View Full Code Here

Examples of com.google.wave.api.JsonRpcResponse

  public void testDeserializeJsonRpcErrorResponse() throws Exception {
    String response = "{'id':'op1','error':{'message':'Not authorized!'}}";
    JsonElement jsonElement = new JsonParser().parse(response);

    JsonRpcResponseGsonAdaptor adaptor = new JsonRpcResponseGsonAdaptor();
    JsonRpcResponse result = adaptor.deserialize(jsonElement, null, null);
    assertTrue(result.isError());
    assertEquals("op1", result.getId());
    assertEquals("Not authorized!", result.getErrorMessage());
  }
View Full Code Here

Examples of com.google.wave.api.JsonRpcResponse

            return ((JsonPrimitive) (invocation.getArguments()[0])).getAsString();
          }
        });

    JsonRpcResponseGsonAdaptor adaptor = new JsonRpcResponseGsonAdaptor();
    JsonRpcResponse result = adaptor.deserialize(jsonElement, null, mockContext);
    assertFalse(result.isError());
    assertEquals("op1", result.getId());
    assertEquals(1, result.getData().size());
    assertEquals("blip1", result.getData().get(ParamsProperty.NEW_BLIP_ID));
  }
View Full Code Here

Examples of com.google.wave.api.JsonRpcResponse

    // Ensure that responses are returned in the same order as corresponding
    // requests.
    LinkedList<JsonRpcResponse> responses = Lists.newLinkedList();
    for (OperationRequest operation : operations) {
      String opId = operation.getId();
      JsonRpcResponse response = results.getResponses().get(opId);
      responses.addLast(response);
    }

    String jsonResponse =
        robotSerializer.serialize(responses, GsonFactory.JSON_RPC_RESPONSE_LIST_TYPE, version);
View Full Code Here

Examples of com.google.wave.api.JsonRpcResponse

        "Performing query: " + searchRequest.getQuery() + " [" + searchRequest.getIndex() + ", "
            + (searchRequest.getIndex() + searchRequest.getNumResults()) + "]");
    OperationRequest operationRequest = opQueue.getPendingOperations().get(0);
    String opId = operationRequest.getId();
    OperationUtil.executeOperation(operationRequest, operationRegistry, context, user);
    JsonRpcResponse jsonRpcResponse = context.getResponses().get(opId);
    SearchResult searchResult =
        (SearchResult) jsonRpcResponse.getData().get(ParamsProperty.SEARCH_RESULTS);
    return searchResult;
  }
View Full Code Here

Examples of com.google.wave.api.JsonRpcResponse

        new OperationContextImpl(waveletProvider,
            converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);
    OperationRequest operationRequest = opQueue.getPendingOperations().get(0);
    String opId = operationRequest.getId();
    OperationUtil.executeOperation(operationRequest, operationRegistry, context, user);
    JsonRpcResponse jsonRpcResponse = context.getResponses().get(opId);
    FetchProfilesResult profileResults =
        (FetchProfilesResult) jsonRpcResponse.getData().get(ParamsProperty.FETCH_PROFILES_RESULT);
    return profileResults;
  }
View Full Code Here

Examples of org.apache.tuscany.sca.binding.jsonrpc.protocol.JsonRpcResponse

        try {
            if (root.isArray()) {
                ArrayNode input = (ArrayNode)root;
                JsonRpc20BatchRequest batchReq = new JsonRpc20BatchRequest(input);
                for (int i = 0; i < batchReq.getRequests().size(); i++) {
                    JsonRpcResponse result = batchReq.getBatchResponse().getResponses().get(i);
                    if (result == null) {
                        result = invoke(batchReq.getRequests().get(i));
                        batchReq.getBatchResponse().getResponses().set(i, result);
                    }
                }
                ArrayNode responses = batchReq.getBatchResponse().toJSONArray();
                JacksonHelper.MAPPER.writeValue(response.getWriter(), responses);
            } else {
                if (root.has("jsonrpc")) {
                    JsonRpc20Request jsonReq = new JsonRpc20Request((ObjectNode)root);
                    JsonRpcResponse jsonResult = invoke(jsonReq);
                    if (jsonResult != null) {
                        jsonResult.write(response.getWriter());
                    }
                } else {
                    JsonRpc10Request jsonReq = new JsonRpc10Request((ObjectNode)root);
                    JsonRpc10Response jsonResult = invoke(jsonReq);
                    if (jsonResult != null) {
                        jsonResult.write(response.getWriter());
                    }
                }
            }
        } catch (Throwable e) {
            throw new ServletException(e);
View Full Code Here

Examples of org.directwebremoting.jsonrpc.io.JsonRpcResponse

                JsonRpcError error = new JsonRpcError(calls, ex.getMessage(), ERROR_CODE_SERVER, null);
                writeResponse(error, response, SC_INTERNAL_SERVER_ERROR);
                return;
            }

            JsonRpcResponse answer = new JsonRpcResponse(calls.getVersion(), calls.getId(), reply.getReply());
            writeResponse(answer, response, HttpServletResponse.SC_OK);
        }
        catch (JsonRpcCallException ex)
        {
            writeResponse(new JsonRpcError(ex), response, ex.getHttpStatusCode());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.