Examples of IGlobalScope


Examples of org.red5.server.api.IGlobalScope

    String path = req.getContextPath() + req.getServletPath();
    if (path.startsWith("/")) {
      path = path.substring(1);
    }
    path = path.substring(0, path.length() - getServletName().length() - 1);
    IGlobalScope global = server.lookupGlobal(req.getServerName(), path);
    if (global == null) {
      global = server.lookupGlobal(req.getLocalName(), path);
      if (global == null) {
        global = server.lookupGlobal(req.getLocalAddr(), path);
      }
View Full Code Here

Examples of org.red5.server.api.IGlobalScope

      if (packet == null) {
        log.error("Packet should not be null");
        return;
      }
      // Provide a valid IConnection in the Red5 object
      final IGlobalScope global = getGlobalScope(req);
      final IContext context = global.getContext();
      final IScope scope = context.resolveScope(global, packet.getScopePath());
      IRemotingConnection conn = new RemotingConnection(req, scope, packet);
      // Make sure the connection object isn't garbage collected
      req.setAttribute(CONNECTION, conn);
      try {
View Full Code Here

Examples of org.red5.server.api.IGlobalScope

          final String sessionId = null;
          conn.setup(host, path, sessionId, params);
          try {
            // Lookup server scope when connected
            // Use host and application name
            IGlobalScope global = server.lookupGlobal(host, path);
            if (global == null) {
              call.setStatus(Call.STATUS_SERVICE_NOT_FOUND);
              if (call instanceof IPendingServiceCall) {
                StatusObject status = getStatus(NC_CONNECT_INVALID_APPLICATION);
                status.setDescription("No scope \"" + path
                    + "\" on this server.");
                ((IPendingServiceCall) call).setResult(status);
              }
              log.info("No application scope found for {} on host {}. Misspelled or missing application folder?", path, host);
              disconnectOnReturn = true;
            } else {
              final IContext context = global.getContext();
              IScope scope = null;
              try {
                scope = context.resolveScope(global, path);
              } catch (ScopeNotFoundException err) {
                call.setStatus(Call.STATUS_SERVICE_NOT_FOUND);
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

   * Return global scope
   *
   * @return Global scope
   */
  public IGlobalScope getGlobalScope() {
    IGlobalScope gs = scopeResolver.getGlobalScope();
    logger.trace("Global scope: {}", gs);
    return gs;
  }
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

      path = path.substring(1);
    } else {
      log.debug("Path length: {} Servlet name length: {}", path.length(), getServletName().length());
      path = path.substring(0, path.length() - getServletName().length() - 1);
    }
    IGlobalScope global = server.lookupGlobal(req.getServerName(), path);
    if (global == null) {
      global = server.lookupGlobal(req.getLocalName(), path);
      if (global == null) {
        global = server.lookupGlobal(req.getLocalAddr(), path);
      }
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

      if (packet == null) {
        log.error("Packet should not be null");
        return;
      }
      // Provide a valid IConnection in the Red5 object
      final IGlobalScope global = getGlobalScope(req);
      final IContext context = global.getContext();
      final IScope scope = context.resolveScope(global, packet.getScopePath());
      conn = new RemotingConnection(req, scope, packet);
      // Make sure the connection object isn't garbage collected
      req.setAttribute(CONNECTION, conn);
      // set thread local reference
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

        params.put("path", path);
        // connection setup
        conn.setup(host, path, params);
        try {
          // Lookup server scope when connected using host and application name
          IGlobalScope global = server.lookupGlobal(host, path);
          log.trace("Global lookup result: {}", global);
          if (global != null) {
            final IContext context = global.getContext();
            IScope scope = null;
            try {
              // TODO optimize this to use Scope instead of Context
              scope = context.resolveScope(global, path);
              // if global scope connection is not allowed, reject
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

  @Test
  public void testGlobalLookupsForVirtualHostsWithSameIP() {
    final Server server = new Server();

    IGlobalScope g0 = new DummyGlobalScope("default");
    IGlobalScope g1 = new DummyGlobalScope("default.vhost1");
    IGlobalScope g2 = new DummyGlobalScope("default.vhost2");
   
    //local server
    server.registerGlobal(g0);
   
    server.addMapping("localhost", "", "default");
    server.addMapping("localhost", "oflaDemo", "default");

    //virtual host 1
   
    server.registerGlobal(g1);

    server.addMapping("", "", "default.vhost1");
    server.addMapping("localhost", "oflaDemo", "default.vhost1");
    server.addMapping("localhost:8088", "", "default.vhost1");
    server.addMapping("127.0.0.1", "oflaDemo", "default.vhost1");
    //
    server.addMapping("vhost1.localdomain", "", "default.vhost1");
    server.addMapping("vhost1.localdomain", "oflaDemo", "default.vhost1");
   
    //virtual host 2
   
    server.registerGlobal(g2);

    server.addMapping("", "", "default.vhost2");
    server.addMapping("localhost", "oflaDemo", "default.vhost2");
    server.addMapping("localhost:8088", "", "default.vhost2");
    server.addMapping("127.0.0.1", "oflaDemo", "default.vhost2");
    //
    server.addMapping("vhost2.localdomain", "", "default.vhost2");
    server.addMapping("vhost2.localdomain", "oflaDemo", "default.vhost2");

    //assertions
   
    Assert.assertTrue(server.lookupGlobal("vhost2.localdomain", "blah") != null);
    Assert.assertTrue(server.lookupGlobal("vhost2.localdomain", "oflaDemo") != null);
   
    IGlobalScope tmp = server.lookupGlobal("vhost2.localdomain", "oflaDemo");
    log.debug("Global 2: {}", tmp);
    Assert.assertTrue(tmp.getName().equals("default.vhost2"));
   
    tmp = server.lookupGlobal("vhost1.localdomain", "oflaDemo");
    log.debug("Global 1: {}", tmp);
    Assert.assertTrue(tmp.getName().equals("default.vhost1"));

  }
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

    int threads = 10;
   
    final Server server = new Server();

    IGlobalScope g0 = new DummyGlobalScope("default");
   
    //local server
    server.registerGlobal(g0);
   
    server.addMapping("localhost", "", "default");
    server.addMapping("localhost", "oflaDemo", "default");
   
    TestRunnable[] trs = new TestRunnable[threads];
    for (int t = 0; t < threads; t++) {
      trs[t] = new HostAddWorker(server, t);
    }

    MultiThreadedTestRunner mttr = new MultiThreadedTestRunner(trs);

    //kickstarts the MTTR & fires off threads
    long start = System.nanoTime();
    mttr.runTestRunnables();
    log.info("Runtime: {} ns", (System.nanoTime() - start));

    for (TestRunnable r : trs) {
      String name = ((HostAddWorker) r).getName();
      Assert.assertTrue(server.lookupGlobal(name + ".localdomain", "nonexistentscope") != null);
      IGlobalScope tmp = server.lookupGlobal(name + ".localdomain", "oflaDemo");
      Assert.assertTrue(tmp.getName().equals("default." + name));
    }   
  }
View Full Code Here

Examples of org.red5.server.api.scope.IGlobalScope

      this.server = server;
      this.name = "vhost" + index;
    }

    public void runTest() throws Throwable {
      IGlobalScope gs = new DummyGlobalScope("default." + name);

      server.registerGlobal(gs);
     
      for (int i = 0; i < 6; i++) {
        server.addMapping("", "", "default." + name);
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.