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 defaultVirusScanner
provider bundled with PrimeFaces. The implementation makes use of the VirusTotal Public API v2.0. It requiresCONTEXT_PARAM_KEY
to be specified.
-
-
Constructor Summary
Constructors Constructor Description VirusTotalReportScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createErrorMessage(UploadedFile file, org.json.JSONObject json)
protected void
handleBodyResponse(UploadedFile file, org.json.JSONObject json)
boolean
isEnabled()
Indicate whether thisVirusScanner
is enabled or not.protected URLConnection
openConnection(UploadedFile file)
void
scan(UploadedFile file)
Scan file using "/file/report" endpoint
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
Description copied from interface:VirusScanner
Indicate whether thisVirusScanner
is enabled or not.- Specified by:
isEnabled
in interfaceVirusScanner
- Returns:
true
if enabled,false
otherwise
-
scan
public void scan(UploadedFile file)
Scan file using "/file/report" endpoint- Specified by:
scan
in 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
-
-