当前位置: 首页>>代码示例>>Java>>正文


Java SessionException类代码示例

本文整理汇总了Java中org.apache.shiro.session.SessionException的典型用法代码示例。如果您正苦于以下问题:Java SessionException类的具体用法?Java SessionException怎么用?Java SessionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionException类属于org.apache.shiro.session包,在下文中一共展示了SessionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
public Session getSession(SessionKey key) throws SessionException {
    if (!WebUtils.isHttp(key)) {
        String msg = "SessionKey must be an HTTP compatible implementation.";
        throw new IllegalArgumentException(msg);
    }

    HttpServletRequest request = WebUtils.getHttpRequest(key);

    Session session = null;

    HttpSession httpSession = request.getSession(false);
    if (httpSession != null) {
        session = createSession(httpSession, request.getRemoteHost());
    }

    return session;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:18,代码来源:ServletContainerSessionManager.java

示例2: preHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
protected boolean preHandle(ServletRequest request, ServletResponse response)
		throws Exception {
	
	Subject subject = getSubject(request, response);
       String redirectUrl = getRedirectUrl(request, response, subject);
       
	try {
		if(null != subject.getPrincipal()) {
			subject.logout();
            issueRedirect(request, response, redirectUrl);
            return false;
		} else {
			return true;
		}
	} catch (SessionException ise) {
           log.debug("Encountered session exception during login.", ise);
           return false;
       }
}
 
开发者ID:colddew,项目名称:mix-web,代码行数:21,代码来源:LoginFilter.java

示例3: preHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
    Subject subject = getSubject(request, response);
    String redirectUrl = getRedirectUrl(request, response, subject);
    //try/catch added for SHIRO-298:
    try {
        subject.logout();
    } catch (SessionException ise) {
        log.debug("Encountered session exception during logout.  This can generally safely be ignored.", ise);
    }
    issueRedirect(request, response, redirectUrl);
    return false;
}
 
开发者ID:liaojiacan,项目名称:zkAdmin,代码行数:14,代码来源:ForceLogoutFilter.java

示例4: onPreHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
	Subject subject = SecurityUtils.getSubject();
	try {
		subject.logout();
	} catch (SessionException ise) {
		LOGGER.info("Encountered session exception during logout.  This can generally safely be ignored.", ise);
	}
	HTTP.writeAsJSON(response,
			MessageBean.STATUS, HTTP.Status.OK.toInt(),
			MessageBean.MESSAGE, Messages.Status.OK.toString()) ;
	return false;
}
 
开发者ID:auslides,项目名称:stateless-shiro,代码行数:14,代码来源:BearerTokenRevokeFilter.java

