• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mimi-mapping for file download

 
taty gora
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When mimi-mapping element ( for example .xyz application) is included into depl. descriptor web.xml
Does it effect a file with some .xyz extention sent OUT with the resopnse?
Does it set the content type to the response , while sending a download file?
 
Ture Hefner
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Taty,
The mime-mapping doesn't directly set the content type of the response as far as I know. You can use the mime-mapping to decide what to use in ServletResponse.setContentType(String type) when you receive a GET request for a file with an extension that you have mapped.

How do you get the mime-type when you know the extension of the file that the client has requested? Use ServletContext.getMimeType(String file):

As far as I know, the servlet container uses your mime-mapping to maintain a map that is used to return values for the ServletContext.getMimeType() method and that is all the container uses that mime-mapping for. However, I could be wrong. I haven't seen any documentation about how it is used, from start to finish, in the real world and I have never used it in the real world.
 
taty gora
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ture!
make a lot of sense

T.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic