Spring 4.2: CacheControl does not allow header without storage and without cache

We are moving the project from spring -web 4.1.8 to 4.2.3 and must replace the legacy code

WebContentInterceptor interceptor = new WebContentInterceptor(); interceptor.setCacheSeconds(0); interceptor.setUseExpiresHeader(true); interceptor.setUseCacheControlHeader(true); interceptor.setUseCacheControlNoStore(true); 

using the new CacheControl and interceptor.setCacheControl(cacheControl) .

But with the new CacheControl API CacheControl you cannot use noStore() and noCache() together, as these methods return a new CacheControl and do not update existing ones.

Any idea why this is so, and how the Cache-Control header can be set to no-store, no-cache using the new API?

+5
source share

Source: https://habr.com/ru/post/1237551/


All Articles