示例5: clearRunAsIdentitiesInternal

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
private void clearRunAsIdentitiesInternal() {
    //try/catch added for SHIRO-298
    try {
        clearRunAsIdentities();
    } catch (SessionException se) {
        log.debug("Encountered session exception trying to clear 'runAs' identities during logout.  This " +
                "can generally safely be ignored.", se);
    }
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:10,代码来源:DelegatingSubject.java

示例6: preHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
/**
 * Acquires the currently executing {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject},
 * a potentially Subject or request-specific
 * {@link #getRedirectUrl(javax.servlet.ServletRequest, javax.servlet.ServletResponse, org.apache.shiro.subject.Subject) redirectUrl},
 * and redirects the end-user to that redirect url.
 *
 * @param request  the incoming ServletRequest
 * @param response the outgoing ServletResponse
 * @return {@code false} always as typically no further interaction should be done after user logout.
 * @throws Exception if there is any error.
 */
@Override
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
    Subject subject = getSubject(request, response);
    String redirectUrl = getRedirectUrl(request, response, subject);
    //try/catch added for SHIRO-298:
    try {
        subject.logout();
    } catch (SessionException ise) {
        log.debug("Encountered session exception during logout.  This can generally safely be ignored.", ise);
    }
    issueRedirect(request, response, redirectUrl);
    return false;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:25,代码来源:LogoutFilter.java

示例7: lookupRequiredSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
private Session lookupRequiredSession(SessionKey key) throws SessionException {
    Session session = lookupSession(key);
    if (session == null) {
        String msg = "Unable to locate required Session instance based on SessionKey [" + key + "].";
        throw new UnknownSessionException(msg);
    }
    return session;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:9,代码来源:AbstractNativeSessionManager.java

示例8: lookupRequiredSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
private Session lookupRequiredSession(SessionKey key) throws SessionException {
	Session session = lookupSession(key);
	if (session == null) {
		String msg = "Unable to locate required Session instance based on SessionKey [" + key + "].";
		throw new UnknownSessionException(msg);
	}
	return session;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:9,代码来源:SimpleSessionManager.java

示例9: preHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
    //在这里执行退出系统前需要清空的数据
    Subject subject = getSubject(request, response);
    String redirectUrl = getRedirectUrl(request, response, subject);
    try {
        subject.logout();
    } catch (SessionException ise) {
        ise.printStackTrace();
    }
    issueRedirect(request, response, redirectUrl);
    //返回false表示不执行后续的过滤器,直接返回跳转到登录页面
    return false;

}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:16,代码来源:SystemLogoutFilter.java

示例10: getSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
public Session getSession(SessionKey key) throws SessionException {
    // The SessionKey can be used to look up sessions
    // These sessions might be saved somehow, e.g. in a database,
    // but in a web environment they are probably better of being
    // maintained by the servlet container
    
    JWebSessionKey k = (JWebSessionKey) key;
    
    SessionFacade session = k.getContext().getSession(false);
    if (session != null)
        return createSession(session, k.getContext().remoteHost());
    return null;
}
 
开发者ID:MTDdk,项目名称:jawn,代码行数:15,代码来源:JawnSecuritySessionManager.java

示例11: getSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
public Session getSession(SessionKey key) throws SessionException {
    if (key == null) {
        throw new NullPointerException("SessionKey argument cannot be null.");
    }
    IOTClient session = (IOTClient) doGetSession(key);
    session.setSessionManager(this);
    return session;
}
 
开发者ID:caricah,项目名称:iotracah,代码行数:9,代码来源:IOTSessionManager.java

示例12: preHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
  Subject subject = SecurityUtils.getSubject();
  try {
      subject.logout();
  } catch (SessionException ise) {
      log.debug("Encountered session exception during logout.  This can generally safely be ignored.", ise);
  }

  return false;
}
 
开发者ID:OHDSI,项目名称:WebAPI,代码行数:12,代码来源:LogoutFilter.java

示例13: getSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Nullable
Session getSession(String sessionId) {
  if(sessionId != null) {
    SessionKey key = new DefaultSessionKey(sessionId);
    try {
      return SecurityUtils.getSecurityManager().getSession(key);
    } catch(SessionException e) {
      // Means that the session does not exist or has expired.
    }
  }
  return null;
}
 
开发者ID:obiba,项目名称:agate,代码行数:13,代码来源:SessionResource.java

示例14: preHandle

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
protected boolean preHandle(RequestWrapper requestWrapper, ResponseWrapper responseWrapper) {
  Subject subject = getSubject(requestWrapper);
  String redirectUrl = getRedirectUrl();
  try {
    subject.logout();
  } catch (SessionException ise) {
    LOGGER.debug("Encountered session exception during logout.  This can generally safely be ignored.", ise);
  }
  issueRedirect(requestWrapper, responseWrapper, redirectUrl);
  return false;
}
 
开发者ID:orctom,项目名称:laputa,代码行数:13,代码来源:LogoutFilter.java

示例15: getSession

import org.apache.shiro.session.SessionException; //导入依赖的package包/类
@Override
public Session getSession( SessionKey key ) throws SessionException {
    if ( !WebUtils.isHttp( key ) ) {
        String msg = "SessionKey must be an HTTP compatible implementation.";
        throw new IllegalArgumentException( msg );
    }

    HttpServletRequest request = WebUtils.getHttpRequest( key );

    return ( Session ) request.getAttribute( REQUEST_ATTRIBUTE_KEY );
}
 
开发者ID:apache,项目名称:usergrid,代码行数:12,代码来源:HttpRequestSessionManager.java


注:本文中的org.apache.shiro.session.SessionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。