Add info on intercepting static resource requests

Issue: SPR-10655
This commit is contained in:
Rossen Stoyanchev 2014-12-02 15:59:43 -05:00
parent ed4cd9947f
commit 7aa5e65235
3 changed files with 18 additions and 3 deletions

View File

@ -134,6 +134,13 @@ public interface WebMvcConfigurer {
* Add Spring MVC lifecycle interceptors for pre- and post-processing of
* controller method invocations. Interceptors can be registered to apply
* to all requests or be limited to a subset of URL patterns.
* <p><strong>Note</strong> that interceptors registered here only apply to
* controllers and not to resource handler requests. To intercept requests for
* static resources either declare a
* {@link org.springframework.web.servlet.handler.MappedInterceptor MappedInterceptor}
* bean or switch to advanced configuration mode by extending
* {@link org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
* WebMvcConfigurationSupport} and then override {@code resourceHandlerMapping}.
*/
void addInterceptors(InterceptorRegistry registry);

View File

@ -21,8 +21,16 @@ import org.springframework.web.context.request.WebRequestInterceptor;
import org.springframework.web.servlet.HandlerInterceptor;
/**
* Holds information about a HandlerInterceptor mapped to a path into the application.
* Provides a method to match a request path to the mapped path patterns.
* Contains a {@link HandlerInterceptor} along with include (and optionally
* exclude) path patterns to which the interceptor should apply. Also provides
* matching logic to test if the interceptor applies to a given request path.
*
* <p>A MappedInterceptor can be registered directly with any
* {@link org.springframework.web.servlet.handler.AbstractHandlerMethodMapping
* AbstractHandlerMethodMapping}. Furthermore, beans of type MappedInterceptor
* are automatically detected by {@code AbstractHandlerMethodMapping} (including
* ancestor ApplicationContext's) which effectively means the interceptor is
* registered "globally" with all handler mappings.
*
* @author Keith Donald
* @author Rossen Stoyanchev

View File

@ -563,7 +563,7 @@
Interceptors allow requests to be pre/post processed before/after handling.
Each inteceptor must implement the org.springframework.web.servlet.HandlerInterceptor or
org.springframework.web.context.request.WebRequestInterceptor interface.
The interceptors in this set are automatically configured on each registered HandlerMapping.
The interceptors in this set are automatically detected by every registered HandlerMapping.
The URI paths each interceptor applies to are configurable.
]]></xsd:documentation>
</xsd:annotation>