"Pike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> > Can be done.  This example should get you started.
>
> that is a really nice solution !
> one question
>
> >    public class MyEmailResponse extends HttpServletResponseWrapper {
> >       Writer out;
> >        public MyEmailResponse(HttpServletResponse res) {
> >          super(res);
> >          out = new StringWriter();
> >        }
> >        public Writer getWriter() {
> >           return out;
> >        }
> >        // You may need to override some other methods here
> >   };
>
> do you have to override both getWriter() and getOutputStream(), and in
> both,
> check if the other hasn't been called ? how do you know which method
> tomcat or jasper internally uses ?

Without looking, I believe that Jasper only asks for Writer.  Of course, the
only way to know which method Tomcat and/or Jasper internally uses is to
downlowd the source distro, and start poking around (of course, the downside
of this is that you might end up being a Tomcat committer, and having to
deal with questions like this ;-).

>
> > Then in your servlet:
> >
> >       MyEmailResponse mer = new MyEmailResponse(response);
> >       RequestDispatcher rd =
> > getServletContext().getRequestDispatcher("/myEmail.jsp");
> >       rd.include(request, mer);
> >       mer.flushBuffer();
> >       StringWriter sw = (StringWriter)mer.getWriter();
> >       String emailMessage = sw.toString();
>
>
> thanks,
> *pike
>
> ========================
> = 1/9671406556917033397649408 yottabyte
> = 1/9444732965739290427392 zettabyte
> = 1/9223372036854775808 exabyte
> = 1/9007199254740992 petabyte
> = 1/8796093022208 terabyte
> = 1/8589934592 gigabyte
> = 1/8388608 megabyte
> = 1/1048576 Megabit
> = 1/8192 kilobyte
> = 1/1024 Kilobit
> = 1/8 byte
> = 1/4 nibble
> bit = 1 bit




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to