Improve efficiency for non wrapped response for cache-contro
This commit is contained in:
parent
b836c2fda3
commit
c0b0f80567
|
@ -181,7 +181,13 @@ public class ResourceService
|
||||||
|
|
||||||
public void setCacheControl(HttpField cacheControl)
|
public void setCacheControl(HttpField cacheControl)
|
||||||
{
|
{
|
||||||
_cacheControl = cacheControl;
|
if (cacheControl == null)
|
||||||
|
_cacheControl = null;
|
||||||
|
if (cacheControl.getHeader() != HttpHeader.CACHE_CONTROL)
|
||||||
|
throw new IllegalArgumentException("!Cache-Control");
|
||||||
|
_cacheControl = cacheControl instanceof PreEncodedHttpField
|
||||||
|
? cacheControl
|
||||||
|
: new PreEncodedHttpField(cacheControl.getHeader(), cacheControl.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getGzipEquivalentFileExtensions()
|
public List<String> getGzipEquivalentFileExtensions()
|
||||||
|
@ -828,12 +834,12 @@ public class ResourceService
|
||||||
{
|
{
|
||||||
Response r = (Response)response;
|
Response r = (Response)response;
|
||||||
r.putHeaders(content, contentLength, _etags);
|
r.putHeaders(content, contentLength, _etags);
|
||||||
HttpFields f = r.getHttpFields();
|
HttpFields fields = r.getHttpFields();
|
||||||
if (_acceptRanges && !response.containsHeader(HttpHeader.ACCEPT_RANGES.asString()))
|
if (_acceptRanges && !fields.contains(HttpHeader.ACCEPT_RANGES))
|
||||||
f.put(ACCEPT_RANGES);
|
fields.put(ACCEPT_RANGES);
|
||||||
|
|
||||||
if (_cacheControl != null && !response.containsHeader(HttpHeader.CACHE_CONTROL.asString()))
|
if (_cacheControl != null && !fields.contains(HttpHeader.CACHE_CONTROL))
|
||||||
f.put(_cacheControl);
|
fields.put(_cacheControl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue