protected URLConnection openConnection(UploadedFile file) throws IOException {
        HttpURLConnection connection;

        try {
            ExternalContext ctx = FacesContext.getCurrentInstance().getExternalContext();
            String key = ctx.getInitParameter(CONTEXT_PARAM_KEY);

            String hash = LangUtils.md5Hex(file.getContent());
            URL url = new URI(String.format(API_ENDPOINT, EscapeUtils.forUriComponent(key), EscapeUtils.forUriComponent(hash))).toURL();
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.connect();
        }
        catch (IOException | URISyntaxException e) {
            throw new FacesException(e);
        }

        int code = connection.getResponseCode();
        switch (code) {
            case 200:
                // OK
                break;
            case 204:
                throw new FacesException("Request rate limit exceeded. You are making more requests than allowed. "
                            + "You have exceeded one of your quotas (minute, daily or monthly). Daily quotas are reset every day at 00:00 UTC.");
            case 400:
                throw new FacesException("Bad request. Your request was somehow incorrect. "
                            + "This can be caused by missing arguments or arguments with wrong values.");
            case 403:
                throw new FacesException("Forbidden. You don't have enough privileges to make the request. "
                            + "You may be doing a request without providing an API key or you may be making a request "
                            + "to a Private API without having the appropriate privileges.");
            default:
                throw new FacesException("Unexpected HTTP code " + code + " calling Virus Total web service.");
        }

        return connection;
    }
Scan file using "/file/report" endpoint
@throws VirusException if a virus has been detected by the scanner
primefaces/src/main/java/org/primefaces/virusscan/impl/VirusTotalReportScanner.java