You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Peter Dotchev <do...@gmail.com> on 2009/11/07 22:52:18 UTC

WicketFilter.getLastModified creates a RequestCycle but does not clean it up

Hi Wicketeers,

I noticed that WicketFilter.getLastModified creates a RequestCycle but 
does not /detach /it, so onEndRequest is not called.
I use JCR and open a session to it on first use (lazy init). I store the 
JCR session in th RequestCycle. I close the JCR session in 
RequestCycle.onEndRequest (overriden). Kind of Open Session In View pattern.
When WicketFilter.getLastModified calls Resource.getResourceStream() I 
have to open a JCR session to stream the requested resource. But then 
onEndRequest is not called on the RequestCycle so the JCR session 
remains open.

By debugging I found the following sequence in WicketFilter:
doFilter
    getLastModified
       webApplication.newRequestCycle
       resource.getResourceStream
       // requestCycle.detach - this is commented
       requestCycle.unset // this does not call onEndRequest
    doGet
       webApplication.newRequestCycle // second RequestCycle is created
       cycle.request() // this calls again getResourceStream but also 
RequestCycle.detach

It turns out two RequestCycle's are created but only the second one is 
detached. Also Resource.getResourceStream is called twice. This is all 
for one request.

I use Wicket 1.4.1.

Best regards,
Peter


Re: WicketFilter.getLastModified creates a RequestCycle but does not clean it up

Posted by Peter Dotchev <do...@gmail.com>.
created jira item
https://issues.apache.org/jira/browse/WICKET-2566

Regards,
Peter


igor.vaynberg wrote:
> 
> peter, please open a jira issue. looks like a bug to me.
> 
> -igor
> 
> On Sat, Nov 7, 2009 at 1:52 PM, Peter Dotchev <do...@gmail.com> wrote:
>> Hi Wicketeers,
>>
>> I noticed that WicketFilter.getLastModified creates a RequestCycle but
>> does
>> not /detach /it, so onEndRequest is not called.
>> I use JCR and open a session to it on first use (lazy init). I store the
>> JCR
>> session in th RequestCycle. I close the JCR session in
>> RequestCycle.onEndRequest (overriden). Kind of Open Session In View
>> pattern.
>> When WicketFilter.getLastModified calls Resource.getResourceStream() I
>> have
>> to open a JCR session to stream the requested resource. But then
>> onEndRequest is not called on the RequestCycle so the JCR session remains
>> open.
>>
>> By debugging I found the following sequence in WicketFilter:
>> doFilter
>>   getLastModified
>>      webApplication.newRequestCycle
>>      resource.getResourceStream
>>      // requestCycle.detach - this is commented
>>      requestCycle.unset // this does not call onEndRequest
>>   doGet
>>      webApplication.newRequestCycle // second RequestCycle is created
>>      cycle.request() // this calls again getResourceStream but also
>> RequestCycle.detach
>>
>> It turns out two RequestCycle's are created but only the second one is
>> detached. Also Resource.getResourceStream is called twice. This is all
>> for
>> one request.
>>
>> I use Wicket 1.4.1.
>>
>> Best regards,
>> Peter
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/WicketFilter.getLastModified-creates-a-RequestCycle-but-does-not-clean-it-up-tp26249003p26262469.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketFilter.getLastModified creates a RequestCycle but does not clean it up

Posted by Igor Vaynberg <ig...@gmail.com>.
peter, please open a jira issue. looks like a bug to me.

-igor

On Sat, Nov 7, 2009 at 1:52 PM, Peter Dotchev <do...@gmail.com> wrote:
> Hi Wicketeers,
>
> I noticed that WicketFilter.getLastModified creates a RequestCycle but does
> not /detach /it, so onEndRequest is not called.
> I use JCR and open a session to it on first use (lazy init). I store the JCR
> session in th RequestCycle. I close the JCR session in
> RequestCycle.onEndRequest (overriden). Kind of Open Session In View pattern.
> When WicketFilter.getLastModified calls Resource.getResourceStream() I have
> to open a JCR session to stream the requested resource. But then
> onEndRequest is not called on the RequestCycle so the JCR session remains
> open.
>
> By debugging I found the following sequence in WicketFilter:
> doFilter
>   getLastModified
>      webApplication.newRequestCycle
>      resource.getResourceStream
>      // requestCycle.detach - this is commented
>      requestCycle.unset // this does not call onEndRequest
>   doGet
>      webApplication.newRequestCycle // second RequestCycle is created
>      cycle.request() // this calls again getResourceStream but also
> RequestCycle.detach
>
> It turns out two RequestCycle's are created but only the second one is
> detached. Also Resource.getResourceStream is called twice. This is all for
> one request.
>
> I use Wicket 1.4.1.
>
> Best regards,
> Peter
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org