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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.0.0
    • Component/s: Integration: Spring
    • Labels:
      None
    • Environment:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: