@Override
    public URL getResource(String path) {

        // check if file-based path
        if (path.startsWith("file:")) {
            File file = new File(path.substring(5));
            if (!file.exists()) { return null; }

            try { return file.toURI().toURL(); }
            catch (MalformedURLException exception) { return null; }
        }

        // check if classpath-based path
        else if (path.startsWith("classpath:")) {
            int idx = 10;
            while (path.charAt(idx) == '/') { idx++; }
            return Thread.currentThread().getContextClassLoader()
                .getResource(path.substring(idx));
        }

        // check if URL-based path
        else {
            try { return new URL(path); }
            catch (MalformedURLException e1) {
                // default to file or class path
                File file = new File(path);
                if (file.exists()) {
                    try { return file.toURI().toURL(); }
                    catch (MalformedURLException e2) { return null; }
                }
                else {
                    int idx = 0;
                    while (path.charAt(idx) == '/') { idx++; }
                    return Thread.currentThread().getContextClassLoader()
                        .getResource(path.substring(idx));
                }
            }
        }
    }