Package de.xima.fc.web.common.mime
Class ExtensionCheckFacade
java.lang.Object
de.xima.fc.web.common.mime.ExtensionCheckFacade
Processes the extension check (i.e. the verification of a file's extension against its content) and reports the
results.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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()
-
Method Details
-
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
- Returns:
- the current (system property based) extension check settings
-
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
-