You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gabor Friedrich <np...@gmail.com> on 2018/03/09 15:22:20 UTC

Session#invalidateNow() question

Hello everybody,

We are in the process of migrating to wicket 7.10.0.

With reference to WICKET-6530, I have the following piece of code:

...

@Override
public void onClick() {

// DO SOMETHING

final Session session = Session.get();
session.invalidateNow();
final boolean *isSessionInvalidated *= session.isSessionInvalidated(); //
false

// DO SOMETHING

}

...

My question is: why is the value of  *isSessionInvalidated *always *false?*.
Note: in wicket 7.9.0 the value of *isSessionInvalidated *is always true.


Thank you,
Gabor

Re: Session#invalidateNow() question

Posted by Emond Papegaaij <em...@topicus.nl>.
Hi,

The javadoc states 'Whether the session is invalid now, or will be invalidated 
by the end of the request.' The first part is no longer true. The javadoc also 
states that you normally should not need this method (why is it part of the 
public API then?)

I think we can fix the method by setting the same metadata on the session. 
destroy should set the boolean to true and bind should remove it again.

Best regards,
Emond

On zaterdag 10 maart 2018 11:42:27 CET Sven Meier wrote:
> Hi,
> 
> invalidateNow() calls destroy(), which clears the SESSION_INVALIDATED
> request cycle flag.
> 
> isSessionInvalidated()'s javadoc states that 'clients should rarely need
> this method', but apparently they do. @Edmond: do you think we can/should
> improve that?
> 
> Have fun
> Sven
> 
> Am 09.03.2018 um 16:22 schrieb Gabor Friedrich:
> > Hello everybody,
> > 
> > We are in the process of migrating to wicket 7.10.0.
> > 
> > With reference to WICKET-6530, I have the following piece of code:
> > 
> > ...
> > 
> > @Override
> > public void onClick() {
> > 
> > // DO SOMETHING
> > 
> > final Session session = Session.get();
> > session.invalidateNow();
> > final boolean *isSessionInvalidated *= session.isSessionInvalidated(); //
> > false
> > 
> > // DO SOMETHING
> > 
> > }
> > 
> > ...
> > 
> > My question is: why is the value of  *isSessionInvalidated *always
> > *false?*. Note: in wicket 7.9.0 the value of *isSessionInvalidated *is
> > always true.
> > 
> > 
> > Thank you,
> > Gabor
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.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


Re: Session#invalidateNow() question

Posted by Sven Meier <sv...@meiers.net>.
Hi,

invalidateNow() calls destroy(), which clears the SESSION_INVALIDATED request cycle flag.

isSessionInvalidated()'s javadoc states that 'clients should rarely need this method', but apparently they do.
@Edmond: do you think we can/should improve that?

Have fun
Sven


Am 09.03.2018 um 16:22 schrieb Gabor Friedrich:
> Hello everybody,
>
> We are in the process of migrating to wicket 7.10.0.
>
> With reference to WICKET-6530, I have the following piece of code:
>
> ...
>
> @Override
> public void onClick() {
>
> // DO SOMETHING
>
> final Session session = Session.get();
> session.invalidateNow();
> final boolean *isSessionInvalidated *= session.isSessionInvalidated(); //
> false
>
> // DO SOMETHING
>
> }
>
> ...
>
> My question is: why is the value of  *isSessionInvalidated *always *false?*.
> Note: in wicket 7.9.0 the value of *isSessionInvalidated *is always true.
>
>
> Thank you,
> Gabor
>


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