Package de.xima.fc.gui.model.form_theme
Class FormThemeElFinderExplorerSession
- java.lang.Object
-
- de.xima.fc.gui.model.form_theme.FormThemeElFinderExplorerSession
-
- All Implemented Interfaces:
Serializable
public final class FormThemeElFinderExplorerSession extends Object implements Serializable
Represents a session for the elfinder explorer, used by the UI for editing the files of afile system
. The session is usually bound to the lifecycle of a backing view scoped bean that is used for the UI view. The view scoped bean generates a unique UUID when its view scope begins. We then store a map of these sessions in the HTTP session, with the UUID as the key.The explorer session keeps a reference to the data that is required for the elFinder file explorer to work, such as the current file system and resource store manager. The lifecycle of the referenced objects should be bound to the backing view scoped bean.
Effectively, this is a workaround to share some data with the view scoped bean, as the bean that handles the request from elFinder must be
RequestScoped
. We use PrimeFaces' dynamic resource feature, and that does not support view scoped beans.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FileSystemElFinderConnector<?>
connector()
Shortcut formodel()
.FormThemeEditModeAdvancedModel.connector()
.ICommonFileSystemManager<FormThemeFileEntry>
fileSystemManager()
Shortcut formodel()
.FormThemeEditModeAdvancedModel.fileSystemManager()
.static FormThemeElFinderExplorerSession
findCurrentExplorerSession(String explorerSessionIdParamName)
Finds the explorer session for the current request, if any.FormThemeEditModeAdvancedModel
model()
Gets the view model to use with the current explorer session.static void
registerExplorerSession(javax.servlet.http.HttpSession httpSession, String explorerSessionId, FormThemeEditModeAdvancedModel model)
Registers the given content view with the explorer session for the given explorer session ID.IResourceStoreManager
resourceStoreManager()
Shortcut formodel()
.FormThemeEditModeAdvancedModel.resourceStoreManager()
.IDynamicResourceThumbnailRequestHandler<FormThemeFileEntry>
thumbnailRequestHandler()
static void
unregisterExplorerSession(javax.servlet.http.HttpSession session, String explorerSessionId)
Unregisters the explorer session with the given explorer session ID from the current HTTP session.
-
-
-
Method Detail
-
connector
public FileSystemElFinderConnector<?> connector()
Shortcut formodel()
.FormThemeEditModeAdvancedModel.connector()
.- Returns:
- The elFinder connector.
-
fileSystemManager
public ICommonFileSystemManager<FormThemeFileEntry> fileSystemManager()
Shortcut formodel()
.FormThemeEditModeAdvancedModel.fileSystemManager()
.- Returns:
- The file system.
-
model
public FormThemeEditModeAdvancedModel model()
Gets the view model to use with the current explorer session. It should be closed when the view scoped bean is destroyed.- Returns:
- The elFinder connector settings.
-
resourceStoreManager
public IResourceStoreManager resourceStoreManager()
Shortcut formodel()
.FormThemeEditModeAdvancedModel.resourceStoreManager()
.- Returns:
- The resource store manager.
-
thumbnailRequestHandler
public IDynamicResourceThumbnailRequestHandler<FormThemeFileEntry> thumbnailRequestHandler()
- Returns:
- The thumbnail request handler.
-
findCurrentExplorerSession
public static FormThemeElFinderExplorerSession findCurrentExplorerSession(String explorerSessionIdParamName)
Finds the explorer session for the current request, if any. The explorer session is stored in the HTTP session, and bound to the lifecycle of the view scoped bean. The explorer session ID is read from the URL parameter with the given name.- Parameters:
explorerSessionIdParamName
- The name of the URL parameter that contains the explorer session ID.- Returns:
- The explorer session, or null if none is found.
-
registerExplorerSession
public static void registerExplorerSession(javax.servlet.http.HttpSession httpSession, String explorerSessionId, FormThemeEditModeAdvancedModel model)
Registers the given content view with the explorer session for the given explorer session ID. This session ID can then e.g. be used to create an elfinder connector URL for editing the files via the elfinder file manager.Passing null for any of the required data will unregister the explorer session for the given explorer session ID.
- Parameters:
httpSession
- The current HTTP session.explorerSessionId
- The session ID for the explorer session, usually bound to the lifecycle of a view scoped bean.model
- The view model to associate with the session, or null to unregister the session.
-
unregisterExplorerSession
public static void unregisterExplorerSession(javax.servlet.http.HttpSession session, String explorerSessionId)
Unregisters the explorer session with the given explorer session ID from the current HTTP session.- Parameters:
session
- The current HTTP session.explorerSessionId
- The session ID for the explorer session, usually bound to the lifecycle of a view scoped bean.
-
-