You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Ravell <st...@rave-tech.com.au> on 2006/01/18 12:41:31 UTC

Globally available variables

Is there a simple way to put an object into a globally available spot for
access by any current session? Something like the session.setAttribute()
method?

I have some info that I'd like to be able to load up and then have accessed
by any user logged into my app. I'm thinking of a cache type of deal.
Ideally writeable by any of the sessions.

App is Struts, Hibernate and Spring running on JBoss/Tomcat.

Any ideas will be much appreciated.


Regards
Marty





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


Re: Globally available variables

Posted by Marcelo Morales <ma...@redcetus.com>.
Hello

On Jan 18, 2006, at 7:41 AM, Martin Ravell wrote:

> Is there a simple way to put an object into a globally available  
> spot for
> access by any current session? Something like the  
> session.setAttribute()
> method?
>
> I have some info that I'd like to be able to load up and then have  
> accessed
> by any user logged into my app. I'm thinking of a cache type of deal.
> Ideally writeable by any of the sessions.
>
> App is Struts, Hibernate and Spring running on JBoss/Tomcat.
>

Three ideas come to my mind...
1 Use an "Application Context" variable. Watch out! there is thread  
safety involved
2 Wire it using spring.
3 The old an reliable final public static thing, which might be even  
easier

> Any ideas will be much appreciated.
>
>
> Regards
> Marty
>

Regards
Marcelo Morales

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


Re: Globally available variables

Posted by Dave Newton <ne...@pingsite.com>.
Martin Ravell wrote:
> I don't know. Will look into this but is it possible to have a session write
> an object to this app context and have another session see the result?
>
> I had a suspicion that stuff in the application context was setup during the
> app being deployed and could not be changed?
>   
It's just another map; it can be updated by anything (like, say, a
daemon that occasionally refreshes a list of stories or something).

Depending on your usage you might need to watch out for synchronization
issues.

Dave



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


RE: Globally available variables

Posted by Martin Ravell <st...@rave-tech.com.au>.
>-----Original Message-----
>From: ALEX HYDE [mailto:alex.hyde@btinternet.com] 
>Sent: Wednesday, 18 January 2006 10:47 PM
>To: Struts Users Mailing List
>Subject: Re: Globally available variables
>
>Can't you put it in the application context instead of all the sessions?
>

I don't know. Will look into this but is it possible to have a session write
an object to this app context and have another session see the result?

I had a suspicion that stuff in the application context was setup during the
app being deployed and could not be changed?


Regards
Marty




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


Re: Globally available variables

Posted by ALEX HYDE <al...@btinternet.com>.
Can't you put it in the application context instead of all the sessions?

Martin Ravell <st...@rave-tech.com.au> wrote:  Is there a simple way to put an object into a globally available spot for
access by any current session? Something like the session.setAttribute()
method?

I have some info that I'd like to be able to load up and then have accessed
by any user logged into my app. I'm thinking of a cache type of deal.
Ideally writeable by any of the sessions.

App is Struts, Hibernate and Spring running on JBoss/Tomcat.

Any ideas will be much appreciated.


Regards
Marty





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




		
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.