Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring MVC Sharing same interceptor for multiple paths

Tags:

spring-mvc

I am using a WebContentInterceptor to enable long lived cache of static resources. We have them under 3 different paths though, css, js, and images.

Is there a way to share the interceptor bean between multiple mappings without putting them all under a shared path?

like image 366
Matt Avatar asked Sep 13 '11 13:09

Matt


1 Answers

I'd need more information to confirm that the setup is how I presume; but, have you tried...

<mvc:interceptors>
    <mvc:interceptor>
        <mvc:mapping path="/site/*" />
        <mvc:mapping path="/add/*" />
        <mvc:mapping path="/edit" />
        <bean class="com.test.MyInterceptor" />
    </mvc:interceptor>
</mvc:interceptors>
like image 161
smp7d Avatar answered Oct 13 '22 12:10

smp7d