struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milan Milanovic <milanmilanov...@yahoo.com>
Subject RE: RE: Re: [OT] new Boolean(true)? Re: [S2] Testing if session variable is present
Date Thu, 31 Jul 2008 22:27:59 GMT

Hi Dave,

excuse me for disturbing this list or you personally, I asked for this in
Spring forum (
http://forum.springframework.org/showthread.php?p=194333#post194333
http://forum.springframework.org/showthread.php?p=194333#post194333 ).
I figured out what I do in those method with session which forces user to
log in again, that I don't do in other methods, I do this:

// Test if session is valid
if (session instanceof org.apache.struts2.dispatcher.SessionMap) {
  try {
     ((org.apache.struts2.dispatcher.SessionMap)session ).invalidate();
   } catch (IllegalStateException e) {
        logger.error("Session is not valid!", e);
        return Action.ERROR;
    }
}

Is this possible to erase session ?

--
Thx, Milan


newton.dave wrote:
> 
> I already told you I don't know and you continue to refuse to provide the
> information I've asked for. You also added new information about Acegi,
> which I responded to by saying that yes, if you're getting logged out it's
> unlikely you'd keep the same session, as that would somewhat defeat the
> purpose of any reasonable login/logout mechanism.
> 
> I don't think I have anything further of value to offer you. I don't know
> of any issues with session variables; if you're having an Acegi issue then
> pursue the issue on a Spring forum.
> 
> Dave
> 
> Milan Milanovic wrote:
>> Dear Dave,
>> O.K. But when you look at this scenario:
>> MyFirstActionClass -> show first.jsp -> user click on link ->
>> MyFirstActionClass.method where I set session variable
>> (getSession().put("variable", new Boolean(true)); -> show second.jsp
>> (here I
>> see my variable) -> user click on some link ->
>> MySecondActionClass.method->third.jsp (here I don't see my variable). 
>> I should note that in MySecondActionClass.method I don't clear session or
>> something similar, I just add remove some other variables and set some
>> new. 
>> Why my session is obviously cleared when action from another namespace is
>> called ?
>> --
>> Thx, Milan
>> newton.dave wrote:
>>> 
>>> I didn't say it wouldn't work. I, and the Sun documentation I quoted,
>>> said
>>> it was a known bad programming practice.
>>> 
>>> Dave
>>> 
>>> Milan Milanovic wrote:
>>>> Hi Dave,
>>>> no, I think that this is not an issue. I tried with Boolean.TRUE and it
>>>> is
>>>> the same, but I earlier used new Boolean(true) and that worked.
>>>> --
>>>> Milan
>>>> newton.dave wrote:
>>>>> 
>>>>> --- On Thu, 7/31/08, Milan Milanovic wrote:
>>>>>> (getSession().put("variable", new Boolean(true));
>>>>> 
>>>>> Use Boolean.TRUE rather than instantiating a new object.
>>>>> 
>>>>> Note also that the Javadocs for Boolean state in big bold letters:
>>>>> 
>>>>> "Note: It is rarely appropriate to use this constructor. Unless a new
>>>>> instance is required, the static factory valueOf(boolean) is generally
>>>>> a
>>>>> better choice. It is likely to yield significantly better space and
>>>>> time
>>>>> performance."
>>>>> 
>>>>> Dave
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>> 
>>>>> 
>>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/-S2--Testing-if-session-variable-is-present-tp18716278p18756698.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>> 
>>> 
>>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/-S2--Testing-if-session-variable-is-present-tp18716278p18758095.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-S2--Testing-if-session-variable-is-present-tp18716278p18764848.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message