public static <T extends HttpServletRequest> FileUploadChunkDecoder<T> getFileUploadChunkDecoder(T request) {
        PrimeApplicationContext pfContext = PrimeApplicationContext.getCurrentInstance(request.getServletContext());
        FileUploadDecoder decoder = pfContext.getFileUploadDecoder();
        if (!(decoder instanceof FileUploadChunkDecoder)) {
            throw new FacesException("Chunk decoder not supported");
        }

        return (FileUploadChunkDecoder<T>) decoder;
    }
Converts a JavaScript regular expression like '/(\.|\/)(gif|jpeg|jpg|png)$/i'
to the Java usable format '(\\.|\\/)(gif|jpeg|jpg|png)$'
@param jsRegex the client side JavaScript regex
@return the Java converted version of the regex
primefaces/src/main/java/org/primefaces/util/FileUploadUtils.java