Package org.primefaces.virusscan.impl
Class VirusTotalReportScanner
- java.lang.Object
-
- org.primefaces.virusscan.impl.VirusTotalReportScanner
-
- All Implemented Interfaces:
VirusScanner
public class VirusTotalReportScanner extends Object implements VirusScanner
This is the defaultVirusScannerprovider bundled with PrimeFaces. The implementation makes use of the VirusTotal Public API v2.0. It requiresCONTEXT_PARAM_KEYto be specified.
-
-
Constructor Summary
Constructors Constructor Description VirusTotalReportScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringcreateErrorMessage(UploadedFile file, org.json.JSONObject json)protected voidhandleBodyResponse(UploadedFile file, org.json.JSONObject json)booleanisEnabled()Indicate whether thisVirusScanneris enabled or not.protected URLConnectionopenConnection(UploadedFile file)voidscan(UploadedFile file)Scan file using "/file/report" endpoint
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Description copied from interface:VirusScannerIndicate whether thisVirusScanneris enabled or not.- Specified by:
isEnabledin interfaceVirusScanner- Returns:
trueif enabled,falseotherwise
-
scan
public void scan(UploadedFile file)
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
protected void handleBodyResponse(UploadedFile file, org.json.JSONObject json)
-
createErrorMessage
protected String createErrorMessage(UploadedFile file, org.json.JSONObject json)
-
openConnection
protected URLConnection openConnection(UploadedFile file) throws IOException
- Throws:
IOException
-
-