Hi,
I'm trying to get binary data in response like this:
DataSource fileContent = getFileContent();
DataHandler dataHandler = new DataHandler(fileContent);
response.setFile(dataHandler);
and in my DataSource implementation I'm just returning InputStream
(simplified ;-)):
public InputStream getInputStream() throws IOException {
return getUrlContent(url); // this doesnt work
// return new ByteArrayInputStream("short
text".getBytes("UTF-8")); // this works
}
getUrlContent works - it returns content of specified url. When I try
to return just short text, everything works ok. but when I try to send
something bigger, I get following error message:
Binary data detected! Click 'DOWNLOAD BINARY FILE NOW' button to download file.
WARNING!!!!
===========
Be careful what you download. If the file contains a virus, you will
infect your machine!!
HIT 'BACK' when done.
How can I handle with this?
Thanks in advance, Vaclav Balak