Store the session id for our server in the local session
@return The session id or null
330571
protected function setSessionId($sessionId) {
    $session = ObjectFactory::getInstance('session');
    $sids = $session->get(self::SIDS_SESSION_VARNAME);
    $sids[$this->serverCli] = $sessionId;
    $session->set(self::SIDS_SESSION_VARNAME, $sids);
  }
604900
long __getId() {
        Session session = this.wiki.__getHibernateSession();
        session.beginTransaction();
        session.lock(hibernateCategory, LockMode.NONE);
        long id = hibernateCategory.getId();
        session.getTransaction().commit();
        return id;
    }
654642
def _generate_session_id(self):
        """"""

        while True:
            rand = os.urandom(16)
            now = time.time()
            secret_key = self._config.secret_key
            session_id = hashlib.sha1(("%s%s%s%s" % (rand, now, utils.safestr(web.ctx.ip), secret_key)).encode("utf-8"))
            session_id = session_id.hexdigest()
            if session_id not in self.store:
                break
        return session_id
205609
protected final String getAccessToken() {
        if (sessionTracker != null) {
            Session currentSession = sessionTracker.getOpenSession();
            return (currentSession != null) ? currentSession.getAccessToken() : null;
        }
        return null;
    }
638519
public Session getSysSession() {

        sysSession.currentSchema =
            sysSession.database.schemaManager.getDefaultSchemaHsqlName();
        sysSession.isProcessingScript = false;
        sysSession.isProcessingLog    = false;

        sysSession.setUser(sysSession.database.getUserManager().getSysUser());

        return sysSession;
    }
1238126
public function setSessionId($session_id=null)
    {
        $this->session_id= ($session_id!== null) ? $session_id : null;

        return $this;
    }
597886
public function getProposedSessionId()
    {

        // if no session has already been load, initialize the session manager
        /** @var \AppserverIo\Appserver\ServletEngine\SessionManagerInterface $manager */
        $manager = $this->getContext()->search(SessionManagerInterface::IDENTIFIER);

        // if no session manager was found, we don't support sessions
        if ($manager == null) {
            return;
        }

        // if we can't find a requested session name, we try to load the default session cookie
        if ($this->getRequestedSessionName() == null) {
            $this->setRequestedSessionName($manager->getSessionSettings()->getSessionName());
        }

        // load the requested session ID and name
        $sessionName = $this->getRequestedSessionName();
        $id = $this->getRequestedSessionId();

        // try to load session ID from session cookie of request/response
        $cookieFound = null;
        if ($id == null && $this->getResponse()->hasCookie($sessionName)) {
            $cookieFound = $this->getResponse()->getCookie($sessionName);
        } elseif ($id == null && $this->hasCookie($sessionName)) {
            $cookieFound = $this->getCookie($sessionName);
        }

        // check if we can find a cookie
        if (is_array($cookieFound)) {
            // iterate over the cookies and try to find one that is not expired
            foreach ($cookieFound as $cookie) {
                if ($cookie instanceof CookieInterface && $cookie->isExpired() === false) {
                    $this->setRequestedSessionId($id = $cookie->getValue());
                }
            }

        // if we found a single cookie instance
        } elseif ($cookieFound instanceof CookieInterface && $cookieFound->isExpired() === false) {
            $this->setRequestedSessionId($id = $cookieFound->getValue());
        }

        // return the requested session
        return $id;
    }
309272
private String getSessionId(final HttpSession sess) {
    try {
      if (sess == null) {
        return "NO-SESSIONID";
      } else {
        return sess.getId();
      }
    } catch (Throwable t) {
      return "SESSION-ID-EXCEPTION";
    }
  }
443436
public function getUserId()
	{
		if ($this->session_machine === null) {
			throw new RuntimeException('Session machine not ready ‒ '.__METHOD__.' called too soon.');
		}
		return $this->session_machine->state !== '' ? $this->session_machine[$this->user_id_property] : null;
	}
785794
public String getRequestID() {
		if(requestID == null)
		{
		requestID = UUID.randomUUID().toString().replace("-", "");
		}
		return requestID;
	}
424092
public static Session getSession(int dbId, long sessionId) {

        Database db = (Database) databaseIDMap.get(dbId);

        return db == null ? null
                          : db.sessionManager.getSession(sessionId);
    }
1330173
public String getId()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getId");

    SIBUuid12 streamID = _streamSet.getStreamID();
    String streamIDStr = (streamID != null) ? streamID.toString() : STREAM_SET_UNINITIALISED_STRING;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getId", streamIDStr);
    return streamIDStr;
  }
1047613
public function getSessionId()
    {
        if ($mauticSessionId = $this->get(self::MAUTIC_SESSION_ID)) {
            return $mauticSessionId;
        }

        if ($mauticSessionId = $this->get(self::MTC_SID)) {
            return $mauticSessionId;
        }

        return null;
    }
279664
@Override
    public String getSessionId() {
        return sessionSharedStorage.flatMap(storage -> storage.getSessionId()).orElseGet(() -> {
            if (isSuppressHttpSession()) { // needs to check because of or-created
                String msg = "Not found the session ID of shared storage. (required if no http session)";
                throw new IllegalStateException(msg);
            }
            return getSessionOrCreated().getId(); // normally here
        });
    }
789698
public String getCurrentSessionId() {
        String currentId = null;
        Hashtable ht = (Hashtable) currentThreadSacHashtable.get();
        if (ht != null) {
            SessionAffinityContext sac = (SessionAffinityContext) ht.get(_smc.getSessionAffinityContextKey());
            if (sac != null) {
                currentId = _sam.getInUseSessionID(null, sac);
                // Make sure this is set if nothing was passed in.
                if (currentId == null) {
                    currentId = "NONE";
                }
            }
        }
        // If null is returned, this is considered to be a user spawned thread.
        return currentId;
    }
732540
static final String getUserId() {
    UserService userService = UserServiceFactory.getUserService();
    User loggedIn = userService.getCurrentUser();
    Preconditions.checkState(loggedIn != null, "This servlet requires the user to be logged in.");
    return loggedIn.getUserId();
  }
124608
public Session getOpenSession() {
        Session openSession = getSession();
        if (openSession != null && openSession.isOpened()) {
            return openSession;
        }
        return null;
    }