Examples of JsonRpcRequest


Examples of com.google.gwt.requestfactory.shared.messages.JsonRpcRequest

    public String makePayload() {
      RequestData data = invocations.get(0).getRequestData();

      AutoBean<JsonRpcRequest> bean = MessageFactoryHolder.FACTORY.jsonRpcRequest();
      JsonRpcRequest request = bean.as();

      request.setVersion("2.0");
      request.setApiVersion(data.getApiVersion());
      request.setId(payloadId++);

      Map<String, Splittable> params = new HashMap<String, Splittable>();
      for (Map.Entry<String, Object> entry : data.getNamedParameters().entrySet()) {
        Object obj = entry.getValue();
        Splittable value = encode(obj);
        params.put(entry.getKey(), value);
      }
      if (data.getRequestResource() != null) {
        params.put("resource", encode(data.getRequestResource()));
      }
      request.setParams(params);
      request.setMethod(data.getOperation());

      return AutoBeanCodex.encode(bean).getPayload();
    }
View Full Code Here

Examples of com.google.web.bindery.requestfactory.shared.messages.JsonRpcRequest

    public String makePayload() {
      RequestData data = state.invocations.get(0).getRequestData();

      AutoBean<JsonRpcRequest> bean = MessageFactoryHolder.FACTORY.jsonRpcRequest();
      JsonRpcRequest request = bean.as();

      request.setVersion("2.0");
      request.setApiVersion(data.getApiVersion());
      request.setId(payloadId++);

      Map<String, Splittable> params = new HashMap<String, Splittable>();
      for (Map.Entry<String, Object> entry : data.getNamedParameters().entrySet()) {
        Object obj = entry.getValue();
        Splittable value = encode(obj);
        params.put(entry.getKey(), value);
      }
      if (data.getRequestResource() != null) {
        params.put("resource", encode(data.getRequestResource()));
      }
      request.setParams(params);
      request.setMethod(data.getOperation());

      return AutoBeanCodex.encode(bean).getPayload();
    }
View Full Code Here

Examples of com.google.web.bindery.requestfactory.shared.messages.JsonRpcRequest

    public String makePayload() {
      RequestData data = state.invocations.get(0).getRequestData();

      AutoBean<JsonRpcRequest> bean = MessageFactoryHolder.FACTORY.jsonRpcRequest();
      JsonRpcRequest request = bean.as();

      request.setVersion("2.0");
      request.setApiVersion(data.getApiVersion());
      request.setId(payloadId++);

      Map<String, Splittable> params = new HashMap<String, Splittable>();
      for (Map.Entry<String, Object> entry : data.getNamedParameters().entrySet()) {
        Object obj = entry.getValue();
        Splittable value = encode(obj);
        params.put(entry.getKey(), value);
      }
      if (data.getRequestResource() != null) {
        params.put("resource", encode(data.getRequestResource()));
      }
      request.setParams(params);
      request.setMethod(data.getOperation());

      return AutoBeanCodex.encode(bean).getPayload();
    }
View Full Code Here

Examples of com.google.web.bindery.requestfactory.shared.messages.JsonRpcRequest

    public String makePayload() {
      RequestData data = invocations.get(0).getRequestData();

      AutoBean<JsonRpcRequest> bean = MessageFactoryHolder.FACTORY.jsonRpcRequest();
      JsonRpcRequest request = bean.as();

      request.setVersion("2.0");
      request.setApiVersion(data.getApiVersion());
      request.setId(payloadId++);

      Map<String, Splittable> params = new HashMap<String, Splittable>();
      for (Map.Entry<String, Object> entry : data.getNamedParameters().entrySet()) {
        Object obj = entry.getValue();
        Splittable value = encode(obj);
        params.put(entry.getKey(), value);
      }
      if (data.getRequestResource() != null) {
        params.put("resource", encode(data.getRequestResource()));
      }
      request.setParams(params);
      request.setMethod(data.getOperation());

      return AutoBeanCodex.encode(bean).getPayload();
    }
View Full Code Here

Examples of com.google.web.bindery.requestfactory.shared.messages.JsonRpcRequest

    public String makePayload() {
      RequestData data = state.invocations.get(0).getRequestData();

      AutoBean<JsonRpcRequest> bean = MessageFactoryHolder.FACTORY.jsonRpcRequest();
      JsonRpcRequest request = bean.as();

      request.setVersion("2.0");
      request.setApiVersion(data.getApiVersion());
      request.setId(payloadId++);

      Map<String, Splittable> params = new HashMap<String, Splittable>();
      for (Map.Entry<String, Object> entry : data.getNamedParameters().entrySet()) {
        Object obj = entry.getValue();
        Splittable value = encode(obj);
        params.put(entry.getKey(), value);
      }
      if (data.getRequestResource() != null) {
        params.put("resource", encode(data.getRequestResource()));
      }
      request.setParams(params);
      request.setMethod(data.getOperation());

      return AutoBeanCodex.encode(bean).getPayload();
    }
View Full Code Here

