Hi Martijn,

Thanks for answering!
Actually the write to the client happens at that time.
By default the response is buffered (RequestCycleSettings#bufferResponse,
HttpBufferingWebResponse) and the write to the client happens right after
the detach of the RequestCycle.
It works OK this way since 1.5.0 so maybe there is no reason to change it.



On Mon, Nov 5, 2012 at 10:24 PM, Martijn Dashorst <
[email protected]> wrote:

> AFAIK there is no issue with using the webresponse after detaching,
> but you can't send anything to the client, since the stream has been
> closed already (probably there are more caveats, but this one comes
> from the top of my head)
>
> Martijn
>
> On Mon, Nov 5, 2012 at 9:12 AM, Martin Grigorov <[email protected]>
> wrote:
> > Hi,
> >
> > I wanted to improve ServletWebResponse#encodeRedirectUrl() for
> > https://issues.apache.org/jira/browse/WICKET-4854 as we did for
> > #encodeUrl() in https://issues.apache.org/jira/browse/WICKET-4645 but I
> > face a problem that SWR#sendRedirect() is being called in a context where
> > the RequestCycle is already detached (i.e. RequestCycle.get() returns
> null).
> >
> > The related code is:
> > WicketFilter#process()
> >
> > RequestCycle requestCycle = application.createRequestCycle(webRequest,
> > webResponse);
> > if (!requestCycle.processRequestAndDetach())
> >  {
> > if (chain != null)
> > {
> > chain.doFilter(request, response);
> >  }
> > res = false;
> > }
> > else
> >  {
> > webResponse.flush();
> > }
> >
> > The call to #flush() leads to #sendRedirect().
> >
> >
> > I can workaround the problem by creating a new UrlRenderer to be able to
> > render full and relative urls without using
> > RequestCycle.get().getUrlRenderer() but I'm not sure whether this is the
> > right way. Is it OK to use the WebResponse after detaching the
> RequestCycle
> > as we do now ?
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to