I am trying to filter some url pattern to caching.
What I have attempted is put some codes into WebSecurityConfigurerAdapter
implementation.
@O
What about having multiple WebSecurityConfigurerAdapters? One adapter could have cache controls for certain URLs and another one will not have cache control enabled for those URLs.
I solved this with Filter
.
Below is part of my implementation of AbstractAnnotationConfigDispatcherServletInitializer
. In onStartup
method override.
FilterRegistration.Dynamic springSecurityFilterChain = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy());
if(springSecurityFilterChain != null){
springSecurityFilterChain.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/render/*", "/service/*");
// I removed pattern url "/image/*" :)
}
What I have done is remove /image/*
from MappingUrlPatterns.
Thanks for your answers!