Consistent handling of null header values in HttpHeaders

Issue: SPR-17588
This commit is contained in:
Juergen Hoeller
2018-12-12 11:16:45 +01:00
parent 4b4503085a
commit 5bbbc82e19
6 changed files with 69 additions and 52 deletions

View File

@@ -177,10 +177,7 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
@Override
public ServerResponse.BodyBuilder cacheControl(CacheControl cacheControl) {
String ccValue = cacheControl.getHeaderValue();
if (ccValue != null) {
this.headers.setCacheControl(cacheControl.getHeaderValue());
}
this.headers.setCacheControl(cacheControl);
return this;
}

View File

@@ -345,11 +345,9 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
}
// Apply cache settings, if any
if (getCacheControl() != null) {
String value = getCacheControl().getHeaderValue();
if (value != null) {
exchange.getResponse().getHeaders().setCacheControl(value);
}
CacheControl cacheControl = getCacheControl();
if (cacheControl != null) {
exchange.getResponse().getHeaders().setCacheControl(cacheControl);
}
// Check the media type for the resource