Created
May 1, 2021 16:33
-
-
Save boudhayan-dev/38f2675e3514058270b59b5da6e33a09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) | |
throws ServletException, IOException { | |
// Lazily initialize the delegate if necessary. | |
Filter delegateToUse = this.delegate; | |
if (delegateToUse == null) { | |
synchronized (this.delegateMonitor) { | |
delegateToUse = this.delegate; | |
if (delegateToUse == null) { | |
WebApplicationContext wac = findWebApplicationContext(); | |
if (wac == null) { | |
throw new IllegalStateException("No WebApplicationContext found: " + | |
"no ContextLoaderListener or DispatcherServlet registered?"); | |
} | |
delegateToUse = initDelegate(wac); | |
} | |
this.delegate = delegateToUse; | |
} | |
} | |
// Let the delegate perform the actual doFilter operation. | |
invokeDelegate(delegateToUse, request, response, filterChain); | |
} | |
protected void invokeDelegate( | |
Filter delegate, ServletRequest request, ServletResponse response, FilterChain filterChain) | |
throws ServletException, IOException { | |
delegate.doFilter(request, response, filterChain); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment