congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Session.getTimeout
Code IndexAdd Tabnine to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: apache/shiro

/**
 * Subclass template hook in case per-session timeout is not based on
 * {@link org.apache.shiro.session.Session#getTimeout()}.
 * <p/>
 * <p>This implementation merely returns {@link org.apache.shiro.session.Session#getTimeout()}</p>
 *
 * @param session the session for which to determine session timeout.
 * @return the time in milliseconds the specified session may remain idle before expiring.
 */
protected long getTimeout(Session session) {
  return session.getTimeout();
}
origin: apache/shiro

/**
 * Immediately delegates to the underlying proxied session.
 */
public long getTimeout() throws InvalidSessionException {
  return delegate.getTimeout();
}
origin: apache/shiro

public int getMaxInactiveInterval() {
  try {
    return (new Long(getSession().getTimeout() / 1000)).intValue();
  } catch (InvalidSessionException e) {
    throw new IllegalStateException(e);
  }
}
origin: apache/shiro

  public boolean matches(Object o) {
    return o instanceof Session && ((Session) o).getTimeout() == this.timeout;
  }
}
origin: apache/shiro

public long getTimeout(SessionKey key) throws InvalidSessionException {
  return lookupRequiredSession(key).getTimeout();
}
origin: shuzheng/zheng

@Override
protected Serializable doCreate(Session session) {
  Serializable sessionId = generateSessionId(session);
  assignSessionId(session, sessionId);
  RedisUtil.set(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + sessionId, SerializableUtil.serialize(session), (int) session.getTimeout() / 1000);
  LOGGER.debug("doCreate >>>>> sessionId={}", sessionId);
  return sessionId;
}
origin: Graylog2/graylog2-server

@Override
protected Serializable doCreate(Session session) {
  final Serializable id = generateSessionId(session);
  assignSessionId(session, id);
  Map<String, Object> fields = Maps.newHashMap();
  fields.put("session_id", id);
  fields.put("host", session.getHost());
  fields.put("start_timestamp", session.getStartTimestamp());
  fields.put("last_access_time", session.getLastAccessTime());
  fields.put("timeout", session.getTimeout());
  Map<String, Object> attributes = Maps.newHashMap();
  for (Object key : session.getAttributeKeys()) {
    attributes.put(key.toString(), session.getAttribute(key));
  }
  fields.put("attributes", attributes);
  final MongoDbSession dbSession = new MongoDbSession(fields);
  final String objectId = mongoDBSessionService.saveWithoutValidation(dbSession);
  LOG.debug("Created session {}", objectId);
  return id;
}
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

Session session = subject.getSession();
String sessionId = session.getId().toString();
int timeOut = (int) session.getTimeout() / 1000;
origin: Graylog2/graylog2-server

dbSession.setTimeout(session.getTimeout());
dbSession.setStartTimestamp(session.getStartTimestamp());
dbSession.setLastAccessTime(session.getLastAccessTime());
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: Graylog2/graylog2-server

  return SessionResponse.create(new DateTime(s.getLastAccessTime(), DateTimeZone.UTC).plus(s.getTimeout()).toDate(),
      id.toString());
} else {
origin: org.apache.shiro/shiro-core

/**
 * Immediately delegates to the underlying proxied session.
 */
public long getTimeout() throws InvalidSessionException {
  return delegate.getTimeout();
}
origin: org.apache.shiro/shiro-core

/**
 * Subclass template hook in case per-session timeout is not based on
 * {@link org.apache.shiro.session.Session#getTimeout()}.
 * <p/>
 * <p>This implementation merely returns {@link org.apache.shiro.session.Session#getTimeout()}</p>
 *
 * @param session the session for which to determine session timeout.
 * @return the time in milliseconds the specified session may remain idle before expiring.
 */
protected long getTimeout(Session session) {
  return session.getTimeout();
}
origin: wuyouzhuguli/FEBS-Shiro

@Override
public List<UserOnline> list() {
  List<UserOnline> list = new ArrayList<>();
  Collection<Session> sessions = sessionDAO.getActiveSessions();
  for (Session session : sessions) {
    UserOnline userOnline = new UserOnline();
    User user;
    SimplePrincipalCollection principalCollection;
    if (session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY) == null) {
      continue;
    } else {
      principalCollection = (SimplePrincipalCollection) session
          .getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY);
      user = (User) principalCollection.getPrimaryPrincipal();
      userOnline.setUsername(user.getUsername());
      userOnline.setUserId(user.getUserId().toString());
    }
    userOnline.setId((String) session.getId());
    userOnline.setHost(session.getHost());
    userOnline.setStartTimestamp(session.getStartTimestamp());
    userOnline.setLastAccessTime(session.getLastAccessTime());
    long timeout = session.getTimeout();
    userOnline.setStatus(timeout == 0L ? "0" : "1");
    String address = AddressUtils.getCityInfo(userOnline.getHost());
    userOnline.setLocation(address);
    userOnline.setTimeout(timeout);
    list.add(userOnline);
  }
  return list;
}
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: org.apache.shiro/shiro-core

public long getTimeout(SessionKey key) throws InvalidSessionException {
  return lookupRequiredSession(key).getTimeout();
}
origin: alexxiyang/shiro-redis

  this.redisManager.set(key, value, (int) (session.getTimeout() / MILLISECONDS_IN_A_SECOND));
  return;
if (expire != NO_EXPIRE && expire * MILLISECONDS_IN_A_SECOND < session.getTimeout()) {
  logger.warn("Redis session expire time: "
      + (expire * MILLISECONDS_IN_A_SECOND)
      + " is less than Session timeout: "
      + session.getTimeout()
      + " . It may cause some problems.");
origin: 417511458/jbone

@Override
protected void doUpdate(Session session) {
  // 如果会话过期/停止 没必要再更新了
  if(session instanceof ValidatingSession && !((ValidatingSession)session).isValid()) {
    return;
  }
  String sessionId = session.getId().toString();
  ValueOperations<String,String> operations = redisTemplate.opsForValue();
  operations.set(SESSION_KEY + sessionId, SerializableUtil.serialize(session),session.getTimeout(), TimeUnit.MILLISECONDS);
  sessionTicketStore.expireBySession(sessionId);
}
origin: liunian1004/vua

@Override
protected Serializable doCreate(Session session) {
  Serializable sessionId = generateSessionId(session);
  //set sessionId to SimpleSession
  assignSessionId(session, sessionId);
  RedisUtil.set(VUA_UPMS_SHIRO_SESSION_ID + "_" + sessionId, SerializableUtil.serialize(session), (int)session.getTimeout() / 1000);
  _log.debug("doCreate >>>> sessionId ={}", sessionId);
  return sessionId;
}
org.apache.shiro.sessionSessiongetTimeout

Javadoc

Returns the time in milliseconds that the session session may remain idle before expiring.
  • A negative return value means the session will never expire.
  • A non-negative return value (0 or greater) means the session expiration will occur if idle for that length of time.
*Note: if you are used to the HttpSession's getMaxInactiveInterval() method, the scale on this method is different: Shiro Sessions use millisecond values for timeout whereas HttpSession.getMaxInactiveInterval uses seconds. Always use millisecond values with Shiro sessions.

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
  • getId
    Returns the unique identifier assigned by the system upon session creation. All return values from t
  • 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
  • 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

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Path (java.nio.file)
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Join (org.hibernate.mapping)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now