Package io.wcm.handler.media
Class MediaArgs
- java.lang.Object
-
- io.wcm.handler.media.MediaArgs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMediaArgs.ImageSizesImage sizes for responsive image handling.static classMediaArgs.MediaFormatOptionMedia format to be applied on media processing.static classMediaArgs.PictureSourcePicture source for responsive image handling.static classMediaArgs.WidthOptionWidth value with mandatory flag.
-
Constructor Summary
Constructors Constructor Description MediaArgs()Default constructorMediaArgs(@NotNull MediaFormat @NotNull ... mediaFormats)MediaArgs(@NotNull String @NotNull ... mediaFormatNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description @NotNull MediaArgsaltText(String value)Allows to specify a custom alternative text that is to be used instead of the one defined in the the media lib item@NotNull MediaArgsautoCrop(boolean value)MediaArgsclone()Custom clone-method forMediaArgs@NotNull MediaArgscontentDispositionAttachment(boolean value)@NotNull MediaArgsdownload(boolean value)@NotNull MediaArgsdragDropSupport(DragDropSupport value)Drag&Drop support for media builder.@NotNull MediaArgsdummyImage(boolean value)@NotNull MediaArgsdummyImageUrl(String value)@NotNull MediaArgsdynamicMediaDisabled(boolean value)booleanequals(Object obj)@NotNull MediaArgsfileExtension(String value)@NotNull MediaArgsfileExtensions(@NotNull String @Nullable ... values)@NotNull MediaArgsfixedDimension(long widthValue, long heightValue)Use fixed dimensions instead of width from media format or original image@NotNull MediaArgsfixedHeight(long value)Use fixed height instead of width from media format or original image@NotNull MediaArgsfixedWidth(long value)Use fixed width instead of width from media format or original imageStringgetAltText()DragDropSupportgetDragDropSupport()Drag&Drop support for media builder.StringgetDummyImageUrl()String[]getFileExtensions()longgetFixedHeight()Use fixed height instead of width from media format or original imagelonggetFixedWidth()Use fixed width instead of width from media format or original imageMediaArgs.ImageSizesgetImageSizes()IPERatioCustomizegetIPERatioCustomize()String[]getMediaFormatNames()Returns list of media formats to resolve to.MediaArgs.MediaFormatOption[]getMediaFormatOptions()Gets list of media formats to resolve to.MediaFormat[]getMediaFormats()Returns list of media formats to resolve to.MediaArgs.PictureSource[]getPictureSources()@NotNull org.apache.sling.api.resource.ValueMapgetProperties()Custom properties that my be used by application-specific markup builders or processors.io.wcm.handler.url.UrlModegetUrlMode()inthashCode()@NotNull MediaArgsimageSizes(MediaArgs.ImageSizes value)@NotNull MediaArgsincludeAssetThumbnails(boolean value)@NotNull MediaArgsincludeAssetWebRenditions(boolean value)@NotNull MediaArgsipeRatioCustomize(IPERatioCustomize value)booleanisAutoCrop()booleanisContentDispositionAttachment()booleanisDownload()booleanisDummyImage()booleanisDynamicMediaDisabled()booleanisIncludeAssetThumbnails()BooleanisIncludeAssetWebRenditions()booleanisMediaFormatsMandatory()Deprecated.Please check the mandatory flag for each media format individually viagetMediaFormatOptions()@NotNull MediaArgsmandatoryMediaFormatNames(@NotNull String @Nullable ... names)Sets list of media formats to resolve to.@NotNull MediaArgsmandatoryMediaFormats(@NotNull MediaFormat @Nullable ... values)Sets list of media formats to resolve to.@NotNull MediaArgsmediaFormat(MediaFormat value)Sets a single media format to resolve to.@NotNull MediaArgsmediaFormatName(String name)Sets a single media format to resolve to.@NotNull MediaArgsmediaFormatNames(@NotNull String @Nullable ... names)Sets list of media formats to resolve to.@NotNull MediaArgsmediaFormatOptions(@NotNull MediaArgs.MediaFormatOption @Nullable ... values)Sets list of media formats to resolve to.@NotNull MediaArgsmediaFormats(@Nullable MediaFormat @Nullable ... values)Sets list of media formats to resolve to.@NotNull MediaArgsmediaFormatsMandatory(boolean value)The "mandatory" flag of all media format options is set to to the given value.@NotNull MediaArgspictureSources(@NotNull MediaArgs.PictureSource @Nullable ... value)@NotNull MediaArgsproperties(Map<String,Object> map)Custom properties that my be used by application-specific markup builders or processors.@NotNull MediaArgsproperty(String key, Object value)Custom properties that my be used by application-specific markup builders or processors.StringtoString()@NotNull MediaArgsurlMode(io.wcm.handler.url.UrlMode value)
-
-
-
Constructor Detail
-
MediaArgs
public MediaArgs()
Default constructor
-
MediaArgs
public MediaArgs(@NotNull @NotNull MediaFormat @NotNull ... mediaFormats)- Parameters:
mediaFormats- Media formats
-
MediaArgs
public MediaArgs(@NotNull @NotNull String @NotNull ... mediaFormatNames)- Parameters:
mediaFormatNames- Media format names
-
-
Method Detail
-
getMediaFormats
public MediaFormat[] getMediaFormats()
Returns list of media formats to resolve to. IfisMediaFormatsMandatory()is false, the first rendition that matches any of the given media format is returned. If it is set to true, for each media format given a rendition has to be resolved and returned. If not all renditions could be resolved the media is marked as invalid (but the partial resolved renditions are returned anyway).- Returns:
- Media formats
-
mediaFormats
@NotNull public @NotNull MediaArgs mediaFormats(@Nullable @Nullable MediaFormat @Nullable ... values)
Sets list of media formats to resolve to.- Parameters:
values- Media formats- Returns:
- this
-
mandatoryMediaFormats
@NotNull public @NotNull MediaArgs mandatoryMediaFormats(@NotNull @NotNull MediaFormat @Nullable ... values)
Sets list of media formats to resolve to. AdditionallyisMediaFormatsMandatory()is set to true.- Parameters:
values- Media formats- Returns:
- this
-
mediaFormat
@NotNull public @NotNull MediaArgs mediaFormat(MediaFormat value)
Sets a single media format to resolve to.- Parameters:
value- Media format- Returns:
- this
-
isMediaFormatsMandatory
@Deprecated public boolean isMediaFormatsMandatory()
Deprecated.Please check the mandatory flag for each media format individually viagetMediaFormatOptions()Checks if all media format options have the "mandatory" flag set. If none or not all of them have the flag set, false is returned.- Returns:
- true if all media format options have the "mandatory" flag set.
-
mediaFormatsMandatory
@NotNull public @NotNull MediaArgs mediaFormatsMandatory(boolean value)
The "mandatory" flag of all media format options is set to to the given value.- Parameters:
value- Resolving of all media formats is mandatory.- Returns:
- this
-
getMediaFormatNames
public String[] getMediaFormatNames()
Returns list of media formats to resolve to. SeegetMediaFormatNames()for details.- Returns:
- Media format names
-
mediaFormatNames
@NotNull public @NotNull MediaArgs mediaFormatNames(@NotNull @NotNull String @Nullable ... names)
Sets list of media formats to resolve to.- Parameters:
names- Media format names.- Returns:
- this
-
mandatoryMediaFormatNames
@NotNull public @NotNull MediaArgs mandatoryMediaFormatNames(@NotNull @NotNull String @Nullable ... names)
Sets list of media formats to resolve to. AdditionallyisMediaFormatsMandatory()is set to true.- Parameters:
names- Media format names.- Returns:
- this
-
mediaFormatName
@NotNull public @NotNull MediaArgs mediaFormatName(String name)
Sets a single media format to resolve to.- Parameters:
name- Media format name- Returns:
- this
-
getMediaFormatOptions
public MediaArgs.MediaFormatOption[] getMediaFormatOptions()
Gets list of media formats to resolve to.- Returns:
- Media formats with mandatory flag
-
mediaFormatOptions
@NotNull public @NotNull MediaArgs mediaFormatOptions(@NotNull @NotNull MediaArgs.MediaFormatOption @Nullable ... values)
Sets list of media formats to resolve to.- Parameters:
values- Media formats with mandatory flag- Returns:
- this
-
isAutoCrop
public boolean isAutoCrop()
- Returns:
- Enables "auto-cropping" mode. If no matching rendition is found it is tried to generate one by automatically cropping another one.
-
autoCrop
@NotNull public @NotNull MediaArgs autoCrop(boolean value)
- Parameters:
value- Enables "auto-cropping" mode. If no matching rendition is found it is tried to generate one by automatically cropping another one.- Returns:
- this
-
getFileExtensions
public String[] getFileExtensions()
- Returns:
- File extensions
-
fileExtensions
@NotNull public @NotNull MediaArgs fileExtensions(@NotNull @NotNull String @Nullable ... values)
- Parameters:
values- File extensions- Returns:
- this
-
fileExtension
@NotNull public @NotNull MediaArgs fileExtension(String value)
- Parameters:
value- File extension- Returns:
- this
-
getUrlMode
public io.wcm.handler.url.UrlMode getUrlMode()
- Returns:
- URL mode
-
urlMode
@NotNull public @NotNull MediaArgs urlMode(io.wcm.handler.url.UrlMode value)
- Parameters:
value- URS mode- Returns:
- this
-
getFixedWidth
public long getFixedWidth()
Use fixed width instead of width from media format or original image- Returns:
- Fixed width
-
fixedWidth
@NotNull public @NotNull MediaArgs fixedWidth(long value)
Use fixed width instead of width from media format or original image- Parameters:
value- Fixed width- Returns:
- this
-
getFixedHeight
public long getFixedHeight()
Use fixed height instead of width from media format or original image- Returns:
- Fixed height
-
fixedHeight
@NotNull public @NotNull MediaArgs fixedHeight(long value)
Use fixed height instead of width from media format or original image- Parameters:
value- Fixed height- Returns:
- this
-
fixedDimension
@NotNull public @NotNull MediaArgs fixedDimension(long widthValue, long heightValue)
Use fixed dimensions instead of width from media format or original image- Parameters:
widthValue- Fixed widthheightValue- Fixed height- Returns:
- this
-
isDownload
public boolean isDownload()
- Returns:
- Accept only media formats that have the download flag set.
-
download
@NotNull public @NotNull MediaArgs download(boolean value)
- Parameters:
value- Accept only media formats that have the download flag set.- Returns:
- this
-
isContentDispositionAttachment
public boolean isContentDispositionAttachment()
- Returns:
- Whether to set a "Content-Disposition" header to "attachment" for forcing a "Save as" dialog on the client
-
contentDispositionAttachment
@NotNull public @NotNull MediaArgs contentDispositionAttachment(boolean value)
- Parameters:
value- Whether to set a "Content-Disposition" header to "attachment" for forcing a "Save as" dialog on the client- Returns:
- this
-
getAltText
public String getAltText()
- Returns:
- The custom alternative text that is to be used instead of the one defined in the the media lib item
-
altText
@NotNull public @NotNull MediaArgs altText(String value)
Allows to specify a custom alternative text that is to be used instead of the one defined in the the media lib item- Parameters:
value- Custom alternative text. If null or empty, the default alt text from media library is used.- Returns:
- this
-
isDummyImage
public boolean isDummyImage()
- Returns:
- If set to true, media handler never returns a dummy image. Otherwise this can happen in edit mode.
-
dummyImage
@NotNull public @NotNull MediaArgs dummyImage(boolean value)
- Parameters:
value- If set to false, media handler never returns a dummy image. Otherwise this can happen in edit mode.- Returns:
- this
-
getDummyImageUrl
public String getDummyImageUrl()
- Returns:
- Url of custom dummy image. If null default dummy image is used.
-
dummyImageUrl
@NotNull public @NotNull MediaArgs dummyImageUrl(String value)
- Parameters:
value- Url of custom dummy image. If null default dummy image is used.- Returns:
- this
-
isIncludeAssetThumbnails
public boolean isIncludeAssetThumbnails()
- Returns:
- If set to true, thumbnail generated by the DAM asset workflows (with cq5dam.thumbnail prefix) are taken into account as well when trying to resolve the media request.
-
includeAssetThumbnails
@NotNull public @NotNull MediaArgs includeAssetThumbnails(boolean value)
- Parameters:
value- If set to true, thumbnail generated by the DAM asset workflows (with cq5dam.thumbnail prefix) are taken into account as well when trying to resolve the media request.- Returns:
- this
-
isIncludeAssetWebRenditions
public Boolean isIncludeAssetWebRenditions()
- Returns:
- If set to true, web renditions generated by the DAM asset workflows (with cq5dam.web prefix) are taken into account as well when trying to resolve the media request. If null, the default setting applies from the media handler configuration.
-
includeAssetWebRenditions
@NotNull public @NotNull MediaArgs includeAssetWebRenditions(boolean value)
- Parameters:
value- If set to true, web renditions generated by the DAM asset workflows (with cq5dam.web prefix) are taken into account as well when trying to resolve the media request.- Returns:
- this
-
getImageSizes
public MediaArgs.ImageSizes getImageSizes()
- Returns:
- Image sizes for responsive image handling
-
imageSizes
@NotNull public @NotNull MediaArgs imageSizes(MediaArgs.ImageSizes value)
- Parameters:
value- Image sizes for responsive image handling- Returns:
- this
-
getPictureSources
public MediaArgs.PictureSource[] getPictureSources()
- Returns:
- Picture sources for responsive image handling
-
pictureSources
@NotNull public @NotNull MediaArgs pictureSources(@NotNull @NotNull MediaArgs.PictureSource @Nullable ... value)
- Parameters:
value- Picture sources for responsive image handling- Returns:
- this
-
isDynamicMediaDisabled
public boolean isDynamicMediaDisabled()
- Returns:
- If set to true, dynamic media support is disabled even when enabled on the instance.
-
dynamicMediaDisabled
@NotNull public @NotNull MediaArgs dynamicMediaDisabled(boolean value)
- Parameters:
value- If set to true, dynamic media support is disabled even when enabled on the instance.- Returns:
- this
-
getDragDropSupport
public DragDropSupport getDragDropSupport()
Drag&Drop support for media builder.- Returns:
- Drag&Drop support
-
dragDropSupport
@NotNull public @NotNull MediaArgs dragDropSupport(DragDropSupport value)
Drag&Drop support for media builder.- Parameters:
value- Drag&Drop support- Returns:
- this
-
getIPERatioCustomize
public IPERatioCustomize getIPERatioCustomize()
- Returns:
- Whether to set customized list of IPE cropping ratios.
-
ipeRatioCustomize
@NotNull public @NotNull MediaArgs ipeRatioCustomize(IPERatioCustomize value)
- Parameters:
value- Whether to set customized list of IPE cropping ratios.- Returns:
- this
-
properties
@NotNull public @NotNull MediaArgs properties(Map<String,Object> map)
Custom properties that my be used by application-specific markup builders or processors.- Parameters:
map- Property map. Is merged with properties already set.- Returns:
- this
-
property
@NotNull public @NotNull MediaArgs property(String key, Object value)
Custom properties that my be used by application-specific markup builders or processors.- Parameters:
key- Property keyvalue- Property value- Returns:
- this
-
getProperties
@NotNull public @NotNull org.apache.sling.api.resource.ValueMap getProperties()
Custom properties that my be used by application-specific markup builders or processors.- Returns:
- Value map
-
-