users@glassfish.java.net

Re: response.getOutputStream doesnt seem to be working correctly

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 14 Nov 2006 10:12:08 -0500

Hi Derick,

if you add:

<jvm-options>-Dcom.sun.enterprise.server.ss.ASQuickStartup=false</jvm-options>

does it makes a difference? Difference or not, can you file a bug?

Thanks

-- Jeanfrancois

derick.potgieter_at_gmail.com wrote:
> Hi All,
>
> This is based on my other mail....please can anyone explain to me why this doesnt work on glassfish but runs perfectly on 8.x
>
> byte[] bytes = null;
>
> bytes = JasperRunManager.runReportToPdf(jasperReport, parameters, getConnection());
> resp.setContentType("application/pdf");
> resp.setHeader("Content-Disposition","attachment; filename=report.pdf");
> resp.setContentLength(bytes.length);
> //This generates a 23kb file...that doesnt display data in acrobat
> BufferedOutputStream bos = new BufferedOutputStream(resp.getOutputStream());
> bos.write(bytes,0,bytes.length);
> bos.flush();
> bos.close();
>
> //This generates a 23kb file...that displays the correct data in acrobat
> BufferedOutputStream bosFile = new BufferedOutputStream(new FileOutputStream("c:\\test3.pdf"));
> bosFile.write(bytes,0,bytes.length);
> bosFile.flush();
> bosFile.close();
>
> The thing that bugs me is that the files are different when i view them, thought wordpad. But as you can see, they are produced with the same byte[].
>
> Please anyone...i`m going nuts.
>
> Rgds
> Derick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>