Package org.primefaces.virusscan.impl
Class VirusTotalReportScanner
java.lang.Object
org.primefaces.virusscan.impl.VirusTotalReportScanner
- All Implemented Interfaces:
VirusScanner
This is the default
VirusScanner provider bundled with PrimeFaces.
The implementation makes use of the VirusTotal Public API v2.0.
It requires CONTEXT_PARAM_KEY to be specified.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateErrorMessage(UploadedFile file, org.json.JSONObject json) protected voidhandleBodyResponse(UploadedFile file, org.json.JSONObject json) booleanIndicate whether thisVirusScanneris enabled or not.protected URLConnectionopenConnection(UploadedFile file) voidscan(UploadedFile file) Scan file using "/file/report" endpoint
-
Constructor Details
-
VirusTotalReportScanner
public VirusTotalReportScanner()
-
-
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 "/file/report" endpoint- Specified by:
scanin interfaceVirusScanner- Parameters:
file- file to perform virus scan on- Throws:
VirusException- if a virus has been detected by the scanner
-
handleBodyResponse
-
createErrorMessage
-
openConnection
- Throws:
IOException
-