Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get content type of .jar file to download that file  RSS feed

 
namrata jain
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



String contentType = fi.getContentType(); gives text/plain when my file is.txt file and gives image/jpeg when my file is .jpeg file but when my file is .jar or .docx it will return application/octet-stream and application/vnd.openxmlformats-officedocument.wordprocessingml.document respictively so what to do to get exact mime type please help me..
 
K. Tsang
Bartender
Posts: 3630
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From googling a bit, the following are 3 acceptable MIME types for jar files:
application/java-archive
application/x-jar
application/x-java-jar

Note that none of these are "official" MIME types.

 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are lots of options, most of them discussed in http://www.rgagnon.com/javadetails/java-0487.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!