Examples of com.kurento.kmf.content.jsonrpc.JsonRpcRequest

   */
  private void doRequest4JsonControlProtocol(AsyncContext asyncCtx,
      String contentId, HttpServletResponse resp)
      throws ServletException, IOException {

    JsonRpcRequest message = null;

    try {
      message = protocolManager.receiveJsonRequest(asyncCtx);

      if (message == null) {
        throw new KurentoMediaFrameworkException(
            "Null json message received", 10020);
      }

      AbstractContentSession contentSession = null;
      String sessionId = message.getParams() != null ? message
          .getParams().getSessionId() : null;

      if (sessionId == null && message.getMethod().equals(METHOD_START)) {
        // Session is created by a start request, we need to fill
        // asyncCtx associated to start requests.
        contentSession = createContentSession(asyncCtx, contentId);
        contentSessionManager.put(contentSession);
      } else if (sessionId == null
          && message.getMethod().equals(METHOD_EXECUTE)) {
        // Session is created by an execute request, the asyncCtx for
        // start requests must be set to null
        contentSession = createContentSession(null, contentId);
        contentSessionManager.put(contentSession);
      } else if (sessionId != null) {
        contentSession = contentSessionManager.get(sessionId);
        if (contentSession == null) {
          throw new KurentoMediaFrameworkException(
              "Could not find contentSession object associated to sessionId "
                  + sessionId, 10021);
        }
      } else {
        throw new KurentoMediaFrameworkException(
            "Could not find required sessionId field in request",
            10022);
      }

      Future<?> future = executor.getExecutor().submit(
          createAsyncRequestProcessor(contentSession, message,
              asyncCtx));

      // Store future for using it in ContentAsyncListener in case of
      // error
      asyncCtx.getRequest().setAttribute(
          ContentAsyncListener.FUTURE_REQUEST_PROCESSOR_ATT_NAME,
          future);
      asyncCtx.getRequest().setAttribute(
          ContentAsyncListener.CONTENT_REQUEST_ATT_NAME,
          contentSession);
      asyncCtx.getRequest()
          .setAttribute(
              ContentAsyncListener.CONTROL_PROTOCOL_REQUEST_MESSAGE_ATT_NAME,
              message);
    } catch (KurentoMediaFrameworkException ke) {
      int reqId = message != null ? message.getId() : 0;
      protocolManager.sendJsonError(
          asyncCtx,
          JsonRpcResponse.newError(
              ExceptionUtils.getJsonErrorCode(ke.getCode()),
              ke.getMessage(), reqId));
    } catch (Throwable t) {
      int reqId = message != null ? message.getId() : 0;
      protocolManager.sendJsonError(asyncCtx, JsonRpcResponse.newError(
          ExceptionUtils.getJsonErrorCode(1), t.getMessage(), reqId));
    }
  }
View Full Code Here

Examples of com.kurento.kmf.content.jsonrpc.JsonRpcRequest

      }

      InputStreamReader isr = new InputStreamReader(
          new ByteArrayInputStream(baos.toByteArray()), encoding);

      JsonRpcRequest jsonRequest = gson.fromJson(isr,
          JsonRpcRequest.class);
      Assert.notNull(jsonRequest.getMethod());
      log.info("Received JsonRpc request ...\n " + jsonRequest.toString());
      return jsonRequest;
    } catch (IOException e) {
      // TODO: trace this exception and double check appropriate JsonRpc
      // answer is sent
      throw new KurentoMediaFrameworkException(
View Full Code Here

Examples of com.kurento.kmf.content.jsonrpc.JsonRpcRequest

      future.cancel(true);
    }

    AbstractContentSession contentRequest = (AbstractContentSession) asyncContext
        .getRequest().getAttribute(CONTENT_REQUEST_ATT_NAME);
    JsonRpcRequest jsonRequest = (JsonRpcRequest) asyncContext.getRequest()
        .getAttribute(CONTROL_PROTOCOL_REQUEST_MESSAGE_ATT_NAME);
    if (contentRequest != null) {
      contentRequest.internalTerminateWithError(asyncContext, errorCode,
          msg, jsonRequest);
    }
View Full Code Here

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

                if (args instanceof Object[]) {
                    params = (Object[])args;
                }

                JsonRpcRequest req = null;
                if (JSONRPCBinding.VERSION_20.equals(((JSONRPCBinding)endpointReference.getBinding()).getVersion())) {
                    req = new JsonRpc20Request(requestId, msg.getOperation().getName(), params);
                } else {
                    req = new JsonRpc10Request(requestId, msg.getOperation().getName(), params);
                }
                final JsonRpcRequest json = req;

                // Create content producer so that we can stream the json result out
                ContentProducer cp = new ContentProducer() {
                    public void writeTo(OutputStream outstream) throws IOException {
                        // mapper.writeValue(outstream, req.toJSONObject().toString());
                        try {
                            json.write(outstream);
                        } catch (Exception e) {
                            throw new IOException(e);
                        }
                    }
                };
View Full Code Here

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

                if (args instanceof Object[]) {
                    params = (Object[])args;
                }

                JsonRpcRequest req = null;
                if (JSONRPCBinding.VERSION_20.equals(((JSONRPCBinding)endpointReference.getBinding()).getVersion())) {
                    req = new JsonRpc20Request(requestId, msg.getOperation().getName(), params);
                } else {
                    req = new JsonRpc10Request(requestId, msg.getOperation().getName(), params);
                }
                final JsonRpcRequest json = req;

                // Create content producer so that we can stream the json result out
                ContentProducer cp = new ContentProducer() {
                    public void writeTo(OutputStream outstream) throws IOException {
                        // mapper.writeValue(outstream, req.toJSONObject().toString());
                        try {
                            json.write(outstream);
                        } catch (Exception e) {
                            throw new IOException(e);
                        }
                    }
                };
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.