@@ -71,29 +71,26 @@ The following listing shows pseudo code of `DelegatingFilterProxy`:
71
71
.`DelegatingFilterProxy` Pseudo Code
72
72
====
73
73
.Java
74
- [source,java,role="primary",subs="+quotes,+macros" ]
74
+ [source,java,role="primary"]
75
75
----
76
76
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
77
- // Lazily get Filter that was registered as a Spring Bean
78
- // For the example in <<servlet-delegatingfilterproxy-figure>> `delegate` is an instance of __Bean Filter~0~__
79
- Filter delegate = getFilterBean(someBeanName);
80
- // delegate work to the Spring Bean
81
- delegate.doFilter(request, response);
77
+ Filter delegate = getFilterBean(someBeanName); // <1>
78
+ delegate.doFilter(request, response); // <2>
82
79
}
83
80
----
84
81
85
82
.Kotlin
86
- [source,kotlin,role="secondary",subs="+quotes,+macros" ]
83
+ [source,kotlin,role="secondary"]
87
84
----
88
85
fun doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain) {
89
- // Lazily get Filter that was registered as a Spring Bean
90
- // For the example in <<servlet-delegatingfilterproxy-figure>> `delegate` is an instance of __Bean Filter~0~__
91
- val delegate: Filter = getFilterBean(someBeanName)
92
- // delegate work to the Spring Bean
93
- delegate.doFilter(request, response)
86
+ val delegate: Filter = getFilterBean(someBeanName) // <1>
87
+ delegate.doFilter(request, response) // <2>
94
88
}
95
89
----
96
90
====
91
+ <1> Lazily get Filter that was registered as a Spring Bean.
92
+ For the example in <<servlet-delegatingfilterproxy-figure>> `delegate` is an instance of __Bean Filter~0~__.
93
+ <2> Delegate work to the Spring Bean.
97
94
98
95
Another benefit of `DelegatingFilterProxy` is that it allows delaying looking up `Filter` bean instances.
99
96
This is important because the container needs to register the `Filter` instances before the container can start up.
0 commit comments