org.sakaiproject.tool.api.Session.setActive()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中org.sakaiproject.tool.api.Session.setActive()方法的一些代码示例,展示了Session.setActive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.setActive()方法的具体详情如下:
包路径:org.sakaiproject.tool.api.Session
类名称:Session
方法名:setActive

Session.setActive介绍

[英]Mark the session as still active, delaying timeout by another period.
[中]将会话标记为仍处于活动状态,将超时时间再延迟一段时间。

代码示例

代码示例来源:origin: sakaiproject/sakai

/**
 * Set active session according to sessionId parameter
 */
private void setSession( HttpServletRequest req )
{
  String sessionId = req.getParameter("session");
  if ( sessionId != null)
  {
    Session session = sessionManager.getSession(sessionId);
    
    if (session != null)
    {
      session.setActive();
      sessionManager.setCurrentSession(session);
    }
  }
}

代码示例来源:origin: sakaiproject/sakai

s.setActive();

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-api

s.setActive();

代码示例来源:origin: sakaiproject/sakai

requestSession.setUserEid(usr.getEid());
  requestSession.setUserId(usr.getId());
  requestSession.setActive();
} catch (UserNotDefinedException e) {
  log.error(e.getMessage(), e);                }

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-api

requestSession.setUserEid(usr.getEid());
  requestSession.setUserId(usr.getId());
  requestSession.setActive();
} catch (UserNotDefinedException e) {
  log.error(e.getMessage(), e);                }

代码示例来源:origin: sakaiproject/sakai

public String setCurrentUser(String userReference) {
  if (userReference == null) {
    throw new IllegalArgumentException("userReference cannot be null");
  }
  String userId = getUserIdFromRef(userReference);
  try {
    // make sure the user id is valid
    userDirectoryService.getUser(userId);
  } catch (UserNotDefinedException e) {
    throw new IllegalArgumentException("Invalid user reference ("+userReference+"), could not find user");
  }
  Session currentSession = sessionManager.getCurrentSession();
  if (currentSession == null) {
    // start a session if none is around
    currentSession = sessionManager.startSession(userId);
  }
  String currentUserId = currentSession.getUserId();
  if (currentSession.getAttribute(CURRENT_USER_MARKER) == null) {
    // only set this if it is not already set
    if (currentUserId == null) {
      currentUserId = "";
    }
    currentSession.setAttribute(CURRENT_USER_MARKER, currentUserId);
  }
  currentSession.setUserId(userId);
  currentSession.setActive();
  sessionManager.setCurrentSession(currentSession);
  authzGroupService.refreshUser(userId);
  return getUserRefFromUserId(currentUserId);
}

相关文章