Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 52464D70C for ; Sat, 11 Aug 2012 08:07:21 +0000 (UTC) Received: (qmail 84757 invoked by uid 500); 11 Aug 2012 08:07:18 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 84359 invoked by uid 500); 11 Aug 2012 08:07:14 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 84336 invoked by uid 99); 11 Aug 2012 08:07:13 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Aug 2012 08:07:13 +0000 Received: from localhost (HELO s2laptop.dev.local) (127.0.0.1) (smtp-auth username markt, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Aug 2012 08:07:13 +0000 Message-ID: <502612AF.4000906@apache.org> Date: Sat, 11 Aug 2012 09:07:11 +0100 From: Mark Thomas User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: empty error page when using sendError() References: <20120810114851.2b7f386d@vmac.adm.tambov.gov.ru> <50251FA9.2020408@christopherschultz.net> <20120811111757.15b7413c@vmac.adm.tambov.gov.ru> In-Reply-To: <20120811111757.15b7413c@vmac.adm.tambov.gov.ru> X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 11/08/2012 08:17, Vladimir Mokrozub wrote: >> On Fri, 10 Aug 2012 10:50:17 -0400 >> Christopher Schultz wrote: > >>> >>> When I try to send error page directly from ErrorHandler using >>> HttpServletResponse, it works fine and page is displayed, so it >>> seems the problem is with sendError() method. Is this an expected >>> behaviour or some sort of bug? >> >> Oh... do you mean there is no content when your ErrorHandler sends the >> response? Are you producing any content? I certainly don't see a place >> where you are producing a response document of any kind. What did you >> expect the client to see on the screen? >> > > Hi, thanks for the reply. > > 1) I mean if I try to send the response like this: > ----------------------- > PrintWriter pw = response.getWriter(); > pw.write("Error!"); > pw.close(); > ----------------------- > it works OK and I see an "Error!" message on the client side. > > 2) If I use sendError() method instead, I don't see anything - just an > empty page. > > 3) This happens ONLY if the request was forwarded to ErrorHandler > servlet by Tomcat in case of an error or exception: > ----------------------- > > java.lang.Throwable > /ErrorHandler > > > 404 > /ErrorHandler > > ----------------------- > If, for example, I request ErrorHandler directly by URL, I can see an > error page. > > So I wonder why this happens: is it a bug or my misunderstanding of > sendError() method? You are already in an error page so sendError will not trigger the error page matching process again. If it did there is a strong possibility that you could end up in an infinite loop. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org