Besides the 'non' buffering trait of the BufferedWebResponse it is a little
irritating, that the 'setStatus(int)' method doesn't signal if its
execution is not successfull.

Though locking into code like: org.apache.catalina.connector.ResponseFacade
of Tomcat shows that it doesn't signal anything either.
[...]
    public void setStatus(int sc) {

        if (isCommitted())
            return;

        response.setStatus(sc);

    }
[...]

even the JavaDoc of oracle isn't helpful:
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletResponse.html#setStatus(int)
it only gives a statement on
http://docs.oracle.com/javaee/6/api/javax/servlet/ServletResponse.html#reset()
which should throw a IllegalStateException - if the response has already
been committed
http://docs.oracle.com/javaee/6/api/javax/servlet/ServletResponse.html#isCommitted()

If it were up to me, I'd of course would like to have both.
Wicket guaranteeing that the status can be set up till 'onDetach()'
and also a signal if setStatus was not successfull.
;-)

Martin


2013/7/3 Martin Grigorov <mgrigo...@apache.org>

> Correct.
>
>
> On Wed, Jul 3, 2013 at 10:29 AM, Sven Meier <s...@meiers.net> 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 <s...@meiers.net> 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 <mafulaf...@gmail.com>
> >>>> 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<
> http://apache.org>
> >>> <users-unsubscribe@**wicket.apache.org<
> users-unsubscr...@wicket.apache.org>
> >>> >
> >>>
> >>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>
> >>>
> >>>
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<
> users-unsubscr...@wicket.apache.org>
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>

Reply via email to