Class InlineMediaSource


  • @Model(adaptables={org.apache.sling.api.SlingHttpServletRequest.class,org.apache.sling.api.resource.Resource.class})
    @ProviderType
    public final class InlineMediaSource
    extends MediaSource
    Default implementation for media references to binaries stored in a node inside the content page.
    • Field Detail

      • ID

        @NotNull
        public static final @NotNull java.lang.String ID
        Media source ID
        See Also:
        Constant Field Values
    • Constructor Detail

      • InlineMediaSource

        public InlineMediaSource()
    • Method Detail

      • getId

        @NotNull
        public @NotNull java.lang.String getId()
        Specified by:
        getId in class MediaSource
        Returns:
        Media source ID
      • accepts

        public boolean accepts​(@NotNull
                               @NotNull MediaRequest mediaRequest)
        Description copied from class: MediaSource
        Checks whether a media request can be handled by this media source
        Overrides:
        accepts in class MediaSource
        Parameters:
        mediaRequest - Media request
        Returns:
        true if this media source can handle the given media request
      • accepts

        public boolean accepts​(@Nullable
                               @Nullable java.lang.String mediaRef)
        Description copied from class: MediaSource
        Checks whether a media request string can be handled by this media source
        Specified by:
        accepts in class MediaSource
        Parameters:
        mediaRef - Media request string
        Returns:
        true if this media source can handle the given media request
      • getPrimaryMediaRefProperty

        @Nullable
        public @Nullable java.lang.String getPrimaryMediaRefProperty()
        Specified by:
        getPrimaryMediaRefProperty in class MediaSource
        Returns:
        Name of the property in which the primary media request is stored
      • resolveMedia

        @NotNull
        public @NotNull Media resolveMedia​(@NotNull
                                           @NotNull Media media)
        Description copied from class: MediaSource
        Resolves a media request
        Specified by:
        resolveMedia in class MediaSource
        Parameters:
        media - Media metadata
        Returns:
        Resolved media metadata. Never null.
      • enableMediaDrop

        public void enableMediaDrop​(@NotNull
                                    @NotNull io.wcm.handler.commons.dom.HtmlElement element,
                                    @NotNull
                                    @NotNull MediaRequest mediaRequest)
        Description copied from class: MediaSource
        Create a drop area for given HTML element to enable drag and drop of DAM assets from content finder to this element.
        Specified by:
        enableMediaDrop in class MediaSource
        Parameters:
        element - Html element
        mediaRequest - Media request to detect media args and property names
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object