struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Joseph" <thomas.jos...@kottsoftware.com>
Subject Re: Action called multiple times
Date Tue, 11 Jul 2006 13:53:27 GMT
Hi Martin,

I am delegating the pdf generation from the action class to a different
class, that uses itext to generate PDF, which inturn provides the bytestream
to the action class. Action Class writes these bytes to the browser and then
flushes the stream.

Here is the sample code for your reference..

// body of the execute method
{
...
...
    try {

        PDFDelegate delegate = new PDFDelegate();
        baos = (ByteArrayOutputStream)delegate.generatePDF(hashMapParams);

        response.setContentLength(baos.size());

        response.setHeader("Content-disposition", " inline;
filename=Document.pdf");

        ServletOutputStream sos = response.getOutputStream();
        baos.writeTo(sos);

        sos.flush();
    }
    catch (Exception e) {
    }
}

To add up, I noticed this problem when I was in debug mode in eclipse 3.0. I
use JBoss 3.2.3.

Thanks

Thomas Joseph

From: "Martin Gainty" <mgainty@hotmail.com>

> Thomas Joseph-
>
> How are you generating the PDF?
>
> Martin --
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please
notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
>
>
>
> ----- Original Message -----
> From: "Thomas Joseph" <thomas.joseph@kottsoftware.com>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Tuesday, July 11, 2006 1:29 AM
> Subject: Action called multiple times
>
>
> > Hi all,
> >
> > I have got a strange problem. My action class generates PDF, and writes
on
> > the the response and fushes it, but I can see that this action is
getting
> > called multiple times (2-5 times). I have cheked my struts-config to be
just
> > perfect (No forwards)
> >
> > What may be the reason for this? What can be the checklist I can have to
> > rectify this?
> >
> > Thanks in advance.
> > Thomas Joseph
> >
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message