cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryon Phinney <bephin...@gmail.com>
Subject Re: SourceFactory and Session
Date Thu, 18 Aug 2005 19:06:43 GMT
The webapp context is simply the cocoon webapp.

I am just prototyping at this point so I have just deployed cocoon to
a tomcat instance and created a sub-sitemap.  The new Source goes out
to another webapp and it is ultimately this new source's session that
I want to manage.

Here is the matcher in my sitemap:
<map:match pattern="*.webapp">
  <map:generate
src="sesmngr:http://latbp:8080/TestWebApp/servlet/RequestCounter"/>
  <map:serialize/>
</map:match>

The source simply hits the passed URL and returns the results.

In the SourceFactory I want to tie a Source to a session in the cocoon
context so that the Source can maintain a session with the external
source.



On 8/18/05, Upayavira <uv@odoko.co.uk> wrote:
> Bryon Phinney wrote:
> > Thanks for the help.  I am hitting one slight snag:
> >
> > org.apache.avalon.framework.context.ContextException: Unable to locate
> > object-model (No environment available)
> >       at org.apache.cocoon.components.ComponentContext.get(ComponentContext.java:95)
> >       at org.apache.cocoon.components.ContextHelper.getObjectModel(ContextHelper.java:89)
> >       at com.lat_inc.cocoon.component.SesMngrSourceFactory.contextualize(SesMngrSourceFactory.java:93)
> >
> >
> > My line 93 in SesMngrSourceFactory is:
> > objectModel = ContextHelper.getObjectModel(context);
> 
> Hmm. In what context are you using your source object?
> 
> Upayavira
> 
> 
> 
> > On 8/18/05, Upayavira <uv@odoko.co.uk> wrote:
> >
> >>Bryon Phinney wrote:
> >>
> >>>configuration:
> >>>Cocoon 2.1
> >>>
> >>>I need to pass the current session or request to a custom
> >>>SourceFactory .  Is it possible to pass the session to the
> >>>SourceFactory.getSource( ) method via the Map argument?  If not, is
> >>>there another way to get access to it?
> >>
> >>Look at, for example, o.a.c.components.source.impl.PartSourceFactory. In
> >>the contextualize method it gets the object model. From the object model
> >> (using ObjectModelHelper.getRequest() you can get the request. From
> >>the request you can get the session. Make sure your SourceFactory
> >>implements Contextualizable, so that its contextualize() method will be
> >>called.
> >>
> >>A long way around, but it will get you there.
> >>
> >>Regards, Upayavira
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message