Override Session#onDetach() and do it before calling super.onDetach().

On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall <[email protected]> wrote:
> Hello,
>
> Is there a good way to discover my serialised or about-to-be-serialised
> session size without adding the debug bar to my page?
>
> I currently use
>
>   @Override
>   protected void onAfterRender()
>   {
>     super.onAfterRender();
>
>     CloudSession ssnSession = (CloudSession)getSession();
>     long loSize = ssnSession.getSizeInBytes();
>     m_logger.log(Level.FINE, String.format("Session size = %,dB.", loSize));
>   }
>
> in my WebPage subclass, but I suspect that this is the wrong place to
> examine the session size.
>
> My software environment is:
>
>     Web framework: Wicket 1.5.7
>     Web server system: Google App Engine for Java version 1.7.0
>     Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>     Operating system: Microsoft Windows XP Home Edition version 2002 SP3
> (version 5.1 running on x86; Cp1252; en_GB)
>
>
> Ian Marshall
>
>
>
> Walter Rugora wrote
>>
>> Thanks Jeremy, works great!!!
>>
>> On 23/06/12 23:23, Jeremy Thomerson wrote:
>>> On Fri, Jun 22, 2012 at 11:28 PM, Walter Rugora &lt;mist@&gt; wrote:
>>>
>>>> Hi,
>>>>
>>>> when I apply the Wicket 1.3 way to determine session size,
>>>> RequestCycle.get().getSession().getSizeInBytes()
>>>> it results in an around 3000bytes value in my case. And adding or
>>>> removing Labels changed the session size.
>>>>
>>>> Now with Wicket 1.5 using
>>>> Session.get().getSizeInBytes()
>>>> session size is 857bytes. And I can add or remove as many Lables as I
>>>> wish, that size stays the same. Obviously I use it wrong. Currently I
>>>> just add the session size result to a Label added to my single WebPage:
>>>> public HomePage(final PageParameters parameters) {
>>>>  ...
>>>>  add(new Label("ssize",
>>>> String.valueOf(Session.get().getSizeInBytes())));
>>>>  ...
>>>> }
>>>>
>>>
>>> Here you're doing it in the constructor.  So, if this is the first page
>>> you
>>> visit there won't be any (Wicket) stuff in the session yet.
>>>
>>> Have you tried just adding the debug bar to your page?  Add a dependency
>>> to
>>> wicket-devutils in your pom.xml and then add(new DebugBar("someID")); to
>>> your page (and add it to the markup obviously).
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650510.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to