Package io.goobi.viewer.managedbeans
Class ImageDeliveryBean
java.lang.Object
io.goobi.viewer.managedbeans.ImageDeliveryBean
- All Implemented Interfaces:
Serializable
@Named("imageDelivery")
@SessionScoped
public class ImageDeliveryBean
extends Object
implements Serializable
Provides methods for creation all urls for media delivery (images and other) Examples:
- imageDelivery.thumbs.thumbnailUrl(pyhsicalElement[, width, height])
- imageDelivery.thumbs.thumbnailUrl(structElement[, width, height])
- imageDelivery.thumbs.thumbnailUrl(solrDocument[, width, height])
- imageDelivery.thumbs.thumbnailUrl(cmsMediaItem[, width, height])
- imageDelivery.thumbs.squareThumbnailUrl(pyhsicalElement[, size])
- imageDelivery.thumbs.squareThumbnailUrl(structElement[, size])
- imageDelivery.thumbs.squareThumbnailUrl(solrDocument[, size])
- imageDelivery.images.imageUrl(pyhsicalElement[, pageType])
- imageDelivery.pdf.pdfUrl(structElement[, pyhsicalElement[, more physicalElements...]])
- imageDelivery.media.mediaUrl(mimeType, pi, filename)
- Author:
- Florian Alpers
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the url to the image of the current page: Either a IIIF manifest if available, or a full image url For image size and tiling ingormationPageType.viewImageis assumedgetCurrentImage(String pageType) Returns the url to the image of the current page: Either a IIIF image information if available, or a full image url The given pageType affects image size and tiling suggestions for IIIF image information.getCurrentImageDownloadUrl(int width, int height, String format) Returns the default size thumbnail url of the current page (according to theViewManagerfor a square thumbnail image.getCurrentPageSquareThumbnail(int size) Returns a thumbnail url of the current page (according to theViewManagerfor a square thumbnail image of the given size.Returns the default size thumbnail url of the current page (according to theViewManager.getCurrentPageThumbnail(int width, int height) Returns a thumbnail url of the current page (according to theViewManagerof the given width/height.Retrieves the #WatermarkHandler, creates it if it doesn't exist yetgetIfExists(String url) getIfExists.getIiif()Retrieves the #IIIFUrlHandler, creates it if it doesn't exist yetReturn the URL to the IIIF manifest of the current work, if it exists.Return the URL to the IIIF manifest of the current page, if it exists.Retrieves the #ImageHandler, creates it if it doesn't exist yetgetMedia()Retrieves the #MediaHandler, creates it if it doesn't exist yetgetObjects3D.getPdf()Retrieves the #PdfHandler, creates it if it doesn't exist yetRetrieves the #IIIFPresentationAPIHandler, creates it if it doesn't exist yetReturns the default size thumbnail url of the current top level document (according to theViewManagerfor a square thumbnail image.getRepresentativeSquareThumbnail(int size) Returns a thumbnail url of the current top level document (according to theViewManagerfor a square thumbnail image of the given size.Returns the default size thumbnail url of the current top level document (according to theViewManagerReturns an empty string if no current document existsgetRepresentativeThumbnail(int width, int height) Returns a thumbnail url of the current top level document (according to theViewManagerwith the given width/height.static StringgetStaticImagesPath(String servletPath, String theme) Retrieves the url path to the viewer image resource folder.Returns the url path to the static images folder of the viewer theme (or the viewer itself if no theme is foundRetrieves the #ThumbnailHandler, creates it if it doesn't exist yetvoidinit(Configuration config, AbstractApiUrlManager dataUrlManager, AbstractApiUrlManager contentUrlManager) Initialize for testingbooleanTests whether the given url points to a cms media file - i.e. any file within the configured cms media pathbooleanisExternalUrl(String urlString) Returns true if the given String denotes an absolute url that is not a file url, false otherwisebooleanisPublicUrl(String url) booleanisStaticImageUrl(String url) Tests whether the given url points to a static image resource within the current themebooleanTests whether the given url points to a temporary media file - i.e. any file within the configured temp media pathvoidsetImages(ImageHandler images) Setter for the fieldimages.voidsetPdf(PdfHandler pdf) Setter for the fieldpdf.voidsetThumbs(ThumbnailHandler thumbs) Setter for the fieldthumbs.
-
Constructor Details
-
ImageDeliveryBean
public ImageDeliveryBean()
-
-
Method Details
-
init
public void init(Configuration config, AbstractApiUrlManager dataUrlManager, AbstractApiUrlManager contentUrlManager) Initialize for testing- Parameters:
config- aConfigurationobject.dataUrlManager-contentUrlManager-
-
getRepresentativeThumbnail
Returns the default size thumbnail url of the current top level document (according to theViewManagerReturns an empty string if no current document exists- Returns:
- The representative thumbnail for the current top docStruct element
-
getRepresentativeThumbnail
Returns a thumbnail url of the current top level document (according to theViewManagerwith the given width/height. Returns an empty string if no current document exists- Parameters:
width- a int.height- a int.- Returns:
- The representative thumbnail for the current top docStruct element
-
getRepresentativeSquareThumbnail
Returns the default size thumbnail url of the current top level document (according to theViewManagerfor a square thumbnail image. Returns an empty string if no current document exists- Returns:
- The representative thumbnail for the current top docStruct element
-
getRepresentativeSquareThumbnail
Returns a thumbnail url of the current top level document (according to theViewManagerfor a square thumbnail image of the given size. Returns an empty string if no current document exists- Parameters:
size- a int.- Returns:
- The representative thumbnail for the current top docStruct element
-
getCurrentPageThumbnail
Returns the default size thumbnail url of the current page (according to theViewManager. Returns an empty string if no current page exists- Returns:
- The thumbnail of the current page
-
getCurrentPageThumbnail
Returns a thumbnail url of the current page (according to theViewManagerof the given width/height. Returns an empty string if no current page exists- Parameters:
width- a int.height- a int.- Returns:
- The thumbnail of the current page
-
getCurrentPageSquareThumbnail
Returns the default size thumbnail url of the current page (according to theViewManagerfor a square thumbnail image. Returns an empty string if no current page exists- Returns:
- The thumbnail of the current page
-
getCurrentPageSquareThumbnail
Returns a thumbnail url of the current page (according to theViewManagerfor a square thumbnail image of the given size. Returns an empty string if no current page exists- Parameters:
size- a int.- Returns:
- The thumbnail of the current page
-
getCurrentImage
Returns the url to the image of the current page: Either a IIIF manifest if available, or a full image url For image size and tiling ingormationPageType.viewImageis assumed- Returns:
- The url to the image of the current page: Either a IIIF manifest if available, or a full image url
-
getCurrentImage
Returns the url to the image of the current page: Either a IIIF image information if available, or a full image url The given pageType affects image size and tiling suggestions for IIIF image information. If the given pageType does not match any known pageType, an empty String is returned- Parameters:
pageType- aStringobject.- Returns:
- The url to the image of the current page for the current pageType: Either a IIIF manifest if available, or a full image url
-
getIiifManifest
Return the URL to the IIIF manifest of the current work, if it exists. Otherwise return empty String- Returns:
- the manifest url
-
getIiifPageManifest
Return the URL to the IIIF manifest of the current page, if it exists. Otherwise return empty String- Returns:
- the manifest url
-
getIiif
Retrieves the #IIIFUrlHandler, creates it if it doesn't exist yet- Returns:
- the iiif
- Throws:
ViewerConfigurationException- if any.
-
getImages
Retrieves the #ImageHandler, creates it if it doesn't exist yet- Returns:
- the images
-
getPdf
Retrieves the #PdfHandler, creates it if it doesn't exist yet- Returns:
- the pdf
-
getThumbs
Retrieves the #ThumbnailHandler, creates it if it doesn't exist yet- Returns:
- the thumbs
-
getMedia
Retrieves the #MediaHandler, creates it if it doesn't exist yet- Returns:
- the media
-
getObjects3D
getObjects3D.
- Returns:
- a
Object3DHandlerobject.
-
getPresentation
Retrieves the #IIIFPresentationAPIHandler, creates it if it doesn't exist yet- Returns:
- the IIIF presentation handler
-
isExternalUrl
Returns true if the given String denotes an absolute url that is not a file url, false otherwise- Parameters:
urlString- the string to test- Returns:
- whether the given string denotes to an external url resource
- Throws:
ViewerConfigurationException- if any.
-
getStaticImagesPath
Retrieves the url path to the viewer image resource folder. Ith the theme is given, the image resource folder within the theme is returned- Parameters:
servletPath- aStringobject.theme- The name of the theme housing the images. If this is null or empty, the images are taken from the viewer core- Returns:
- The url to the images folder in resources (possibly in the given theme)
-
isCmsUrl
Tests whether the given url points to a cms media file - i.e. any file within the configured cms media path- Parameters:
url- The url to test- Returns:
- true if the url points to a cms media file
- Throws:
ViewerConfigurationException- if any.
-
isTempUrl
Tests whether the given url points to a temporary media file - i.e. any file within the configured temp media path- Parameters:
url- The url to test- Returns:
- true if the url points to a temp media file
- Throws:
ViewerConfigurationException- if any.
-
isPublicUrl
- Parameters:
url-- Returns:
- true if given url is cms or temp url; false otherwise
- Throws:
ViewerConfigurationException
-
isStaticImageUrl
Tests whether the given url points to a static image resource within the current theme- Parameters:
url- the url to test- Returns:
- true if the url points to a static image resource within the current theme
- Throws:
ViewerConfigurationException- if any.
-
getStaticImagesURI
Returns the url path to the static images folder of the viewer theme (or the viewer itself if no theme is found- Returns:
- the staticImagesURI
- Throws:
ViewerConfigurationException- if any.
-
getIfExists
getIfExists.
- Parameters:
url- aStringobject.- Returns:
- an optional containing the given String if it is non-empty, otherwise an empty optional
-
setThumbs
Setter for the field
thumbs.- Parameters:
thumbs- the thumbs to set
-
setImages
Setter for the field
images.- Parameters:
images- the images to set
-
setPdf
Setter for the field
pdf.- Parameters:
pdf- the pdf to set
-
getCurrentImageDownloadUrl
-
getCurrentImageDownloadUrl
-