startSession

@param mixed $context     SessionContext
@param mixed $useExisting Whether to use existing session.

@access public
@return void
499469
public function startSession($context=null, $useExisting=false)
    {
        $logger = $GLOBALS['logger'];
        $app = $GLOBALS['app'];

        // Strip '.'
        $appContext = rtrim($app->getConfiguration()->getApplicationContext(), '.');
        if (empty($appContext)) {
            $appContext = "/";
        } else {
            $appContext = "/".$appContext."/";
        }

        if ($useExisting === true) {
            $sessionCookieName = $app->getConfiguration()->getApplicationContext()."-"."_n5_session";
            $sessionCookieName = preg_replace("/\./", "_",$sessionCookieName); 
            session_set_cookie_params(0, $appContext, null, false, true);
            session_name($sessionCookieName);
            session_start();
        if (!$this->isActiveSession()) {
            self::resetActiveSession();
        }

            $this->_session = new Session($_SESSION);
            if ($this->_session->getAttribute('category') !== null) {
                return;
            }
        }

        if (!isset($_SESSION[self::GLOBAL_PREFIX.'category'])) {
            // No session exists yet.
            if ($context === null) {
                $context = new WebContext($_REQUEST);
            }

            session_unset();
            session_destroy();
            $sessionCookieName = $app->getConfiguration()->getApplicationContext()."-"."_n5_session"; 
            $sessionCookieName = preg_replace("/\./", "_",$sessionCookieName); 
            session_set_cookie_params(0, $appContext, null, false, true);
            session_name($sessionCookieName);
            session_start();
            session_regenerate_id();
            $_SESSION = array();

            $app = $GLOBALS['app'];
            if (!$app->getConfiguration()->isLocal()) {
                //$handler = new CachedSessionHandler();
                //session_set_save_handler(
                    //array($handler, 'open'),
                    //array($handler, 'close'),
                    //array($handler, 'read'),
                    //array($handler, 'write'),
                    //array($handler, 'destroy'),
                    //array($handler, 'gc')
                //);
            }

            $_SESSION[self::GLOBAL_PREFIX.'category']      = $context->get('device');
            $_SESSION[self::GLOBAL_PREFIX.'location']      = $context->get('location');
            $_SESSION[self::GLOBAL_PREFIX.'last_accessed'] = time();
        }//end if

        $this->_session = new Session($_SESSION);

    }
911875
public void startAfterLoginActivity(Context context, Bundle extras) {
        if (!startDelegateActivity(context, delegate.getStartAfterLoginIntent(), extras)) {
            startMessagingActivity(context, extras);
        }
    }
646360
public function onSessionStart($session, $transport)
    {
        $this->thePromise->then(function () use ($session) {
            $session->call('com.example.thefunction0', [])
                ->then(function ($res) {
                    echo "Done.\n";
                    exit;
                });
        });
    }
1218427
public function start()
    {
        if (!session_id() || !$this->isActive()) {
            $file = $line = null;
            if (headers_sent($file, $line)) {
                throw new \RuntimeException(sprintf('Unable to start session, output started at %s:%s', $file, $line));
            }
            session_start();
        }

        if ($this->namespace) {
            if (!isset($_SESSION[$this->namespace])) {
                $_SESSION[$this->namespace] = array();
            }
            $this->data = &$_SESSION[$this->namespace];
        } else {
            $this->data = &$_SESSION;
        }
    }
285636
public static function start($name = null) {
		if (! self::isStarted ()) {
			if (isset ( $name ) && $name !== "") {
				self::$name = $name;
			}
			if (isset ( self::$name )) {
				\session_name ( self::$name );
			}
			\session_start ();
		}
	}
173467
public function logStart($string, $context = []) {
        if (!$this->enabled) {
            return;
        }

        $this->timer = static::getTime();
        $this->log("Start: ".$string, [
            'elapsed' => 'start'
        ] + $context);
    }
588543
function Session(context) {
    this.context = context
    this.cookies = context.cookies
    this.update = this.update.bind(this)
  }
843624
public void startAuthActivity(Context context, Bundle extras) {
        if (!startDelegateActivity(context, delegate.getAuthStartIntent(), extras)) {
            startActivity(context, extras, AuthActivity.class);
        }
    }
234919
protected function sessionStart($force_start = true)
    {
        if ($this->sessionStarted) {
            return;
        }
        $this->sessionStarted = true;
        if (!$this instanceof \PHPDaemon\HTTPRequest\Generic) {
            Daemon::log('Called ' . get_class($this) . '(trait \PHPDaemon\Traits\Sessions)->sessionStart() outside of Request. You should use onSessionStart.');
            return;
        }
        $f = true; // hack to avoid a sort of "race condition"
        $this->onSessionStart(function ($event) use (&$f) {
            $f = false;
            $this->wakeup();
        });
        if ($f) {
            $this->sleep($this->sessionStartTimeout);
        }
    }
