Package org.primefaces.virusscan.impl
Class ClamDaemonScanner
java.lang.Object
org.primefaces.virusscan.impl.ClamDaemonScanner
- All Implemented Interfaces:
VirusScanner
ClamAV Daemon custom
VirusScanner provider bundled with PrimeFaces.
Streams the file over TCP to a ClamAV service running on host:port.
It requires
CONTEXT_PARAM_HOST and CONTEXT_PARAM_PORT to be specified.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateErrorMessage(UploadedFile file, String response) Returns a new ClamAvClient which can be overridden in unit tests.booleanIndicate whether thisVirusScanneris enabled or not.voidscan(UploadedFile file) Scan file using send to ClamAV service running at host and port over TCP.
-
Constructor Details
-
ClamDaemonScanner
public ClamDaemonScanner()
-
-
Method Details
-
isEnabled
public boolean isEnabled()Description copied from interface:VirusScannerIndicate whether thisVirusScanneris enabled or not.- Specified by:
isEnabledin interfaceVirusScanner- Returns:
trueif enabled,falseotherwise
-
scan
Scan file using send to ClamAV service running at host and port over TCP.- Specified by:
scanin interfaceVirusScanner- Parameters:
file- file to perform virus scan on- Throws:
VirusException- if a virus has been detected by the scanner
-
createErrorMessage
-
getClamAvClient
Returns a new ClamAvClient which can be overridden in unit tests.- Returns:
- the
ClamDaemonClient
-