tags:

views:

19

answers:

1

hello

in my project i call a web service to retrieve files from a content managment system. A method of the web service does a search on the system and returns me some metadata about the file i whish to download : an id, the file name , the mime type and other informations. The problem is that sometimes the file name is empty and the method returns the string : "#" . So i've decided to name it using the id , but i don't know how to set the extension . I've searched the web and i've found there are a lot of library to get the mimetype from the file extension, but none to do the opposite , the last idea is to use the Tomcat mime types defined inside server's web.xml (my application's web.xml contains only app specific settings). Can someone direct me to an article or tutorial about how to read settings from web.xml ? (there are built in libraries like for reading .propeties file ? )

thank you in advance

A: 

The best option is store mimetype together file.

But if you could not, you can use this library: http://jmimemagic.sourceforge.net/index.html

angelcervera