443290
public synchronized void start(StartContext context) throws StartException {
        Logger.getLogger("org.mobicents.as10").debug(
                "SipConnectorService.start(), protocol = " + protocol + " - scheme = " + scheme);
        final SocketBinding binding = this.binding.getValue();
        final InetSocketAddress address = binding.getSocketAddress();
        final Executor executor = this.executor.getOptionalValue();
        try {

            SipConnector sipConnector = new SipConnector();
            sipConnector.setIpAddress(address.getAddress().getHostAddress());
            sipConnector.setPort(address.getPort());
            // https://github.com/Mobicents/sip-servlets/issues/44 support multiple connectors
            sipConnector.setTransport(binding.getName().substring(binding.getName().lastIndexOf("sip-") + ("sip-".length())));
            sipConnector.setUseLoadBalancer(useLoadBalancer);
            sipConnector.setLoadBalancerAddress(loadBalancerAddress);
            sipConnector.setLoadBalancerRmiPort(loadBalancerRmiPort);
            sipConnector.setLoadBalancerSipPort(loadBalancerSipPort);
            sipConnector.setUseStaticAddress(useStaticAddress);
            sipConnector.setStaticServerAddress(staticServerAddress);
            sipConnector.setStaticServerPort(staticServerPort);
            sipConnector.setUseStun(useStun);
            sipConnector.setStunServerAddress(stunServerAddress);
            sipConnector.setStunServerPort(stunServerPort);
            sipConnector.setHostNames(hostNames);

            Logger.getLogger("org.mobicents.as10").debug(
                    "SipConnectorService.start(), address = " + address.getAddress().getHostAddress() + " - port = "
                            + address.getPort() + " - transport = " + sipConnector.getTransport());
            Logger.getLogger("org.mobicents.as10").debug("SipConnectorService.start(), hostnames = " + hostNames);

            /*
             * FIXME: kakonyii: need an implementation in SipConnector class for the following fields: enableLookups proxyName
             * proxyPort redirectPort secure maxPostSize maxSavePostSize
             */

            SipProtocolHandler sipProtocolHandler = new SipProtocolHandler(sipConnector);

            // TODO set Executor on ProtocolHandler
            // TODO use server socket factory - or integrate with {@code ManagedBinding}

            final SipConnectorListener connector = new SipConnectorListener(sipProtocolHandler);

            connector.init();
            getSipServer().addConnector(connector);
            connector.start();

            this.connector = connector;
        } catch (Exception e) {
            throw new StartException(MESSAGES.connectorStartError(), e);
        }
        // Register the binding after the connector is started
        binding.getSocketBindings().getNamedRegistry().registerBinding(new ConnectorBinding(binding));
        //notify SipServer only when connector has already been added/started
        getSipServer().connectorAdded(connector);        
    }
1242435
public function setContext(array $context)
    {
        $context = array_merge($this->getDefaultContext(), $context);

        // Always save to property in service for fallback
        $this->context = $context;

        // Try to save the context in session,
        if ($this->session) {
            $this->session->set(static::SESSION_KEY, $context);
            $this->session->save();
        }
    }
879029
public synchronized void start(final Context context) {
        this.contextWeakReference = new WeakReference<Context>(context);
        if (isStarted()) {
            throw new IllegalStateException("Already started.");
        } else {
            executorService = Executors.newFixedThreadPool(getThreadCount(), new MinPriorityThreadFactory());
            // start the binding to the service
            runner = new Thread(this, SPICE_MANAGER_THREAD_NAME_PREFIX + spiceManagerThreadIndex++);
            runner.setPriority(Thread.MIN_PRIORITY);
            isStopped = false;
            runner.start();

            Ln.d("SpiceManager started.");
        }
    }
705766
private function startSession() {

        if (session_id() == "" || session_id() == null) {
            if (isset ($_REQUEST ["HTTPSESSID"])) {
                session_id($_REQUEST ["HTTPSESSID"]);
            }
            else if (isset ($_REQUEST ["PHPSESSID"])) {
                session_id($_REQUEST ["PHPSESSID"]);
            }
        }

        $cookieDomain = Configuration::instance()->getParameter('session.cookie.domain');
        if ($cookieDomain) {

            if ($cookieDomain == "WILDCARD") {
                $host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : "";
                if ($host) {
                    $splitHost = explode(".", $host);
                    $tld = array_pop($splitHost);
                    $domain = array_pop($splitHost);
                    $cookieDomain = ".$domain.$tld";
                } else {
                    return;
                }
            }



            ini_set("session.cookie_domain", $cookieDomain);
        }

        @session_start();

    }
1062263
public void triggerSessionCreated(JingleSession jingleSession) {
        jingleSessions.add(jingleSession);
        jingleSession.addListener(this);
        for (CreatedJingleSessionListener createdJingleSessionListener : creationListeners) {
            try {
                createdJingleSessionListener.sessionCreated(jingleSession);
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, "exception", e);
            }
        }
    }
887924
public static void init(Context context, boolean nativeExopackage) {
    try {
      init(context, nativeExopackage ? SOLOADER_ENABLE_EXOPACKAGE : 0);
    } catch (IOException ex) {
      throw new RuntimeException(ex);
    }
  }
777858
protected function startSession()
    {
        if (session_status() === \PHP_SESSION_ACTIVE) {
            throw new \RuntimeException('Session already started by PHP.');
        }

        if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
            throw new \RuntimeException(sprintf('Unable to start session, headers have already been sent by "%s" at line %d.', $file, $line));
        }

        if (!session_start()) {
            throw new \RuntimeException('Unable to start session');
        }
    }
471522
private function laterSessionStart()
    {
        if (!is_null($this->fingerprint) && !$this->fingerprint->hasValidFingerprint()) {
            throw new \Exception("Session fingerprint doesn't match"); // @codeCoverageIgnore
        }
        if (!is_null($this->expiration) && $this->expiration->isObsolete()) {
            return true;
        }
        return false;
    }