Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP problem

Status
Not open for further replies.

globos

Programmer
Nov 8, 2000
260
FR
Hi.
I would like to develop a Java servlet which sends a file in response. The final goal is to view the downloaded file on the Web browser.
I know this could be done in HTTP, but if someone can tell me, it would be great.
 
globos,

> Java servlet which sends a file

Yes, that is what a servlet does generally.

> goal is to view the downloaded file on the Web browser.

Yes again, the servlet sends an HTML file and the browser displays it. This is nothing new, what is the question. s-)

-pete

 
OK.

Sorry palbano, I was not very explicit, but I do not want to send a HTML file, it could be a Word file, or PDF, anykind of file. I have found a way to perform this, I set the content-type to the type of the file and copy the file in the response (ServletOutputStream). Maybe there exist a way to set the good MIME type with the good file type directly. I don't know.

 
globos,

> Maybe there exist a way to set the good MIME type with the good
> file type directly. I don't know.

Yes, you are correct. You also need to know if the browser and machine can 'accept' the MIME type. Here is a link to an RFC that discusses this issue:


Good luck
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top