Package com.kurento.kmf.jsonrpcconnector.internal.client.TransactionImpl

Examples of com.kurento.kmf.jsonrpcconnector.internal.client.TransactionImpl.ResponseSender


        return new HttpRequestServerSession(sessionId, registerInfo,
            sessionsManager, null);
      }
    };

    ResponseSender responseSender = new ResponseSender() {
      @Override
      public void sendResponse(Message message) throws IOException {
        servletResponse.getWriter().println(message);
      }
    };
View Full Code Here


              Request<? extends Object> request,
              Class<JsonElement> clazz,
              final Continuation<Response<JsonElement>> continuation) {
            try {
              handlerManager.handleRequest(session,
                  (Request) request, new ResponseSender() {
                    @Override
                    public void sendResponse(Message message)
                        throws IOException {
                      continuation
                          .onSuccess((Response) message);
                    }
                  });
            } catch (IOException e) {
              continuation.onError(e);
            }
          }

          @Override
          protected <P, R> Response<R> internalSendRequest(
              Request<P> request, Class<R> resultClass)
              throws IOException {

            final Object[] response = new Object[1];
            try {
              handlerManager.handleRequest(session,
                  (Request) request, new ResponseSender() {
                    @Override
                    public void sendResponse(Message message)
                        throws IOException {
                      response[0] = message;
                    }
                  });

              Response<R> response2 = (Response<R>) response[0];
              Object result = response2.getResult();

              if (result == null
                  || resultClass.isAssignableFrom(result
                      .getClass())) {
                return response2;
              } else if (resultClass == JsonElement.class) {
                response2.setResult((R) JsonUtils
                    .toJsonElement(result));
                return response2;
              } else {
                throw new ClassCastException("Class " + result
                    + " cannot be converted to "
                    + resultClass);
              }

            } catch (IOException e) {
              return new Response(request.getId(), ResponseError
                  .newFromException(e));
            }
          }
        });

    TransactionImpl t = new TransactionImpl(clientSession, newRequest,
        new ResponseSender() {

          @Override
          public void sendResponse(Message message)
              throws IOException {
            response[0] = (Response<JsonObject>) message;
View Full Code Here

    log.debug("Req-> {}", request);

    final Response<JsonObject>[] response = new Response[1];

    TransactionImpl t = new TransactionImpl(session, request,
        new ResponseSender() {
          @Override
          public void sendResponse(Message message)
              throws IOException {
            response[0] = (Response<JsonObject>) message;
          }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.jsonrpcconnector.internal.client.TransactionImpl.ResponseSender

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.