Examples of IServiceCall


Examples of org.red5.server.api.service.IServiceCall

     */
  protected void encodeNotifyOrInvoke(ByteBuffer out, Notify invoke, RTMP rtmp) {
    // TODO: tidy up here
    // log.debug("Encode invoke");
    Output output = new org.red5.io.amf.Output(out);
    final IServiceCall call = invoke.getCall();
    final boolean isPending = (call.getStatus() == Call.STATUS_PENDING);

    if (!isPending) {
      if (log.isDebugEnabled()) {
        log.debug("Call has been executed, send result");
      }
      serializer.serialize(output, call.isSuccess() ? "_result" : "_error"); // seems right
    } else {
      if (log.isDebugEnabled()) {
        log.debug("This is a pending call, send request");
      }
      final String action = (call.getServiceName() == null) ? call
          .getServiceMethodName() : call.getServiceName() + '.'
          + call.getServiceMethodName();
      serializer.serialize(output, action); // seems right
    }
    if (invoke instanceof Invoke) {
      serializer.serialize(output, Integer.valueOf(invoke.getInvokeId()));
      serializer.serialize(output, invoke.getConnectionParams());
    }

    if (call.getServiceName() == null && "connect".equals(call.getServiceMethodName())) {
      // Response to initial connect, always use AMF0
      output = new org.red5.io.amf.Output(out);
    } else {
      if (rtmp.getEncoding() == Encoding.AMF3) {
        output = new org.red5.io.amf3.Output(out);
      } else {
        output = new org.red5.io.amf.Output(out);
      }
    }

    if (!isPending && (invoke instanceof Invoke)) {
      IPendingServiceCall pendingCall = (IPendingServiceCall) call;
      if (!call.isSuccess()) {
        StatusObject status = generateErrorResult(StatusCodes.NC_CALL_FAILED, call.getException());
        pendingCall.setResult(status);
      }
      if (log.isDebugEnabled()) {
        log.debug("Writing result: " + pendingCall.getResult());
      }
View Full Code Here

Examples of org.red5.server.api.service.IServiceCall

      onStreamBytesRead(conn, channel, header,
          (BytesRead) message);
    }

    if (header.getDataType() == TYPE_INVOKE) {
      final IServiceCall call = ((Invoke) message).getCall();
      final String action = call.getServiceMethodName();
      if (call.getServiceName() == null &&
          !conn.isConnected() &&
          action.equals(ACTION_CONNECT)) {
        handleConnect(conn, channel, header, (Invoke) message, (RTMP) state);
        return;
      }
View Full Code Here

Examples of org.red5.server.api.service.IServiceCall

    }
  }

  protected void handleConnect(RTMPConnection conn, Channel channel, Header header,
      Invoke invoke, RTMP rtmp) {
    final IServiceCall call = invoke.getCall();
        // Get parameters passed from client to NetConnection#connection
        final Map params = invoke.getConnectionParams();

        // Get hostname
        String host = getHostname((String) params.get("tcUrl"));

        // Check up port
        if (host.endsWith(":1935")) {
      // Remove default port from connection string
      host = host.substring(0, host.length() - 5);
    }

        // App name as path, but without query string if there is one
        String path = (String) params.get("app");
        if (path.indexOf("?") != -1){
          int idx = path.indexOf("?");
          params.put("queryString", path.substring(idx));
          path = path.substring(0, idx);
        }
        params.put("path", path);
       
    final String sessionId = null;
   
    conn.setup(host, path, sessionId, params);
   
    // check the security constraints
    // send back "ConnectionRejected" if fails.
    if (!checkPermission(conn)) {
      call.setStatus(Call.STATUS_ACCESS_DENIED);
      if (call instanceof IPendingServiceCall) {
        IPendingServiceCall pc = (IPendingServiceCall) call;
        pc.setResult(getStatus(NC_CONNECT_REJECTED));
      }
      Invoke reply = new Invoke();
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.