Codota Logo
Session.getId
Code IndexAdd Codota to your IDE (free)

How to use
getId
method
in
org.apache.shiro.session.Session

Best Java code snippets using org.apache.shiro.session.Session.getId (Showing top 20 results out of 441)

  • Common ways to obtain Session
private void myMethod () {
Session s =
  • Codota IconSecurityUtils.getSubject().getSession()
  • Codota IconSubject subject;subject.getSession(false)
  • Codota IconSubject subject;subject.getSession()
  • Smart code suggestions by Codota
}
origin: shuzheng/zheng

@Override
public void onStop(Session session) {
  LOGGER.debug("会话停止:" + session.getId());
}
origin: apache/shiro

/**
 * Immediately delegates to the underlying proxied session.
 */
public Serializable getId() {
  return delegate.getId();
}
origin: shuzheng/zheng

@Override
public void onStart(Session session) {
  LOGGER.debug("会话创建:" + session.getId());
}
origin: shuzheng/zheng

@Override
public void onExpiration(Session session) {
  LOGGER.debug("会话过期:" + session.getId());
}
origin: killbill/killbill

public void disableUpdatesForSession(final Session session) {
  noUpdateSessionsCache.put(session.getId(), Boolean.TRUE);
}
origin: apache/shiro

public void delete(Session session) {
  if (session == null) {
    throw new NullPointerException("session argument cannot be null.");
  }
  Serializable id = session.getId();
  if (id != null) {
    sessions.remove(id);
  }
}
origin: Graylog2/graylog2-server

@Override
protected void doDelete(Session session) {
  LOG.debug("Deleting session {}", session);
  final Serializable id = session.getId();
  final MongoDbSession dbSession = mongoDBSessionService.load(id.toString());
  if (dbSession != null) {
    final int deleted = mongoDBSessionService.destroy(dbSession);
    LOG.debug("Deleted {} sessions with ID {} from database", deleted, id);
  } else {
    LOG.debug("Session {} not found in database", id);
  }
}
origin: apache/shiro

public String getId() {
  return getSession().getId().toString();
}
origin: killbill/killbill

public void enableUpdatesForSession(final Session session) {
  noUpdateSessionsCache.invalidate(session.getId());
  doUpdate(session);
}
origin: apache/shiro

public void update(Session session) throws UnknownSessionException {
  storeSession(session.getId(), session);
}
origin: killbill/killbill

public SessionModelDao(final Session session) {
  this.id = session.getId() == null ? null : session.getId().toString();
  this.startTimestamp = new DateTime(session.getStartTimestamp(), DateTimeZone.UTC);
  this.lastAccessTime = new DateTime(session.getLastAccessTime(), DateTimeZone.UTC);
  this.timeout = session.getTimeout();
  this.host = session.getHost();
  try {
    this.sessionData = serializeSessionData(session);
  } catch (final IOException e) {
    this.sessionData = new byte[]{};
  }
}
origin: shuzheng/zheng

@Override
protected void doUpdate(Session session) {
  // 如果会话过期/停止 没必要再更新了
  if(session instanceof ValidatingSession && !((ValidatingSession)session).isValid()) {
    return;
  }
  // 更新session的最后一次访问时间
  UpmsSession upmsSession = (UpmsSession) session;
  UpmsSession cacheUpmsSession = (UpmsSession) doReadSession(session.getId());
  if (null != cacheUpmsSession) {
    upmsSession.setStatus(cacheUpmsSession.getStatus());
    upmsSession.setAttribute("FORCE_LOGOUT", cacheUpmsSession.getAttribute("FORCE_LOGOUT"));
  }
  RedisUtil.set(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + session.getId(), SerializableUtil.serialize(session), (int) session.getTimeout() / 1000);
  // 更新ZHENG_UPMS_SERVER_SESSION_ID、ZHENG_UPMS_SERVER_CODE过期时间 TODO
  LOGGER.debug("doUpdate >>>>> sessionId={}", session.getId());
}
origin: apache/shiro

protected void onExpiration(Session s, ExpiredSessionException ese, SessionKey key) {
  log.trace("Session with id [{}] has expired.", s.getId());
  try {
    onExpiration(s);
    notifyExpiration(s);
  } finally {
    afterExpired(s);
  }
}
origin: apache/shiro

