mirror of https://github.com/apache/jclouds.git
JCLOUDS-948: Filesystem Cache-Control support
This commit is contained in:
parent
01e10bba66
commit
82ad05e98e
|
@ -95,6 +95,7 @@ import com.google.common.primitives.Longs;
|
||||||
*/
|
*/
|
||||||
public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
|
|
||||||
|
private static final String XATTR_CACHE_CONTROL = "user.cache-control";
|
||||||
private static final String XATTR_CONTENT_DISPOSITION = "user.content-disposition";
|
private static final String XATTR_CONTENT_DISPOSITION = "user.content-disposition";
|
||||||
private static final String XATTR_CONTENT_ENCODING = "user.content-encoding";
|
private static final String XATTR_CONTENT_ENCODING = "user.content-encoding";
|
||||||
private static final String XATTR_CONTENT_LANGUAGE = "user.content-language";
|
private static final String XATTR_CONTENT_LANGUAGE = "user.content-language";
|
||||||
|
@ -326,6 +327,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
byteSource = Files.asByteSource(file);
|
byteSource = Files.asByteSource(file);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
String cacheControl = null;
|
||||||
String contentDisposition = null;
|
String contentDisposition = null;
|
||||||
String contentEncoding = null;
|
String contentEncoding = null;
|
||||||
String contentLanguage = null;
|
String contentLanguage = null;
|
||||||
|
@ -338,6 +340,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
Set<String> attributes = ImmutableSet.copyOf(view.list());
|
Set<String> attributes = ImmutableSet.copyOf(view.list());
|
||||||
|
|
||||||
|
cacheControl = readStringAttributeIfPresent(view, attributes, XATTR_CACHE_CONTROL);
|
||||||
contentDisposition = readStringAttributeIfPresent(view, attributes, XATTR_CONTENT_DISPOSITION);
|
contentDisposition = readStringAttributeIfPresent(view, attributes, XATTR_CONTENT_DISPOSITION);
|
||||||
contentEncoding = readStringAttributeIfPresent(view, attributes, XATTR_CONTENT_ENCODING);
|
contentEncoding = readStringAttributeIfPresent(view, attributes, XATTR_CONTENT_ENCODING);
|
||||||
contentLanguage = readStringAttributeIfPresent(view, attributes, XATTR_CONTENT_LANGUAGE);
|
contentLanguage = readStringAttributeIfPresent(view, attributes, XATTR_CONTENT_LANGUAGE);
|
||||||
|
@ -370,6 +373,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.payload(byteSource)
|
builder.payload(byteSource)
|
||||||
|
.cacheControl(cacheControl)
|
||||||
.contentDisposition(contentDisposition)
|
.contentDisposition(contentDisposition)
|
||||||
.contentEncoding(contentEncoding)
|
.contentEncoding(contentEncoding)
|
||||||
.contentLanguage(contentLanguage)
|
.contentLanguage(contentLanguage)
|
||||||
|
@ -397,6 +401,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
|
|
||||||
private void writeCommonMetadataAttr(UserDefinedFileAttributeView view, Blob blob) throws IOException {
|
private void writeCommonMetadataAttr(UserDefinedFileAttributeView view, Blob blob) throws IOException {
|
||||||
ContentMetadata metadata = blob.getMetadata().getContentMetadata();
|
ContentMetadata metadata = blob.getMetadata().getContentMetadata();
|
||||||
|
writeStringAttributeIfPresent(view, XATTR_CACHE_CONTROL, metadata.getCacheControl());
|
||||||
writeStringAttributeIfPresent(view, XATTR_CONTENT_DISPOSITION, metadata.getContentDisposition());
|
writeStringAttributeIfPresent(view, XATTR_CONTENT_DISPOSITION, metadata.getContentDisposition());
|
||||||
writeStringAttributeIfPresent(view, XATTR_CONTENT_ENCODING, metadata.getContentEncoding());
|
writeStringAttributeIfPresent(view, XATTR_CONTENT_ENCODING, metadata.getContentEncoding());
|
||||||
writeStringAttributeIfPresent(view, XATTR_CONTENT_LANGUAGE, metadata.getContentLanguage());
|
writeStringAttributeIfPresent(view, XATTR_CONTENT_LANGUAGE, metadata.getContentLanguage());
|
||||||
|
|
Loading…
Reference in New Issue