Skip to content

spring-web: Cannot create Cache-Control: no-store, no-cache with new CacheControl API [SPR-13780] #18354

@spring-projects-issues

Description

@spring-projects-issues

Thomas Tardy opened SPR-13780 and commented

We are migrating a project from spring-web 4.1.8 to 4.2.3 and need to replace the deprecated code

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

with the usage of the new CacheControl and interceptor.setCacheControl(cacheControl).

But with the new API of CacheControl, you cannot use noStore() and noCache() together as these methods return a new CacheControl and aren't updating the existing ones.

As it is still required to set the Cache-Control header to no-store, no-cache to disable caching in different browsers, this should be possible.


Affects: 4.2.3

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions