Package com.psddev.dari.util
Class UrlStorageItem
java.lang.Object
com.psddev.dari.util.AbstractStorageItem
com.psddev.dari.util.UrlStorageItem
- All Implemented Interfaces:
com.psddev.dari.util.SettingsBackedObject,StorageItem
Storage item backed by a URL.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.psddev.dari.util.StorageItem
StorageItem.Static -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringStorage name assigned to all instances by default.Fields inherited from class com.psddev.dari.util.AbstractStorageItem
BASE_URL_SETTING, BASE_URL_SUB_SETTING, BASE_URLS_SUB_SETTING, HASH_ALGORITHM_SUB_SETTING, HTTP_HEADERS, SECURE_BASE_URL_SUB_SETTING, SECURE_BASE_URLS_SUB_SETTINGFields inherited from interface com.psddev.dari.util.StorageItem
DEFAULT_STORAGE_SETTING, SETTING_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStreamCreates the data stream.voidDeletes the actual data.static StringfetchContentType(String url) Makes an http connection to a given URL string with the goal of determining the content type.getPath()Returns the path that can uniquely identify this item within the storage system.booleanReturnstrueif this item in storage.booleanChecks if the asset has private access permissions in a storage system.protected voidsaveData(InputStream data) Saves the givendatastream.voidSets the path that can uniquely identify this item within the storage system.voidsetStorage(String storage) Sets the storage name.Methods inherited from class com.psddev.dari.util.AbstractStorageItem
createPublicUrl, delete, equals, getBaseUrl, getBaseUrls, getContentType, getData, getHashAlgorithm, getMetadata, getPublicUrl, getSecureBaseUrl, getSecureBaseUrls, getSecurePublicUrl, getStorage, getUrl, hashCode, initialize, registerListener, resetListeners, save, setBaseUrl, setBaseUrls, setContentType, setData, setHashAlgorithm, setMetadata, setSecureBaseUrl, setSecureBaseUrls, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.psddev.dari.util.StorageItem
getHttpHeaders, updatePermission
-
Field Details
-
DEFAULT_STORAGE
Storage name assigned to all instances by default.- See Also:
-
-
Constructor Details
-
UrlStorageItem
public UrlStorageItem()Creates an instance.
-
-
Method Details
-
setStorage
Description copied from interface:StorageItemSets the storage name.- Specified by:
setStoragein interfaceStorageItem- Overrides:
setStoragein classAbstractStorageItem
-
setPath
Description copied from interface:StorageItemSets the path that can uniquely identify this item within the storage system.- Specified by:
setPathin interfaceStorageItem- Overrides:
setPathin classAbstractStorageItem
-
getPath
Description copied from interface:StorageItemReturns the path that can uniquely identify this item within the storage system.- Specified by:
getPathin interfaceStorageItem- Overrides:
getPathin classAbstractStorageItem
-
createData
Description copied from class:AbstractStorageItemCreates the data stream.- Specified by:
createDatain classAbstractStorageItem- Throws:
IOException
-
saveData
Description copied from class:AbstractStorageItemSaves the givendatastream.- Specified by:
saveDatain classAbstractStorageItem
-
deleteData
Description copied from class:AbstractStorageItemDeletes the actual data.- Specified by:
deleteDatain classAbstractStorageItem- Throws:
IOException
-
isInStorage
public boolean isInStorage()Description copied from interface:StorageItemReturnstrueif this item in storage. -
isPrivate
public boolean isPrivate()Description copied from interface:StorageItemChecks if the asset has private access permissions in a storage system. -
fetchContentType
Makes an http connection to a given URL string with the goal of determining the content type. If the value isn't known, or if the connection fails, a default value as defined inObjectUtils.DEFAULT_CONTENT_TYPEis returned.- Parameters:
url- String.- Returns:
- "content-type" header value String or default.
-