Package de.xima.fc.web.common.mime
Class ExtensionCheckFacade
- java.lang.Object
-
- de.xima.fc.web.common.mime.ExtensionCheckFacade
-
public final class ExtensionCheckFacade extends Object
Processes the extension check (i.e. the verification of a file's extension against its content) and reports the results.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isNotProcessable(org.apache.commons.fileupload.FileItem fileItem)
static MalwareScanReport
reportExtensionMismatch(org.apache.commons.fileupload.FileItem fileItem)
Performs the extension check and creates a report if the check fails.static ExtensionCheckSettings
settings()
static Function<String,Set<String>>
systemMimeMapper()
-
-
-
Method Detail
-
isNotProcessable
public static boolean isNotProcessable(org.apache.commons.fileupload.FileItem fileItem)
- Parameters:
fileItem
- A file item to check.- Returns:
- true, if the provided file item cannot be processed by the extension check (e.g. because it has no name)
-
settings
public static ExtensionCheckSettings settings()
- Returns:
- the current (system property based) extension check settings
-
systemMimeMapper
public static Function<String,Set<String>> systemMimeMapper()
- Returns:
- the MIME mapping functionality provided by the system (based on default and user-defined mappings)
-
reportExtensionMismatch
public static MalwareScanReport reportExtensionMismatch(org.apache.commons.fileupload.FileItem fileItem)
Performs the extension check and creates a report if the check fails. In case of unexpected problems, corresponding log entries are written to the system protocol.- Parameters:
fileItem
- the file item to process (must not be null)- Returns:
- the check's result, either a description of the failed check wrapped by a malware scan report or null, if the extension matched the detected content type
-
-