Package com.kurento.kmf.common.exception

Examples of com.kurento.kmf.common.exception.KurentoMediaFrameworkException


        @Override
        public void onError(Throwable cause) {

        }
      });
      throw new KurentoMediaFrameworkException(
          "Session is in TERMINATED state. Cannot invoke releaseOnTerminate any longer",
          1);// TODO
    }
    if (cleanupSet == null)
      cleanupSet = new HashSet<MediaObject>();
View Full Code Here


  // to access the specific HttpServletRequest associated to a method
  // execution
  @Override
  public HttpServletRequest getHttpServletRequest() {
    if (state == STATE.ACTIVE || state == STATE.TERMINATED) {
      throw new KurentoMediaFrameworkException(
          "Cannot access initial HttpServletRequest after media negotiation phase. "
              + "This error means that you cannot access the original HttpServletRequest after a response to it has been sent.",
          10006);
    }
    return (HttpServletRequest) initialAsyncCtx.getRequest();
View Full Code Here

    } else if (message.getMethod().equals(METHOD_TERMINATE)) {
      internalTerminateWithoutError(asyncCtx, message.getParams()
          .getReason().getCode(), message.getParams().getReason()
          .getMessage(), message);
    } else {
      throw new KurentoMediaFrameworkException(
          "Unrecognized message with method " + message.getMethod(),
          10012);
    }
  }
View Full Code Here

                "Error releasing MediaObject: "
                    + cause.getMessage());
          }
        });
      } catch (Throwable t) {
        throw new KurentoMediaFrameworkException(
            "Error releasing media object " + mediaObject
                + ". Cause: " + t.getMessage(), t, 20022);
      }
    }
    cleanupSet.clear();
View Full Code Here

    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(
View Full Code Here

    } catch (KurentoMediaFrameworkException ke) {
      internalTerminateWithError(null, ke.getCode(), ke.getMessage(),
          null);
      throw ke;
    } catch (Throwable t) {
      KurentoMediaFrameworkException kmfe = new KurentoMediaFrameworkException(
          t.getMessage(), t, 20029);
      internalTerminateWithError(null, kmfe.getCode(), kmfe.getMessage(),
          null);
      throw kmfe;
    }
  }
View Full Code Here

   * @throws Exception
   *             possible exception thrown by handler implementation
   */
  public ContentCommandResult onContentCommand(T contentSession,
      ContentCommand contentCommand) throws Exception {
    throw new KurentoMediaFrameworkException(
        "Handler must implement onContentCommand for being able to receive commands;",
        10026);
  }
View Full Code Here

    } catch (KurentoMediaFrameworkException ke) {
      internalTerminateWithError(null, ke.getCode(), ke.getMessage(),
          null);
      throw ke;
    } catch (Throwable t) {
      KurentoMediaFrameworkException kmfe = new KurentoMediaFrameworkException(
          t.getMessage(), t, 20029);
      internalTerminateWithError(null, kmfe.getCode(), kmfe.getMessage(),
          null);
      throw kmfe;
    }
  }
View Full Code Here

      String encoding = detectJsonEncoding(new ByteArrayInputStream(
          baos.toByteArray()));
      log.debug("Detected JSON encoding: " + encoding);
      if (encoding == null) {
        throw new KurentoMediaFrameworkException(
            "Invalid or unsupported charset encondig in received JSON request",
            10018);
      }

      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(
          "IOException reading JsonRPC request. Cause: "
              + e.getMessage(), e, 20016);
    }
  }
View Full Code Here

   */
  private void internalSendJsonAnswer(AsyncContext asyncCtx,
      JsonRpcResponse message) {
    try {
      if (asyncCtx == null) {
        throw new KurentoMediaFrameworkException("Null asyncCtx found",
            20017);
      }

      synchronized (asyncCtx) {
        if (!asyncCtx.getRequest().isAsyncStarted()) {
          throw new KurentoMediaFrameworkException(
              "Cannot send message in completed asyncCtx", 1); // TODO
        }

        HttpServletResponse response = (HttpServletResponse) asyncCtx
            .getResponse();
        response.setContentType("application/json");
        OutputStreamWriter osw = new OutputStreamWriter(
            response.getOutputStream(), UTF8);
        osw.write(gson.toJson(message));
        osw.flush();
        log.info("Sent JsonRpc answer ...\n" + message);
        asyncCtx.complete();
      }
    } catch (IOException ioe) {
      throw new KurentoMediaFrameworkException(ioe.getMessage(), ioe,
          20018);
    }
  }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.common.exception.KurentoMediaFrameworkException

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.