You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by William Kaufman <WK...@viquity.com> on 2001/04/02 16:19:51 UTC
RE: Redirect System.setOut() to response.out
> -----Original Message-----
> From: Mike Slinn [mailto:mslinn@mslinn.com]
> Sent: Saturday, March 31, 2001 7:51 PM
> To: Tomcat Users
> Subject: Redirect System.setOut() to response.out
>
>
> Can anyone give me the magic incantation (if there is one) to redirect
> System.out to response.out?
>
> Something along the lines of:
> System.setOut([magic dust goes here] out);
By "response.out", you mean the ServletResponse's output?
Then, "magic dust" = "new java.io.PrintStream(response.getOutputStream())".
Note, though, that System.setOut() may be disallowed by the security
manager: you should try to avoid calling it, by using (and exposing) methods
which allow the caller to specify the output, wherever possible.
-- Bill K.