Hi,
My application allows the users to select multiple checkbox or only one of them.If the user selects multiple then the xml files created are inside a zip file,but when the one is selected it does not creates the zip file but only the xml file.Firstly it allows the file to write and save in the server,after that it allows the user to save the file,by prompting the action(This is done by using the ServletOutputStream).
but the problem is that while writing only for a single xml it appends a special unicode character (<"Abc"/>) at the end of the xml file for which the file is not been able to open in the web browsers.
This is happining only incase of single selection and not for zip.

if (fileName.endsWith("zip")) {
fileName = "Abc.zip";
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "inline; filename=Abc.zip;");
} else {
response.setContentType("application/octet-stream");
fileName = "test.xml";
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
}

int number = fileInputStream.read();;
response.resetBuffer();

response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
final int bufferLength = BUFFER_SIZE;
response.setBufferSize(bufferLength);
// response.setContentLength(file.length());

// Write the data stream to the web browser

while (number != -1) {
servletOutputStream.write(number);
number = fileInputStream.read();
}

I am guessing there is some change needed in case of contentType and Header.
Any help will be really appreciated.Thanks in advance