You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by footh <fo...@yahoo.com> on 2005/07/19 19:54:07 UTC

Application and Session objects in cocoon

I've looked through a lot of documentation but I can't
seem to find any information on this.

How does one set and/or access an application-scope or
session-scope java object within the cocoon framework
- either in an XSP page, a logicsheet or in a
pipeline.  I've found lots of information on accessing
simple session attributes but nothing on an object. 
And I haven't found any information on the
application-scope.

A link to a resource would be just as welcome as an
explanation as I am more than happy to read
documentation.

Regards,

JF


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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


Re: Application and Session objects in cocoon

Posted by footh <fo...@yahoo.com>.
Thomas,

Thanks for the reply.  Where did you find out about
writing a "standalone" cocoon object.  Is there some
documentation you could point me too?  Have you done
this in your application?

I will try to give that a shot as I can't seem to find
anything that resembles an application-scope variable.

Concerning your custom generators...might they be
useful to solve this problem:

As I stated before, I select a few featured items to
display to the user.  I would like to implement that
by having a tag in my XML content that I replace with
XML for the items selected.  So, I would have an XML
content file that had, say, this tag:

<featured-items/>

And I would want to replace that with, say:

<featured-items>
  <item>1</item>
  <item>2</item>
  ...
</featured-items>

Could something like that be done with a custom
generator?  Or might there be a better way?

Regards,

JF

--- Thomas Lutz <ma...@gmx.at> wrote:

> I am using quite the same environment as you
> do...javaflow, jxtemplates, 
> some custom generators.
> 
> Looking around I found no application object, too,
> but :-) maybe the 
> this concept might help:
> 
> Create a "standalone" cocoon independent class, that
> is responsible for 
> building your items cache. If you implement this
> class as a singleton it 
> would just act like a application object. I don't
> think that you need 
> much synchronizing, so it should be no performance
> issue.. it would 
> behave like the logger.
> 
> This class could either recieve events from your
> database, or a 
> "administration trigger reload webpage", or poll the
> database every 50 
> hits for new items...
> 
> I don't know how fit you are in java, but that it is
> not really hard to 
> implement, and I think it should work... although I
> am not really a java 
> guru yet :-).
> 
> HTH,
> tom
> 
> footh schrieb:
> 
> >I still can't seem to find any information on an
> >equivalent solution for an application-scope
> object.
> >
> >I've switched to JavaFlow and JX templates now. 
> Would
> >a class variable in a JavaFlow be considered as an
> >application-scope variable, if I had the flow run
> >through every page?
> >
> >The problem I'm trying to solve is, I have a list X
> >items (which very gradually increases, maybe a
> couple
> >a week).  On each page click in my site, I want to
> >randomly grab a few of them to display to the user.
> >
> >In JSP, I implemented this by storing all the items
> in
> >an application object, which was essentially a
> vector
> >of the items, and randomly grabbed a few from this
> >vector on each page click.  In this situation, if
> the
> >number of items increased, I would need to restart
> the
> >container to initialize the vector with the new
> >amount.  But, I wouldn't have to hit the database
> on
> >every click.
> >
> >I wonder if there is a better way to do this in
> >Cocoon.  I envision having a custom tag, say
> ><featured_items/> which would be replaced with XML
> >data on the randomly chosen items and then
> formatted
> >in an XSL transformation.
> >
> >I am having trouble figuring out the logistics of
> >doing this.  Can anyone offer some advice?
> >
> >Regards,
> >
> >JF
> >
> >--- footh <fo...@yahoo.com> wrote:
> >
> >  
> >
> >>I've looked through a lot of documentation but I
> >>can't
> >>seem to find any information on this.
> >>
> >>How does one set and/or access an
> application-scope
> >>or
> >>session-scope java object within the cocoon
> >>framework
> >>- either in an XSP page, a logicsheet or in a
> >>pipeline.  I've found lots of information on
> >>accessing
> >>simple session attributes but nothing on an
> object. 
> >>And I haven't found any information on the
> >>application-scope.
> >>
> >>A link to a resource would be just as welcome as
> an
> >>explanation as I am more than happy to read
> >>documentation.
> >>
> >>Regards,
> >>
> >>JF
> >>
> >>
> >>		
>
>>____________________________________________________
> >>Start your day with Yahoo! - make it your home
> page 
> >>http://www.yahoo.com/r/hs 
> >> 
> >>
> >>
> >>    
> >>
>
>---------------------------------------------------------------------
> >  
> >
> >>To unsubscribe, e-mail:
> >>users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail:
> >>users-help@cocoon.apache.org
> >>
> >>
> >>    
> >>
> >
> >
> >
> >		
>
>____________________________________________________
> >Start your day with Yahoo! - make it your home page
> 
> >http://www.yahoo.com/r/hs 
> > 
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail:
> users-help@cocoon.apache.org
> >
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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


