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 2B7F1CDED for ; Wed, 3 Jul 2013 07:38:09 +0000 (UTC) Received: (qmail 63363 invoked by uid 500); 3 Jul 2013 07:38:07 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 63345 invoked by uid 500); 3 Jul 2013 07:38:06 -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 63337 invoked by uid 99); 3 Jul 2013 07:38:05 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 07:38:05 +0000 Received: from localhost (HELO mail-pd0-f173.google.com) (127.0.0.1) (smtp-auth username mgrigorov, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Jul 2013 07:38:04 +0000 Received: by mail-pd0-f173.google.com with SMTP id v14so4330128pde.4 for ; Wed, 03 Jul 2013 00:38:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=AchspjkxUH19rGmuJ177DegXiZY4WIbbtV4jqepdSUM=; b=LwQU41qgKyZSadFwA8D5RTKTyw7Z4OwOoaf2k9T0eTCgeRGkJLhEKhAS4v3V0Hhpm5 Mvunv8qeDR5w1/NKo/etAKE27LHxcwdbTC1uT0Pgfggiv68VVJlKS7DSLlXBEoCcJ+q9 T/0tH2yfsnVyGArtypzRGdgBgH4g4LuDmGzZqSIAODYgC2Zk4aHAWQ+QZe8FAEtOJGX2 T6rZT07uFMLazXSYb11qR/zv+Z2P+KW5SgDMaEhgxiBKCI8xhMGEA5LTr/6CEpPFBvrL CJuMHlN9fqJ7+X2zKGEZ/nhYUu/2ptkQbSSLk9d2+i8gILRheT7Qm9PKfoPzAmZxx8+9 90RQ== X-Received: by 10.66.122.131 with SMTP id ls3mr1314255pab.2.1372837084500; Wed, 03 Jul 2013 00:38:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.218.103 with HTTP; Wed, 3 Jul 2013 00:37:24 -0700 (PDT) In-Reply-To: <51D3D2D9.90003@meiers.net> References: <51D3CC7B.6030107@meiers.net> <51D3D2D9.90003@meiers.net> From: Martin Grigorov Date: Wed, 3 Jul 2013 10:37:24 +0300 Message-ID: Subject: Re: Save place to set http response status? To: "users@wicket.apache.org" Content-Type: multipart/alternative; boundary=047d7bf0e052c19eb804e0968a7d --047d7bf0e052c19eb804e0968a7d Content-Type: text/plain; charset=UTF-8 Correct. On Wed, Jul 3, 2013 at 10:29 AM, Sven Meier wrote: > 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()); > By default REDIRECT_TO_BUFFER strategy is used so all this happens in the second http request cycle. But for all other cases in WebPageRenderer you are right. > > 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. > Yep. No buffering by Wicket, but still the flush is needed for the buffering done by the servlet container. > > 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.**apa**che.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 > > --047d7bf0e052c19eb804e0968a7d--