刷新页面时为啥会调用shiro框架SessionDao的delete方法

李树林 发布于 2016/08/29 11:54
阅读 401
收藏 0
环境SpringMVC Spring mybatis shiro 重写了shiro的sessionDao 。问题是在使用F5 刷新页面时程序会调用SessionDao的delete方法。为什么会调用这个方法?如何修改?

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:cache="http://www.springframework.org/schema/cache" xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-4.2.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
       http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.2.xsd">

    <!-- shiro start -->
   <!-- 自定义Realm -->
    <bean id="myRealm" class="com.telezone.framework.shiro.MyRealm"/>
    
    <!-- 安全管理器 -->
    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">  
        <property name="realm" ref="myRealm"/>  
        <property name="sessionManager" ref="sessionManager"/>
    </bean>
    
    <!-- Shiro过滤器 -->
    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">  
       <!--  Shiro的核心安全接口,这个属性是必须的   -->
        <property name="securityManager" ref="securityManager"/>
      <!--   身份认证失败,则跳转到登录页面的配置   -->
        <property name="loginUrl" value="/user/logout.do"/>
    <!--     权限认证失败,则跳转到指定页面   -->
        <property name="unauthorizedUrl" value="/user/logout.do"/>
     <!--    Shiro连接约束配置,即过滤链的定义   -->
        <property name="filterChainDefinitions">  
            <value>  
                /user/login.do=anon
                /user/toLogout.do=anon
                /user/keepConnection.do = authc
                /roleset/toSet.do=authc,perms[8:1"]
                /roleset/toUserManager.do=authc,perms[7:1"]
                /user/**=authc
                /roleset/**=authc
                /road/**=authc
                /analysis/report/**=authc
                /redis/**=authc
                /personal/**=authc
                /facility/**=authc
                /console/**=authc
                /alarmSetting/**=authc
                /analysis/**=authc
            </value>  
        </property>
    </bean>
    
    <!-- 保证实现了Shiro内部lifecycle函数的bean执行 -->  
    <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>  
    <!-- 开启Shiro注解 -->
    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor">
        <property name="proxyTargetClass" value="true"/>
    </bean>
     <bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">  
        <property name="securityManager" ref="securityManager"/>
    </bean>
    
    <!-- 尝试sessionDao start-->
    
    <bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">  
        <constructor-arg value="sid"/>  
           <property name="maxAge" value="30"/>
           <property name="httpOnly" value="true"/>
    </bean>
    <bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">  
        <property name="sessionDAO" ref="sessionDAO"/>  
        <property name="sessionIdCookieEnabled" value="true"/>
        <property name="sessionIdCookie" ref="sessionIdCookie"/>  
    </bean>
    <bean id="sessionIdGenerator"
        class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator" />
    
    <bean id="sessionDAO" class="com.telezone.framework.shiro.MySessionDao">  
        <property name="sessionIdGenerator" ref="sessionIdGenerator" />
    </bean>
    
    <!-- 尝试End -->
    <!-- shiro end -->
</beans>
加载中
返回顶部
顶部