Re: Application and Session objects in cocoon

Posted by Thomas Lutz <ma...@gmx.at>.
I am using quite the same environment as you do...javaflow, jxtemplates, 
some custom generators.

Looking around I found no application object, too, but :-) maybe the 
this concept might help:

Create a "standalone" cocoon independent class, that is responsible for 
building your items cache. If you implement this class as a singleton it 
would just act like a application object. I don't think that you need 
much synchronizing, so it should be no performance issue.. it would 
behave like the logger.

This class could either recieve events from your database, or a 
"administration trigger reload webpage", or poll the database every 50 
hits for new items...

I don't know how fit you are in java, but that it is not really hard to 
implement, and I think it should work... although I am not really a java 
guru yet :-).

HTH,
tom

footh schrieb:

>I still can't seem to find any information on an
>equivalent solution for an application-scope object.
>
>I've switched to JavaFlow and JX templates now.  Would
>a class variable in a JavaFlow be considered as an
>application-scope variable, if I had the flow run
>through every page?
>
>The problem I'm trying to solve is, I have a list X
>items (which very gradually increases, maybe a couple
>a week).  On each page click in my site, I want to
>randomly grab a few of them to display to the user.
>
>In JSP, I implemented this by storing all the items in
>an application object, which was essentially a vector
>of the items, and randomly grabbed a few from this
>vector on each page click.  In this situation, if the
>number of items increased, I would need to restart the
>container to initialize the vector with the new
>amount.  But, I wouldn't have to hit the database on
>every click.
>
>I wonder if there is a better way to do this in
>Cocoon.  I envision having a custom tag, say
><featured_items/> which would be replaced with XML
>data on the randomly chosen items and then formatted
>in an XSL transformation.
>
>I am having trouble figuring out the logistics of
>doing this.  Can anyone offer some advice?
>
>Regards,
>
>JF
>
>--- footh <fo...@yahoo.com> wrote:
>
>  
>
>>I've looked through a lot of documentation but I
>>can't
>>seem to find any information on this.
>>
>>How does one set and/or access an application-scope
>>or
>>session-scope java object within the cocoon
>>framework
>>- either in an XSP page, a logicsheet or in a
>>pipeline.  I've found lots of information on
>>accessing
>>simple session attributes but nothing on an object. 
>>And I haven't found any information on the
>>application-scope.
>>
>>A link to a resource would be just as welcome as an
>>explanation as I am more than happy to read
>>documentation.
>>
>>Regards,
>>
>>JF
>>
>>
>>		
>>____________________________________________________
>>Start your day with Yahoo! - make it your home page 
>>http://www.yahoo.com/r/hs 
>> 
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail:
>>users-help@cocoon.apache.org
>>
>>
>>    
>>
>
>
>
>		
>____________________________________________________
>Start your day with Yahoo! - make it your home page 
>http://www.yahoo.com/r/hs 
> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>


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


Re: Application and Session objects in cocoon

Posted by footh <fo...@yahoo.com>.
I still can't seem to find any information on an
equivalent solution for an application-scope object.

I've switched to JavaFlow and JX templates now.  Would
a class variable in a JavaFlow be considered as an
application-scope variable, if I had the flow run
through every page?

The problem I'm trying to solve is, I have a list X
items (which very gradually increases, maybe a couple
a week).  On each page click in my site, I want to
randomly grab a few of them to display to the user.

In JSP, I implemented this by storing all the items in
an application object, which was essentially a vector
of the items, and randomly grabbed a few from this
vector on each page click.  In this situation, if the
number of items increased, I would need to restart the
container to initialize the vector with the new
amount.  But, I wouldn't have to hit the database on
every click.

I wonder if there is a better way to do this in
Cocoon.  I envision having a custom tag, say
<featured_items/> which would be replaced with XML
data on the randomly chosen items and then formatted
in an XSL transformation.

I am having trouble figuring out the logistics of
doing this.  Can anyone offer some advice?

Regards,

JF

--- footh <fo...@yahoo.com> wrote:

> I've looked through a lot of documentation but I
> can't
> seem to find any information on this.
> 
> How does one set and/or access an application-scope
> or
> session-scope java object within the cocoon
> framework
> - either in an XSP page, a logicsheet or in a
> pipeline.  I've found lots of information on
> accessing
> simple session attributes but nothing on an object. 
> And I haven't found any information on the
> application-scope.
> 
> A link to a resource would be just as welcome as an
> explanation as I am more than happy to read
> documentation.
> 
> Regards,
> 
> JF
> 
> 
> 		
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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