tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Kaufman <WKauf...@viquity.com>
Subject RE: Redirect System.setOut() to response.out
Date Mon, 02 Apr 2001 14:19:51 GMT
> -----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.

Mime
View raw message