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 assumed.getCurrentImage(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 yet.getIfExists(String url) getIfExists.getIiif()Retrieves the #IIIFUrlHandler, creates it if it doesn't exist yet.Return 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 yet.getMedia()Retrieves the #MediaHandler, creates it if it doesn't exist yet.getObjects3D.getPdf()Retrieves the #PdfHandler, creates it if it doesn't exist yet.Retrieves the #IIIFPresentationAPIHandler, creates it if it doesn't exist yet.Returns 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 exists.getRepresentativeThumbnail(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 found.Retrieves the #ThumbnailHandler, creates it if it doesn't exist yet.voidinit(Configuration config, AbstractApiUrlManager dataUrlManager, AbstractApiUrlManager contentUrlManager) Initialize for testing.booleanTests 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 otherwise.booleanisPublicUrl(String url) booleanisStaticImageUrl(String url) Tests whether the given url points to a static image resource within the current theme.booleanTests 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- viewer configuration to read settings fromdataUrlManager- URL manager for data (IIIF) API endpointscontentUrlManager- URL manager for content delivery endpoints
-
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- desired thumbnail width in pixelsheight- desired thumbnail height in pixels- 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- desired square thumbnail side length in pixels- 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- desired thumbnail width in pixelsheight- desired thumbnail height in pixels- 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- desired square thumbnail side length in pixels- 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- name of the page type determining image size and tiling- 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 URL handler instance
- Throws:
ViewerConfigurationException- if any.
-
getImages
Retrieves the #ImageHandler, creates it if it doesn't exist yet.- Returns:
- the image handler instance
-
getPdf
Retrieves the #PdfHandler, creates it if it doesn't exist yet.- Returns:
- the PDF handler instance
-
getThumbs
Retrieves the #ThumbnailHandler, creates it if it doesn't exist yet.- Returns:
- the thumbnail handler instance
-
getMedia
Retrieves the #MediaHandler, creates it if it doesn't exist yet.- Returns:
- the media handler instance
-
getObjects3D
getObjects3D.- Returns:
- the handler for 3D object delivery
-
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- base servlet path including hosttheme- 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- URL to test- 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 URI path to the static images folder of the active theme
- Throws:
ViewerConfigurationException- if any.
-
getIfExists
getIfExists.- Parameters:
url- URL string to wrap as optional- Returns:
- an optional containing the given String if it is non-empty, otherwise an empty optional
-
setThumbs
Setter for the fieldthumbs.- Parameters:
thumbs- the ThumbnailHandler instance to inject for testing
-
setImages
Setter for the fieldimages.- Parameters:
images- the ImageHandler instance to inject for testing
-
setPdf
Setter for the fieldpdf.- Parameters:
pdf- the PdfHandler instance to inject for testing
-
getCurrentImageDownloadUrl
-
getCurrentImageDownloadUrl
-