Class ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry extends IFileSystemEntry<?>, FileEntity extends IFileEntity<?,?>>
java.lang.Object
de.xima.fc.gui.elfinder.ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity>
- Type Parameters:
Entry- Common super type of all file system entries.FileEntity- The type of the file entity.
- Enclosing class:
ElFinderDynamicResourceFileEntityThumbnails
public static final class ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry extends IFileSystemEntry<?>, FileEntity extends IFileEntity<?,?>>
extends Object
A builder for a thumbnail request handler for file system entries from a
ICommonFileSystem, with initial
data from a IFileEntity stored in a database. This is the builder for the URL creator, see also
ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder.
ElFinderDynamicResourceFileEntityThumbnails.UrlGeneratorBuilder creates a URL for the thumbnail, using PrimeFaces' dynamic resource feature, see
DynamicContentSrcBuilder and DynamicContentHandler.
ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder creates a handler for processing requests to the dynamic resource servlet. It
finds or generates the thumbnail image and writes it to the response.
The thumbnail may come from two sources: either directly from the file, in case the file was not
yet changed; or directly from the ICommonFileSystem
in case the file has unsaved changes.
- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a request handler for handling thumbnail requests.fileEntityReader(ISerializableFunction<Long, FileEntity> fileEntityReader) Sets the reader to use for reading the file entity from the given file entity ID.fileEntityReader(Class<FileEntity> fileEntityType) Sets the reader to use for reading the file entity from the given file entity ID.paramNameFileEntityId(String paramNameFileEntityId) Sets the name of the file entity ID parameter.paramNameFileEntryHash(String paramNameFileEntryHash) Sets the name of the file entry hash parameter.paramNameThumbnailConstraints(String paramNameThumbnailConstraints) Sets the name of the thumbnail constraints' parameter.self()tempFileCreator(ISerializableThrowingSupplier<Path> tempFileCreator) Sets the creator for temporary files that will hold the thumbnail content.thumbnailGenerator(IImageThumbnailGenerator thumbnailGenerator) Sets the thumbnail generator to use for generating thumbnails.
-
Method Details
-
build
Builds a request handler for handling thumbnail requests. The request handler could be called by a URL for the dynamic resource servlet, seeElFinderDynamicResourceFileEntityThumbnails.UrlGeneratorBuilder. Subsequent changes to the builder will not affect the request handler.- Returns:
- The request handler.
-
fileEntityReader
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> fileEntityReader(Class<FileEntity> fileEntityType) Sets the reader to use for reading the file entity from the given file entity ID. Uses the default DAO for the given entity type to read the file entity, with the system entity context. The file entity readers is used when a thumbnail request for a file entity is made. Defaults to a no-op implementation that returns null.- Parameters:
fileEntityType- The type of the file entity to read.- Returns:
- This builder for chaining method calls.
-
fileEntityReader
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> fileEntityReader(ISerializableFunction<Long, FileEntity> fileEntityReader) Sets the reader to use for reading the file entity from the given file entity ID. Used when a thumbnail request for a file entity is made. Defaults to a no-op implementation that returns null.- Parameters:
fileEntityReader- The reader to use.- Returns:
- This builder for chaining method calls.
-
tempFileCreator
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> tempFileCreator(ISerializableThrowingSupplier<Path> tempFileCreator) Sets the creator for temporary files that will hold the thumbnail content. When not given, defaults to a creator that creates temporary files via the system's default mechanism.- Parameters:
tempFileCreator- The creator for creating temporary files.- Returns:
- This builder for chaining method calls.
-
thumbnailGenerator
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> thumbnailGenerator(IImageThumbnailGenerator thumbnailGenerator) Sets the thumbnail generator to use for generating thumbnails. Defaults to a generic implementation.- Parameters:
thumbnailGenerator- The thumbnail generator to use.- Returns:
- This builder for chaining method calls.
-
self
protected ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> self() -
paramNameFileEntityId
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> paramNameFileEntityId(String paramNameFileEntityId) Sets the name of the file entity ID parameter. Defaults toelfinder_feid.- Parameters:
paramNameFileEntityId- The name of the file entity ID parameter.- Returns:
- This builder for chaining method calls.
-
paramNameFileEntryHash
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> paramNameFileEntryHash(String paramNameFileEntryHash) Sets the name of the file entry hash parameter. Defaults toelfinder_feh.- Parameters:
paramNameFileEntryHash- The name of the file entry hash parameter.- Returns:
- This builder for chaining method calls.
-
paramNameThumbnailConstraints
public ElFinderDynamicResourceFileEntityThumbnails.RequestHandlerBuilder<Entry, FileEntity> paramNameThumbnailConstraints(String paramNameThumbnailConstraints) Sets the name of the thumbnail constraints' parameter. This parameter is added to request a certain set of constraints on the thumbnail, such as a target width. Defaults toelfinder_tc.- Parameters:
paramNameThumbnailConstraints- Parameter name for the thumbnail constraints.- Returns:
- This builder for chaining method calls.
-