What is the best approach to prevent opening some file types

Some binaries are not meant to be opened by text editor at all

[original thread by amiramw]

You can customize FileResourceResolver to reject some URIs or return a too large resource.