Class ClamDaemonScanner

java.lang.Object
org.primefaces.virusscan.impl.ClamDaemonScanner
All Implemented Interfaces:
VirusScanner

public class ClamDaemonScanner extends Object implements 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 Details

    • ClamDaemonScanner

      public ClamDaemonScanner()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Description copied from interface: VirusScanner
      Indicate whether this VirusScanner is enabled or not.
      Specified by:
      isEnabled in interface VirusScanner
      Returns:
      true if enabled, false otherwise
    • scan

      public void scan(UploadedFile file)
      Scan file using send to ClamAV service running at host and port over TCP.
      Specified by:
      scan in interface VirusScanner
      Parameters:
      file - file to perform virus scan on
      Throws:
      VirusException - if a virus has been detected by the scanner
    • createErrorMessage

      protected String createErrorMessage(UploadedFile file, String response)
    • getClamAvClient

      public ClamDaemonClient getClamAvClient()
      Returns a new ClamAvClient which can be overridden in unit tests.
      Returns:
      the ClamDaemonClient