Class StorageItem.Static

java.lang.Object
com.psddev.dari.util.StorageItem.Static
Enclosing interface:
StorageItem

public static final class StorageItem.Static extends Object
Storage item utility methods.

The factory methods, create() and createUrl(java.lang.String), use settings to construct instances.

  • Constructor Details

    • Static

      public Static()
  • Method Details

    • createIn

      public static StorageItem createIn(String storage)
      Creates an item in the given storage.
    • create

      public static StorageItem create()
      Creates an item in the default storage.
    • createUrl

      public static UrlStorageItem createUrl(String url)
      Creates a one-off storage item backed by the given url.
    • getStorages

      public static Set<String> getStorages()
      Returns an unmodifiable set of all storage names.
    • copy

      public static StorageItem copy(StorageItem item, String newStorage) throws IOException
      Copies the given item into the given newStorage system and returns the newly created item.
      Throws:
      IOException
    • addMetadata

      public static void addMetadata(StorageItem item, String key, String value)
      Adds the metadata with the given key and value to the given item.
    • removeMetadata

      public static void removeMetadata(StorageItem item, String key, String value)
      Removes the metadata with the given key and value from the given item.
    • removeAllMetadata

      public static void removeAllMetadata(StorageItem item, String key)
      Removes all metadata associated with the given key from the given item.
    • resetListeners

      public static void resetListeners(StorageItem item)
    • getPlainResource

      @Deprecated(since="5.0.0", forRemoval=true) public static StorageItem getPlainResource(String storage, javax.servlet.ServletContext servletContext, String servletPath)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use Cdn.getUrl(String) instead.
      Finds the resource at the given servletPath within the given servletContext, stores it in the given storage, and returns the storage item that represents it.
      Parameters:
      storage - Nullable (to indicate default storage).
    • getGzippedResource

      @Deprecated(since="5.0.0", forRemoval=true) public static StorageItem getGzippedResource(String storage, javax.servlet.ServletContext servletContext, String servletPath)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use Cdn.getUrl(String) instead.
      Finds and gzips the resource at the at the given servletPath within the given servletContext, stores it in the given storage, and returns the storage item that represents it.
      Parameters:
      storage - Nullable (to indicate default storage).