Fixes #808

I borrowed some code from `org.springframework.util.ResourceUtils`, because they handle several jar protocols properly