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

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

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

Session.removeAttribute介绍

[英]Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

After this method executes, and if the object implements SessionBindingListener, Sakai calls SessionBindingListener.valueUnbound.
[中]

代码示例

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

@EntityCustomAction(action = "notify", viewKey = "")
public PortalNotifications handleNotify(EntityView view) {
  Session s = sessionManager.getCurrentSession();
  if ( s == null ) {
    throw new IllegalArgumentException("Session not found");
  }
  List<String> retval = new ArrayList<String> ();
      String userWarning = (String) s.getAttribute("userWarning");
      if (StringUtils.isNotEmpty(userWarning)) {
    retval.add(userWarning);
  }
  PortalNotifications noti = new PortalNotifications ();
  noti.setError(retval);
  s.removeAttribute("userWarning");
  return noti;
}

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl

@EntityCustomAction(action = "notify", viewKey = "")
public PortalNotifications handleNotify(EntityView view) {
  Session s = sessionManager.getCurrentSession();
  if ( s == null ) {
    throw new IllegalArgumentException("Session not found");
  }
  List<String> retval = new ArrayList<String> ();
      String userWarning = (String) s.getAttribute("userWarning");
      if (StringUtils.isNotEmpty(userWarning)) {
    retval.add(userWarning);
  }
  PortalNotifications noti = new PortalNotifications ();
  noti.setError(retval);
  s.removeAttribute("userWarning");
  return noti;
}

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

/**
 * {@inheritDoc}
 */
public void clearUserEffectiveRole(String azGroupId) {

  // remove the attribute from the session
  sessionManager().getCurrentSession().removeAttribute(ROLESWAP_PREFIX + azGroupId);
  resetSecurityCache(azGroupId);
  
  return;
}

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

public void clearTokenState(String tokenID) {
  ToolSession toolSession = sessionmanager.getCurrentToolSession();
  if (toolSession == null) {
    sessionmanager.getCurrentSession().removeAttribute(tokenID);
  } else {
    sessionmanager.getCurrentToolSession().removeAttribute(tokenID);
  }
}

代码示例来源:origin: uk.org.ponder.sakairsf/sakairsf

public void clearTokenState(String tokenID) {
 ToolSession toolSession = sessionmanager.getCurrentToolSession();
 if (toolSession == null) {
  sessionmanager.getCurrentSession().removeAttribute(tokenID);
 }
 else {
  sessionmanager.getCurrentToolSession().removeAttribute(tokenID);
 }
}

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

public String restoreCurrentUser() {
  // switch user session back if it was taken over
  Session currentSession = sessionManager.getCurrentSession();
  String currentUserId = null;
  if (currentSession != null) {
    currentUserId = (String) currentSession.getAttribute(CURRENT_USER_MARKER);
    if (currentUserId != null) {
      currentSession.removeAttribute(CURRENT_USER_MARKER);
      currentSession.setUserId(currentUserId);
      authzGroupService.refreshUser(currentUserId);
      sessionManager.setCurrentSession(currentSession);
    }
    if ("".equals(currentUserId)) {
      currentUserId = null;
    }
  }
  return getUserRefFromUserId(currentUserId);
}

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

session.removeAttribute(Portal.ATTR_SITE_PAGE + siteId);

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl

session.removeAttribute(Portal.ATTR_SITE_PAGE + siteId);

相关文章