Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-167

getServletContext allways return null with conf via spring (native mode)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.0.0
    • Integration: Spring
    • None
    • sun java, jetty 8.0.0, servelt 3.0 api, win 7

    Description

      Hi,
      i am using shiro rev. 945078, with configuration which uses native sessions

      filter is configured via springframework - DelegatingFilterProxy

      (here is the snippet from web.xml)

      <filter>
      <filter-name>shiroFilter</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      </filter>

      (and here from spring conf. xml)

      <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
      <property name="securityManager" ref="securityManager"/>
      </bean>
      <bean id="securityManager" class="org.apache.shiro.web.DefaultWebSecurityManager">
      <property name="realm" ref="trustRealm" />
      <property name="subjectFactory" ref="trustSubjectFactory" />
      <property name="sessionMode" value="native" />
      <property name="sessionManager" ref="trustSessionManager" />
      <property name="cacheManager">
      <bean class="org.apache.shiro.cache.MemoryConstrainedCacheManager" />
      </property>
      </bean>

      the problem i have is that the method HttpServletRequest.getSession().getServletContext() always return null,

      (I was wondering why and i found that the ServletContext is set to AbstractFilter only in init(filterConfig) method.
      But this method is never called in configuration via spring-DelegatingFilterProxy. I know that specifying the "targetFilterLifecycle" filter init-param as "true" will enforce invocation of the Filter.init. But this way my definitions will be overrided.)

      Attachments

        Activity

          People

            lhazlewood Les Hazlewood
            avan Milos Kolencik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: