You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Vaclav Balak <sh...@gmail.com> on 2009/11/23 16:03:10 UTC

'Binary data detected' problem

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