Announcement Announcement Module
Collapse
No announcement yet.
Interceptor not intercepting Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interceptor not intercepting

    I have an interceptor defined and the context loads fine but it is not invoked. I am using <mvc:annotation-driven/> - perhaps this is the cause? The interceptor in question and the only one listed is the TimeOutInterceptor.


    My servlet context config file:


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
    		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
    
        <mvc:annotation-driven/> 
        
        <context:component-scan base-package="edu.harvard.fas.winterbreak"/> 
        
    	<!-- Configures the Tiles layout system -->
    	<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
           	        <property name="definitions">
    			<list>
    				<value>/WEB-INF/layouts/layouts.xml</value>
                    <value>/WEB-INF/protected/views.xml</value>
    			</list>
    		</property>
    
           </bean>
    
        <!--
            - This bean resolves specific types of exceptions to corresponding logical 
            - view names for error views. The default behaviour of DispatcherServlet 
            - is to propagate all exceptions to the servlet container: this will happen 
            - here with all other types of exceptions.
        -->
        <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
            <property name="exceptionMappings">
                <props>
                    <prop key="edu.harvard.fas.web.spring.exception.NoUrlException">badUrl</prop>
                    <prop key="org.springframework.dao.DataAccessException">dataAccessFailure</prop>
                    <prop key="org.springframework.transaction.TransactionException">dataAccessFailure</prop>
                </props>
            </property>
        </bean>
        
            
        <!-- enable the configuration of transactional behavior based on annotations -->
        <tx:annotation-driven transaction-manager="hibernateTransactionManager" />
           
        <bean id="viewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver">
    		<property name="order"><value>1</value></property>
        </bean>
        
        <bean class="org.springframework.web.servlet.view.UrlBasedViewResolver" >
             <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
        	<property name="order"><value>2</value></property>    	
        </bean>
        
        <!-- Finally resolve remaing views to .jsp files -->    
        <bean id="viewResolverToJsp" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/"/>
            <property name="suffix" value=".jsp"/>
            <property name="order"><value>3</value></property>
        </bean>
        
        <!-- Encapsulate the Report permission, existance and applicablity checks in one object -->
        <bean name="reportModelAndViewFactory" class="edu.harvard.fas.registrar.report.client.ReportModelAndViewFactoryImpl" >
            <property name="huidImageViewName" value="huidImageView"/>
            <property name="staticFileViewName" value="staticFileView"/>
            <property name="emptyPDFDocumentLocation" value="/dataNotAvailable.pdf"/>
            <property name="directPDFDocumentViewName" value="pdfBulkView" />
            <property name="reportConfigFactory"><ref bean="reportConfigFactory"/></property> 
            <property name="reportManager"><ref bean="reportManagerBean"/></property>
        </bean>
        
        <!-- The xsl/fop VIEW.  -->
        <bean name="pdfFOPView" class="edu.harvard.fas.web.spring.XMLDataXSLFOPView" >
            <property name="stylesheetLocation"><value>/WEB-INF/xsl/blankFileFO.xsl</value></property>
            <!-- Fixme, for development turn off caching -->
            <property name="cache"><value>true</value></property>
            <property name="renderer"><value>1</value></property>
            <property name="contentType"><value>application/pdf;charset=UTF-8</value></property>
        </bean>
        
        <bean name="pdfBulkView" class="edu.harvard.fas.web.spring.PDFByteArrayView" >
            <!-- This takes in a PDF file as a byte[] and writes it out the response -->
            <property name="contentType"><value>application/pdf;charset=UTF-8</value></property>
        </bean>
    
        <bean name="xlsExportView" class="edu.harvard.fas.winterbreak.web.view.XLSExportView" />
    
        <!-- The static file VIEW.  -->
        <bean name="staticFileView" class="edu.harvard.fas.web.spring.FileView" />
    
    
        <bean name="approvalValidator" class="edu.harvard.fas.winterbreak.validator.ApprovalValidator"/>
        <bean name="activityValidator" class="edu.harvard.fas.winterbreak.validator.ActivityValidator"/>
        <bean name="coordinatorValidator" class="edu.harvard.fas.winterbreak.validator.CoordinatorValidator"/>
        <bean name="revenueValidator" class="edu.harvard.fas.winterbreak.validator.RevenueValidator"/>
        <bean name="expenseValidator" class="edu.harvard.fas.winterbreak.validator.ExpenseValidator"/>
        <bean name="sponsorValidator" class="edu.harvard.fas.winterbreak.validator.SponsorValidator"/>
        <bean name="activityReportController" class="edu.harvard.fas.winterbreak.web.controller.ActivityReportController"/> 
    
        <bean name="approverHomeController" class="edu.harvard.fas.winterbreak.web.controller.ApproverHomeController"> 
            <property name="xlsView" value="xlsExportView" />
        </bean>
      	
      	<bean name="activityReportService" class="edu.harvard.fas.winterbreak.service.report.ActivityReportService">
              <property name="pdfView" value="pdfBulkView" />
            <property name="xslResource"><value>/WEB-INF/xsl/winterBreakFO.xsl</value></property>
      	</bean>
      
        <bean name="activityController" class="edu.harvard.fas.winterbreak.web.controller.ActivityController"/> 
    	
        <bean name="baseTabController" class="edu.harvard.fas.web.controller.BaseTabController"/> 
        
        <bean name="requestorHomeController" class="edu.harvard.fas.winterbreak.web.controller.RequestorHomeController"/>
         
    	<bean id="timeoutInterceptor" class="edu.harvard.fas.web.filter.TimeoutInterceptor">
    		<property name="timeoutView"><value>/timedOut.jsp?title=Session timed out due to inactivity</value></property> 
    		<property name="timeoutInMinutes"><value>1</value></property>     
    	</bean>
    	
    	<bean id="annotationMapper" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    		<property name="interceptors">
    			<list>
    				<ref bean="timeoutInterceptor"/>
    			</list>
    		</property>
    	</bean>
    	
        <!-- The HUID image VIEW.  -->
        <bean name="huidImageView" class="edu.harvard.fas.web.spring.HUIDImageView" >
            <property name="contentType"><value>image/jpeg</value></property>
            <property name="imageDataSource"><ref bean="dataSource"/></property>
        </bean>
    	
     	<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">  
    		 <property name="basename" value="/WEB-INF/messages">  
     		</property>  
        </bean> 
    	
    </beans>

  • #2
    answer here - looks like mvc:annotation-driven shortcut is the problem

    https://jira.springsource.org/browse/SPR-6306

    Comment

    Working...
    X