Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7D2A8CDA6 for ; Wed, 3 Jul 2013 07:30:23 +0000 (UTC) Received: (qmail 51773 invoked by uid 500); 3 Jul 2013 07:30:22 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 51705 invoked by uid 500); 3 Jul 2013 07:30:21 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 51683 invoked by uid 99); 3 Jul 2013 07:30:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 07:30:20 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [212.227.126.171] (HELO moutng.kundenserver.de) (212.227.126.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 07:30:15 +0000 Received: from [192.168.1.100] (ip-109-85-80-99.web.vodafone.de [109.85.80.99]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MM06e-1UtB2H2EOa-0083Tb; Wed, 03 Jul 2013 09:29:33 +0200 Message-ID: <51D3D2D9.90003@meiers.net> Date: Wed, 03 Jul 2013 09:29:29 +0200 From: Sven Meier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: users@wicket.apache.org Subject: Re: Save place to set http response status? References: <51D3CC7B.6030107@meiers.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:38MOek2NK4DnK56MpyrLGXUjh7HeLZxYNq7zIy/EmD/ ASKnnD19B2kDWCFj4wbPdGow5MFwqxeZxMA8cEyIf5PcOly/O4 ZfWQrq75b5aERHbC170tyP+E8WIoxUR9Km+E7c33Yi3FMqt7pS Q1RVHxnqp6cnYE3o2BQFjNEwRPDS05LWgf5sVAUDtX8oZVDE2M 5gBTS8ZUHDH09tLzYxcQLJucn9nZiizYpfAAK6rE/qASwkc1Jx IDChcSTMdn19goB8MUjsY7e9X78eUvBHhUCcskUH9q8IIvlqLl 9KnW5qkBqM/5cdP2aDZOLZqUajHJIINlNQhLVURq5hbp8mdVA= = X-Virus-Checked: Checked by ClamAV on apache.org Yes, WebPageRenderer renders the page into a BufferedWebResponse. But after that it writes it into the response of the RequestCycle: response.writeTo((WebResponse)requestCycle.getResponse()); That's the point of no return. By default the RequestCycle's response is a ServletWebResponse nested in a HeaderBufferingWebResponse. So only headers are buffered until the first content is written. ServletWebResponse#flush() just forwards to HttpServletResponse#flushBuffer(), no buffering involved there. Sven On 07/03/2013 09:19 AM, Martin Grigorov wrote: > On Wed, Jul 3, 2013 at 10:02 AM, Sven Meier wrote: > >> HttpServletResponse has no data to push until the very end of the >>> request cycle. >>> >> That's not quite right: >> As soon as WebPageRenderer writes the buffered page into the real >> response, Tomcat has something to flush. If it does flush (for whatever >> reason), any additional header set > > Can you paste the code that does this in WebPageRenderer ? > > AFAIK org.apache.wicket.protocol.http.servlet.ServletWebResponse#flush() > makes the transfer from the BufferedWebResponse to HttpServletResponse. > > >> in #onEndRequest() might be ignored. >> >> Sven >> >> >> >> On 07/03/2013 03:52 AM, Martin Grigorov wrote: >> >>> Hi, >>> >>> org.apache.wicket.markup.html.**WebPage#configureResponse() is a good >>> place >>> for this. >>> >>> Wicket buffers the response so Tomcat cannot flush it no matter the size. >>> I.e. the HttpServletResponse has no data to push until the very end of the >>> request cycle. >>> >>> >>> On Tue, Jul 2, 2013 at 5:07 PM, Martin Funk wrote: >>> >>> Hi there, >>>> what is the best place to set http response state? >>>> >>>> I was trying the 'onSomething' callback methods in IRequestCycleListener >>>> Like onEndRequest >>>> >>>> But sometimes those get ignored >>>> >>>> The last save place I figured was onAfterRender in the page class, but >>>> this >>>> doesn't feel right. >>>> >>>> The reason that calls like: >>>> ((HttpServletResponse) >>>> RequestCycle.get().**getResponse().**getContainerResponse()).** >>>> setStatus(404); >>>> in the RequestCycle Listner are ignored seems to be that the underlying >>>> container, Tomcat 6.0.37 in our case, starts to flush the outputstream as >>>> the Response becomes big, as in maybe 20k. >>>> >>>> If the response is small enoug the status, can be set in the 'onDetach()' >>>> >>>> Anyone any ideas? >>>> >>>> Martin >>>> >>>> >> ------------------------------**------------------------------**--------- >> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org >> For additional commands, e-mail: users-help@wicket.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org