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


Java WebUtils._isSessionCreationEnabled方法代码示例

本文整理汇总了Java中org.apache.shiro.web.util.WebUtils._isSessionCreationEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java WebUtils._isSessionCreationEnabled方法的具体用法?Java WebUtils._isSessionCreationEnabled怎么用?Java WebUtils._isSessionCreationEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.shiro.web.util.WebUtils的用法示例。


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

示例1: isSessionStorageEnabled

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
/**
 * Returns {@code true} if session storage is generally available (as determined by the super class's global
 * configuration property {@link #isSessionStorageEnabled()} and no request-specific override has turned off
 * session storage, {@code false} otherwise.
 * <p/>
 * This means session storage is disabled if the {@link #isSessionStorageEnabled()} property is {@code false} or if
 * a request attribute is discovered that turns off session storage for the current request.
 *
 * @param subject the {@code Subject} for which session state persistence may be enabled
 * @return {@code true} if session storage is generally available (as determined by the super class's global
 *         configuration property {@link #isSessionStorageEnabled()} and no request-specific override has turned off
 *         session storage, {@code false} otherwise.
 */
@SuppressWarnings({"SimplifiableIfStatement"})
@Override
public boolean isSessionStorageEnabled(Subject subject) {
    if (subject.getSession(false) != null) {
        //use what already exists
        return true;
    }

    if (!isSessionStorageEnabled()) {
        //honor global setting:
        return false;
    }

    //SHIRO-350: non-web subject instances can't be saved to web-only session managers:
    //since 1.2.1:
    if (!(subject instanceof WebSubject) && (this.sessionManager != null && !(this.sessionManager instanceof NativeSessionManager))) {
        return false;
    }

    return WebUtils._isSessionCreationEnabled(subject);
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:35,代码来源:DefaultWebSessionStorageEvaluator.java

示例2: isSessionStorageEnabled

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
/**
 * Returns {@code true} if session storage is generally available (as
 * determined by the super class's global configuration property
 * {@link #isSessionStorageEnabled()} and no request-specific override has
 * turned off session storage, {@code false} otherwise.
 * <p/>
 * This means session storage is disabled if the
 * {@link #isSessionStorageEnabled()} property is {@code false} or if a
 * request attribute is discovered that turns off session storage for the
 * current request.
 *
 * @param subject
 *            the {@code Subject} for which session state persistence may be
 *            enabled
 * @return {@code true} if session storage is generally available (as
 *         determined by the super class's global configuration property
 *         {@link #isSessionStorageEnabled()} and no request-specific
 *         override has turned off session storage, {@code false} otherwise.
 */
@SuppressWarnings({ "SimplifiableIfStatement" })
@Override
public boolean isSessionStorageEnabled(Subject subject) {
	if (subject.getSession(false) != null) {
		// use what already exists
		return true;
	}

	if (!isSessionStorageEnabled()) {
		// honor global setting:
		return false;
	}

	// SHIRO-350: non-web subject instances can't be saved to web-only
	// session managers:
	// since 1.2.1:
	if (!(subject instanceof WebSubject)
			&& (this.sessionManager != null && !(this.sessionManager instanceof NativeSessionManager))) {
		return false;
	}

	return WebUtils._isSessionCreationEnabled(subject);
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:43,代码来源:SimpleWebSessionStorageEvaluator.java

示例3: getSession

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
public HttpSession getSession(boolean create) {

        HttpSession httpSession;

        if (isHttpSessions()) {
            httpSession = super.getSession(false);
            if (httpSession == null && create) {
                //Shiro 1.2: assert that creation is enabled (SHIRO-266):
                if (WebUtils._isSessionCreationEnabled(this)) {
                    httpSession = super.getSession(create);
                } else {
                    throw newNoSessionCreationException();
                }
            }
        } else {
            if (this.session == null) {

                boolean existing = getSubject().getSession(false) != null;

                Session shiroSession = getSubject().getSession(create);
                if (shiroSession != null) {
                    this.session = new ShiroHttpSession(shiroSession, this, this.servletContext);
                    if (!existing) {
                        setAttribute(REFERENCED_SESSION_IS_NEW, Boolean.TRUE);
                    }
                }
            }
            httpSession = this.session;
        }

        return httpSession;
    }
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:33,代码来源:ShiroHttpServletRequest.java

示例4: isSessionCreationEnabled

import org.apache.shiro.web.util.WebUtils; //导入方法依赖的package包/类
/**
 * Returns {@code true} if session creation is allowed  (as determined by the super class's
 * {@link super#isSessionCreationEnabled()} value and no request-specific override has disabled sessions for this subject,
 * {@code false} otherwise.
 * <p/>
 * This means session creation is disabled if the super {@link super#isSessionCreationEnabled()} property is {@code false}
 * or if a request attribute is discovered that turns off sessions for the current request.
 *
 * @return {@code true} if session creation is allowed  (as determined by the super class's
 *         {@link super#isSessionCreationEnabled()} value and no request-specific override has disabled sessions for this
 *         subject, {@code false} otherwise.
 * @since 1.2
 */
@Override
protected boolean isSessionCreationEnabled() {
    boolean enabled = super.isSessionCreationEnabled();
    return enabled && WebUtils._isSessionCreationEnabled(this);
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:19,代码来源:WebDelegatingSubject.java


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