Skip to main content

Bug with URLConnection ?

No replies
i30817
Offline
Joined: 2006-05-02

I'm trying to use the URLConnection mime type map to recognize file types, since that is easier than lots of || sequences. Just get the mime type using:
String mime = URLConnection.getFileNameMap().getContentTypeFor(file)

and then :
mime.endswith("html") or whatever.

Weeeell.
In linux the rtf mime type is not recognized (for some stupid reason). I guess i can't count on a consistent multiple platform of mimetypes for this map then?

This is pretty bad since mime types are the only way to drop multi-format text for example (no extension).