I am able to see the blob contents in the client window but the file does not show as attachment which is my main purpose-- to give the user the option either to open the file or to save the file on his machine. I am also setting the setHeader as attachment , but nothing happens....and sometimes it shows a dialog box to open my jsp file itself rather than the desired file... sending you the code ..please help

File file1 = new File("c:\\Test.java");
byte[] buffer = new byte[(int)file1.length()];
BufferedInputStream is = new BufferedInputStream(new FileInputStream(file1));
is.read(buffer, 0, (int)file1.length());

ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(buffer, 0, (int)file1.length());

byte[] pass = baos.toByteArray();
response.setHeader("Content-Desposition", "attachment;filename=untitled.java");

//Send content to Browser
ServletOutputStream servletOut = response.getOutputStream();