Update docs on HandlerInterceptor

Closes gh-32729
This commit is contained in:
rstoyanchev
2024-05-13 11:38:58 +01:00
parent 5288504ceb
commit 09f23a578b
3 changed files with 32 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@ import org.springframework.web.method.HandlerMethod;
*
* <p>A HandlerInterceptor gets called before the appropriate HandlerAdapter
* triggers the execution of the handler itself. This mechanism can be used
* for a large field of preprocessing aspects, e.g. for authorization checks,
* or common handler behavior like locale or theme changes. Its main purpose
* is to allow for factoring out repetitive handler code.
* for a large field of preprocessing aspects, or common handler behavior
* like locale or theme changes. Its main purpose is to allow for factoring
* out repetitive handler code.
*
* <p>In an asynchronous processing scenario, the handler may be executed in a
* separate thread while the main thread exits without rendering or invoking the
@@ -63,6 +63,12 @@ import org.springframework.web.method.HandlerMethod;
* forms and GZIP compression. This typically shows when one needs to map the
* filter to certain content types (e.g. images), or to all requests.
*
* <p><strong>Note:</strong> Interceptors are not ideally suited as a security
* layer due to the potential for a mismatch with annotated controller path matching.
* Generally, we recommend using Spring Security, or alternatively a similar
* approach integrated with the Servlet filter chain, and applied as early as
* possible.
*
* @author Juergen Hoeller
* @since 20.06.2003
* @see HandlerExecutionChain#getInterceptors