Interface Asset

  • All Superinterfaces:
    org.apache.sling.api.adapter.Adaptable

    @ProviderType
    public interface Asset
    extends org.apache.sling.api.adapter.Adaptable
    Represents a media item that is referenced via a MediaRequest and resolved via MediaHandler. It cannot be rendered directly, but contains references to renditions depending on MediaArgs.
    • Method Detail

      • getTitle

        @Nullable
        @Nullable String getTitle()
        Returns:
        Title of media item
      • getAltText

        @Nullable
        @Nullable String getAltText()
        Returns:
        Alternative text for media item
      • getDescription

        @Nullable
        @Nullable String getDescription()
        Returns:
        Description for this media item
      • getPath

        @NotNull
        @NotNull String getPath()
        Internal path pointing to media item, if it is stored in the JCR repository.
        Returns:
        Repository path
      • getProperties

        @NotNull
        @NotNull org.apache.sling.api.resource.ValueMap getProperties()
        Returns:
        Properties of media item
      • getDefaultRendition

        @Nullable
        @Nullable Rendition getDefaultRendition()
        Get the default rendition without specifying and media args.
        Returns:
        Rendition instance or null if no rendition exists
      • getRendition

        @Nullable
        @Nullable Rendition getRendition​(@NotNull
                                         @NotNull MediaArgs mediaArgs)
        Get the first rendition that matches the given media args.
        Parameters:
        mediaArgs - Media args to filter specific media formats or extensions.
        Returns:
        Rendition for the first matching rendition or null if no match found.
      • getImageRendition

        @Nullable
        @Nullable Rendition getImageRendition​(@NotNull
                                              @NotNull MediaArgs mediaArgs)
        Get the first image rendition that matches the given media args.
        Parameters:
        mediaArgs - Media args to filter specific media formats or extensions.
        Returns:
        Rendition for the first matching rendition or null if no match found.
      • getFlashRendition

        @Deprecated
        @Nullable
        @Nullable Rendition getFlashRendition​(@NotNull
                                              @NotNull MediaArgs mediaArgs)
        Deprecated.
        Flash support is deprecated
        Get the first flash rendition that matches the given media args.
        Parameters:
        mediaArgs - Media args to filter specific media formats or extensions.
        Returns:
        Rendition for the first matching rendition or null if no match found.
      • getDownloadRendition

        @Nullable
        @Nullable Rendition getDownloadRendition​(@NotNull
                                                 @NotNull MediaArgs mediaArgs)
        Get the first download rendition that matches the given media args.
        Parameters:
        mediaArgs - Media args to filter specific media formats or extensions.
        Returns:
        Rendition for the first matching rendition or null if no match found.