I remember spending an afternoon with a coworker once trying to do the same thing, feed a fake request/session to Tapestry for some similar reason. After a few hours we decided it was a silly idea and gave up on it... but good luck!
Ben -----Original Message----- From: Patrick Moore [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 26, 2006 1:29 PM To: Tapestry users Subject: Re: problems getting a session state object on start up (resend ..? ) Hi Ben -- What I am trying to do is preload some sample data, *as if* a user has entered it. So I want to have a Session object that I am going to programatically configure. Also I will be doing some background processing on behalf of a user so I will need to have a session object for that case as well. In neither case do I have a HttpRequest.... -Pat On 9/26/06, Ben Dotte <[EMAIL PROTECTED]> wrote: > > I hope that works for you, unfortunately I'm out of ideas on this one. > I'm not sure what you're trying to do makes sense, if I understand this > correctly. It sounds like you are trying to directly access a > session-scoped ASO as your eager-loaded service gets created, correct? > The problem is you aren't going to have a web session without an > associated request from the user, which isn't going to be there at the > point the Hivemind registry is created. > > In my case, I needed to eager-load a service that needed the asoManager, > but I didn't actually pull any ASOs out of it until later while > processing user requests. > > If you're trying to setup some initial state in each ASO as it is > created, couldn't you add an initialize() method to the ASO class and > create it using <invoke-factory>? > > Sorry I don't have a better answer for you, > > Ben > > -----Original Message----- > From: Patrick Moore [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 26, 2006 1:10 PM > To: Tapestry users > Subject: Re: problems getting a session state object on start up (resend > ..? ) > > I ran across an email thread that just suggested to create the > WebRequest/WebSession objects. So I am going to try that. If anyone has > a > better idea let me know. > > On 9/26/06, Patrick Moore <[EMAIL PROTECTED]> wrote: > > > > Hi Ben --- > > > > thanks for this info. > > > > I just tried what I think is your suggestion. I added the > > ApplicationInitializer interface to my demo.Samples service and added > this > > method: > > > > public void initialize(HttpServlet arg0) { > > try { > > init(); > > } catch (IOException e) { > > e.printStackTrace(); > > } > > } > > and it doesn't seem to work quite completely. I get past the point of > the > > infrastructure object ApplicationStateManager not being available. > However, > > now I get a different exception. > > > > How does tapestry initialize a session? Is it possible for a > background > > thread to initialize a tapestry session? > > > > -------------------------- > > java.lang.NullPointerException: Property 'webRequest' of <OuterProxy > for > > tapestry.globals.RequestGlobals( > > org.apache.tapestry.services.RequestGlobals)> is null. > > at > > > $WebRequest_10deb12def2._targetServiceProperty($WebRequest_10deb12def2.j > ava) > > > > at > $WebRequest_10deb12def2.getSession($WebRequest_10deb12def2.java) > > at > $WebRequest_10deb12dec3.getSession($WebRequest_10deb12dec3.java) > > at > $WebRequest_10deb12dec2.getSession($WebRequest_10deb12dec2.java) > > at > org.apache.tapestry.engine.state.SessionScopeManager.getSession( > > SessionScopeManager.java:48) > > at org.apache.tapestry.engine.state.SessionScopeManager.get( > > SessionScopeManager.java:64) > > at > > > $StateObjectPersistenceManager_10deb12deed.get($StateObjectPersistenceMa > nager_10deb12deed.java) > > > > at > > > $StateObjectPersistenceManager_10deb12deec.get($StateObjectPersistenceMa > nager_10deb12deec.java) > > at org.apache.tapestry.engine.state.StateObjectManagerImpl.get( > > StateObjectManagerImpl.java:50) > > at > org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get ( > > ApplicationStateManagerImpl.java:60) > > at > > > $ApplicationStateManager_10deb12de9a.get($ApplicationStateManager_10deb1 > 2de9a.java) > > at > > > $ApplicationStateManager_10deb12de9b.get($ApplicationStateManager_10deb1 > 2de9b.java) > > > > at > > > com.transparentpolitics.core.TransPolSessionManagerImpl.getTransPolSessi > on > > (TransPolSessionManagerImpl.java:46) > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]