Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EFB10ECBE for ; Sat, 2 Feb 2013 22:43:05 +0000 (UTC) Received: (qmail 97759 invoked by uid 500); 2 Feb 2013 22:43:05 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 97698 invoked by uid 500); 2 Feb 2013 22:43:05 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 97689 invoked by uid 99); 2 Feb 2013 22:43:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2013 22:43:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.131] (HELO eos.apache.org) (140.211.11.131) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Feb 2013 22:43:04 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id EF5A75C8; Sat, 2 Feb 2013 22:42:43 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Sat, 02 Feb 2013 22:42:43 -0000 Message-ID: <20130202224243.76912.86937@eos.apache.org> Subject: =?utf-8?q?=5BTomcat_Wiki=5D_Update_of_=22HowTo=22_by_KonstantinKolinko?= Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for ch= ange notification. The "HowTo" page has been changed by KonstantinKolinko: http://wiki.apache.org/tomcat/HowTo?action=3Ddiff&rev1=3D127&rev2=3D128 Comment: Add a warning. There should be a better recipe somewhere in the mailing lis= t archives. Context context =3D (Context) host.findChild("myContext"); Realm realm =3D context.getRealm(); }}} + = + '''Warning:''' The above recipe on how to obtain a `Context` for a web ap= plication is a bit obsolete and does not work in Tomcat 7 and later (as Ser= ver is no longer a singleton). There are other ways to achieve that. An eas= y one is to add a `Valve` or `Listener` to a context, as those classes have= access to Tomcat internals. There may be other ways mentioned in the archi= ves of the [[FAQ/Tomcat_User|users mailing list]]. + = =3D=3D How do I redirect System.out and System.err to my web page? =3D=3D I have met a situation where I needed to redirect a portion of standard o= uput (`System.out`, STDOUT) and standard error (`System.err`, STDERR) to my= web page instead of a log file. An example of such an application is a com= piler research platform that our resarch team is putting online for anybody= to be able to quickly compile-test their programs on line. Naturally, the = compilers dump some of their stuff to STDERR or STDOUT and they are not web= application `.jar`. Thus, I needed badly these streams related to the comp= iler output to be redirected to my web editor interface. Having found no ea= sy instructions on how to do that lead me writing up this quick HOWTO. The = HOWTO is based on Servlets, but similar arrangements can be done for JSPs. = The below example shows the essentials, with most non-essentials removed. =20 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org