Class UserPortalFilePreviewHelper
- java.lang.Object
-
- de.xima.fc.gui.helper.user_portal.UserPortalFilePreviewHelper
-
public final class UserPortalFilePreviewHelper extends Object
Helper for preview/download resource parameter handling and stream creation for user portal files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.primefaces.model.StreamedContentcreateDownloadContent(UserPortalFileViewModel file, String type, String userPortalContentType)static StringencodeDynamicResourceParams(javax.servlet.http.HttpServletRequest request, UserPortalFileViewModel model, String mimeType, String userPortalContentType)Encodes the parameters needed to serve the given file.static org.primefaces.model.StreamedContentgetFile(javax.servlet.http.HttpServletRequest request)Serves a file from a project, client resource, client template or portal entity.static booleanisPreviewableImage(UserPortalFileViewModel file)
-
-
-
Method Detail
-
encodeDynamicResourceParams
public static String encodeDynamicResourceParams(javax.servlet.http.HttpServletRequest request, UserPortalFileViewModel model, String mimeType, String userPortalContentType)
Encodes the parameters needed to serve the given file. Encrypts the parameters so that we do not, for example, expose the file path.- Parameters:
request- the current HTTP request, needed for storing the parameters in the sessionmodel- the file for which to create the parametersmimeType- the MIME type of the file, e.g. "image/png" or "application/pdf".userPortalContentType- the user portal content contentType of the file, e.g. "form", "tenantResource" or "tenantTemplate".- Returns:
- the encoded parameters to serve the file, or null if the parameters could not be created.
-
getFile
public static org.primefaces.model.StreamedContent getFile(javax.servlet.http.HttpServletRequest request)
Serves a file from a project, client resource, client template or portal entity.- Parameters:
request- the current HTTP request, needed for retrieving the parameters from the session- Returns:
- the streamed content for the file, or an empty content if the parameters could not be retrieved or were invalid.
-
createDownloadContent
public static org.primefaces.model.StreamedContent createDownloadContent(UserPortalFileViewModel file, String type, String userPortalContentType)
-
isPreviewableImage
public static boolean isPreviewableImage(UserPortalFileViewModel file)
-
-