protected void onInvalidation(Session s, InvalidSessionException ise, SessionKey key) {
  if (ise instanceof ExpiredSessionException) {
    onExpiration(s, (ExpiredSessionException) ise, key);
    return;
  }
  log.trace("Session with id [{}] is invalid.", s.getId());
  try {
    onStop(s);
    notifyStop(s);
  } finally {
    afterStopped(s);
  }
}
origin: apache/shiro

public void stop(SessionKey key) throws InvalidSessionException {
  Session session = lookupRequiredSession(key);
  try {
    if (log.isDebugEnabled()) {
      log.debug("Stopping session with id [" + session.getId() + "]");
    }
    session.stop();
    onStop(session, key);
    notifyStop(session);
  } finally {
    afterStopped(session);
  }
}
origin: apache/shiro

protected Session createExposedSession(Session session, SessionKey key) {
  if (!WebUtils.isWeb(key)) {
    return super.createExposedSession(session, key);
  }
  ServletRequest request = WebUtils.getRequest(key);
  ServletResponse response = WebUtils.getResponse(key);
  SessionKey sessionKey = new WebSessionKey(session.getId(), request, response);
  return new DelegatingSession(this, sessionKey);
}
origin: apache/shiro

protected Session createExposedSession(Session session, SessionContext context) {
  if (!WebUtils.isWeb(context)) {
    return super.createExposedSession(session, context);
  }
  ServletRequest request = WebUtils.getRequest(context);
  ServletResponse response = WebUtils.getResponse(context);
  SessionKey key = new WebSessionKey(session.getId(), request, response);
  return new DelegatingSession(this, key);
}
origin: apache/shiro

@Test
public void testSessionListenerStopNotification() {
  final boolean[] stopped = new boolean[1];
  SessionListener listener = new SessionListenerAdapter() {
    public void onStop(Session session) {
      stopped[0] = true;
    }
  };
  sm.getSessionListeners().add(listener);
  Session session = sm.start(null);
  sm.stop(new DefaultSessionKey(session.getId()));
  assertTrue(stopped[0]);
}
origin: apache/shiro

@Test
public void testGlobalTimeout() {
  long timeout = 1000;
  sm.setGlobalSessionTimeout(timeout);
  Session session = sm.start(null);
  assertNotNull(session);
  assertNotNull(session.getId());
  assertEquals(session.getTimeout(), timeout);
}
origin: apache/shiro

@Before
public void setup() {
  ThreadContext.remove();
  sm = new DefaultSessionManager();
  this.session = new DelegatingSession(sm, new DefaultSessionKey(sm.start(null).getId()));
}
org.apache.shiro.sessionSessiongetId

Javadoc

Returns the unique identifier assigned by the system upon session creation.

All return values from this method are expected to have proper toString(), equals(), and hashCode() implementations. Good candidates for such an identifier are java.util.UUIDs, java.lang.Integers, and java.lang.Strings.

Popular methods of Session

  • getAttribute
    Returns the object bound to this session identified by the specified key. If there is no object boun
  • setAttribute
    Binds the specified value to this session, uniquely identified by the specifed key name. If there is
  • removeAttribute
    Removes (unbinds) the object bound to this session under the specified key name.
  • getHost
    Returns the host name or IP string of the host that originated this session, or nullif the host is u
  • getTimeout
    Returns the time in milliseconds that the session session may remain idle before expiring. * A negat
  • getLastAccessTime
    Returns the last time the application received a request or method invocation from the user associat
  • getStartTimestamp
    Returns the time the session was started; that is, the time the system created the instance.
  • setTimeout
    Sets the time in milliseconds that the session may remain idle before expiring. * A negative val
  • getAttributeKeys
    Returns the keys of all the attributes stored under this session. If there are no attributes, this r
  • stop
    Explicitly stops (invalidates) this session and releases all associated resources. If this session h
  • touch
    Explicitly updates the #getLastAccessTime() of this session to the current time when this method is
  • touch

Popular in Java

  • Creating JSON documents from java classes using gson
  • putExtra (Intent)
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JCheckBox (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now