File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes servletOutputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servletOutputStream" Watch "servletOutputStream" New topic


carlos sanchez
Ranch Hand

Joined: Jan 29, 2003
Posts: 45
I'm using a servlet to extract files from a content management app. People click the link and call my servlet that sets the response.setContentType to image/jpg , problem is that I get the Open From location or download to file box.
I've tried with gif, png and pdf and it works correctly. What's the problem?

Don't ever let your computer know you're in a hurry! :nono:
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The bit you have missed is that the correct mime type is image/jpeg
Although you may wish to store the file as something.jpg, you should always check if the mime type is different from the file extension.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: servletOutputStream
It's not a secret anymore!