GeeCON Prague 2014*
The moose likes Servlets and the fly likes HTML Content being added when File download is written to response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "HTML Content being added when File download is written to response" Watch "HTML Content being added when File download is written to response" New topic
Author

HTML Content being added when File download is written to response

surya naidu
Ranch Hand

Joined: Jul 26, 2010
Posts: 32
Hi
I have a servlet in which I want to download a file at the end
I have code which gets the response and writes a Bytearray to the response
I am able to Download the file which is written,However there is some HTML content being appended at the end.
The HTML content which is being appended is the header and footer of the application
Is there anyway i can filter out this data,Any suggestion?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
The solution isn't to remove that HTML, the solution is to not send it in the first place. You need to ensure that file downloads are not being being handled the same way as page requests, i.e. that no header and footer is sent for them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML Content being added when File download is written to response