Package com.kurento.kmf.jsonrpcconnector.internal.message

Examples of com.kurento.kmf.jsonrpcconnector.internal.message.ResponseError


    if (sessionId == null) {

      responseSender
          .sendResponse(new Response<>(
              request.getId(),
              new ResponseError(99999,
                  "SessionId is mandatory in a reconnection request")));
    } else {

      ServerSession session = sessionsManager.get(sessionId);
      if (session != null) {

        String oldTransportId = session.getTransportId();
        session.setTransportId(transportId);
        sessionsManager.updateTransportId(session, oldTransportId);

        responseSender.sendResponse(new Response<>(sessionId, request
            .getId(), RECONNECTION_SUCCESSFUL));
      } else {

        responseSender.sendResponse(new Response<>(request.getId(),
            new ResponseError(99999, RECONNECTION_ERROR)));
      }
    }
  }
View Full Code Here


        // TODO Maybe use the pattern handleUncaughtException
        log.error(message, e);

        if (request.getId() != null) {
          rs.sendResponse(new Response<>(null, new ResponseError(0,
              message)));
        }
        return;
      }

      JsonRpcHandler nonGenHandler = handler;

      TransactionImpl tx = new TransactionImpl(session, request, rs);
      nonGenHandler.handleRequest(tx, nonGenRequest);

      if (!tx.isAsync() && request.getId() != null) {

        boolean notResponded = tx.setRespondedIfNot();

        if (notResponded) {
          // Empty response
          rs.sendResponse(new Response<>(request.getId(), ""));
        }
      }

    } catch (Exception e) {

      // TODO Maybe use the pattern handleUncaughtException
      log.error("Exception while processing request", e);

      ResponseError error = ResponseError.newFromException(e);
      rs.sendResponse(new Response<>(request.getId(), error));
    }
  }
View Full Code Here

  @Override
  public void sendError(int code, String message, String data)
      throws IOException {

    internalSendResponse(new Response<>(request.getId(), new ResponseError(
        code, message, data)));
  }
View Full Code Here

  }

  @Override
  public void sendError(Throwable e) throws IOException {

    ResponseError error = ResponseError.newFromException(e);
    internalSendResponse(new Response<>(request.getId(), error));

  }
View Full Code Here

    String resultJson = org.apache.http.client.fluent.Request.Post(url)
        .bodyString(toJson(request), ContentType.APPLICATION_JSON)
        .execute().returnContent().asString();

    if (resultJson == null || resultJson.trim().isEmpty()) {
      return new Response<>(request.getId(), new ResponseError(3,
          "The server send an empty response"));
    }

    Response<R> response = fromJsonResponse(resultJson, resultClass);
View Full Code Here

        });

    try {
      remoteHandler.handleRequest(t, (Request) request);
    } catch (Exception e) {
      ResponseError error = ResponseError.newFromException(e);
      return new Response<>(request.getId(), error);
    }

    if (response[0] != null) {
      // Simulate receiving json string from net
View Full Code Here

      JsonRpcHandler genericHandler = handler;
      genericHandler.handleRequest(t, request);

    } catch (Exception e) {

      ResponseError error = ResponseError.newFromException(e);
      return new Response<>(request.getId(), error);
    }

    if (response[0] != null) {
      // Simulate receiving json string from net
View Full Code Here

TOP

Related Classes of com.kurento.kmf.jsonrpcconnector.internal.message.ResponseError

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.