Re: Is the Select component's VALUE_CHANGED event out of the scope of user sessions ?
I can't believe I did this to my self !! I was using a wrong annotationJDO's @Persistent javax.jdo.annotations.Persistent *-* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana On Sat, Aug 23, 2014 at 11:06 PM, Muhammad Gelbana wrote: > I'm using v5.4-beta-17 and I'm facing an issue. > > I have an object persisted using the @Persistent annotation. > > And then I have a Select component on the page. While handling the Select > component's VALUE_CHANGED event method, it seems I can't access the > persisted object, its always null although I've initialized it in the > Form's PREPARE event (This event is fired whenever the form containing the > Select component is preparing for rendering\submission) > > *-* > *Muhammad Gelbana* > http://www.linkedin.com/in/mgelbana >
Is the Select component's VALUE_CHANGED event out of the scope of user sessions ?
I'm using v5.4-beta-17 and I'm facing an issue. I have an object persisted using the @Persistent annotation. And then I have a Select component on the page. While handling the Select component's VALUE_CHANGED event method, it seems I can't access the persisted object, its always null although I've initialized it in the Form's PREPARE event (This event is fired whenever the form containing the Select component is preparing for rendering\submission) *-* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana
Re: [t5.4-beta-6] Page class member variable scope
On Sun, 13 Jul 2014 04:44:04 -0300, Geoff Callender wrote: By returning "this" you're doing a page refresh, which is an HTTP 302 redirect, instead of an AJAX response. So never return "this" in an event handler method unless you're really sure you want to force a full page refresh, and in almost 99% of the time you don't. :) -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [t5.4-beta-6] Page class member variable scope
Exactly. I was thinking of a *submit*. But now that I thought about it, a submit may not be needed. But I tend prefer having every possible option available for me to handle whatever scenario I may face. I'll go with the ajax option. Thank you. *-* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana On Sun, Jul 13, 2014 at 12:26 PM, Geoff Callender < geoff.callender.jumpst...@gmail.com> wrote: > Sorry, that sounds very odd to me. "refresh the page without refreshing > it" sounds like a contradiction! > > Your Select has made an AJAX request. Why wouldn't you want an AJAX > response, ie. a partial render? If you return the whole page then any other > changes on the client-side will be overwritten, by a server that doesn't > know what was there except for the value of the Select and any context. > > Your question is making me think what you really want is to trigger a > submit of the enclosing form when the Select value changes. That way the > server-side will get the whole picture and be able to do a suitable > non-AJAX response. > > On 13 Jul 2014, at 8:06 pm, Muhammad Gelbana wrote: > > > Its ok to use Ajax, but is it the only way to update the page after a > > value is changed in a Select component ? If yes, wouldn't it be an > > improvement to be able to refresh the page without refreshing it and > > losing its state ? > > > > *-* > > *Muhammad Gelbana* > > http://www.linkedin.com/in/mgelbana > > > > > > On Sun, Jul 13, 2014 at 9:44 AM, Geoff Callender < > > geoff.callender.jumpst...@gmail.com> wrote: > > > >> By returning "this" you're doing a page refresh, which is an HTTP 302 > >> redirect, instead of an AJAX response. > >> > >> The redirect causes the browser to issue a second request - a fresh page > >> request - which will be freshly rendered by your stateless page class > >> without any knowledge of the value you set in the previous request. You > can > >> see the 302 response and the second request with the browser's web > >> inspector or firebug. > >> > >> Here's a working example: > >> > >> > >> http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/select1 > >> > >> Cheers, > >> > >> Geoff > >> > >> On 12 Jul 2014, at 11:55 pm, Muhammad Gelbana > wrote: > >> > >>> I hope I selected a valid subject ! > >>> > >>> When I handle a VALUE_CHANGED event for a Select component. I receive > the > >>> current value for the Select component as an event handler method > >> parameter. > >>> > >>> I use this parameter to set a member variable in the page's class. > >>> > >>> @OnEvent(component = "parameterType", value = > >> EventConstants.VALUE_CHANGED) > private Object > pairParameterTypeChanged(ChariotTestTypePairParameterType > selectedType) { > this.parameterType = selectedType; > System.out.println("Type1: " + this.parameterType); > return this; > } > >>> > >>> > >>> In another part of the page, I use a Delegate to conditionally display > a > >>> block. > >>> > >>> public Block getPairParameterInputBlock() { > System.out.println("Type2: " + this.parameterType); > if (this.parameterType == null) { > return null; > } > switch (this.parameterType) { > case TEXT: > return this.textPairParameterInput; > case NUMERIC: > return this.numericPairParameterInput; > default: > return null; > } > } > >>> > >>> > >>> What I'm facing there is that *this.parameterType* is always null and > >> never > >>> sees the value set to it in the Select component's event handler > method ! > >>> > >>> I understand there could be other ways to achieve the same behavior but > >> why > >>> isn't this behaving as I expect ? > >>> > >>> *-* > >>> *Muhammad Gelbana* > >>> http://www.linkedin.com/in/mgelbana > >> > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: [t5.4-beta-6] Page class member variable scope
Sorry, that sounds very odd to me. "refresh the page without refreshing it" sounds like a contradiction! Your Select has made an AJAX request. Why wouldn't you want an AJAX response, ie. a partial render? If you return the whole page then any other changes on the client-side will be overwritten, by a server that doesn't know what was there except for the value of the Select and any context. Your question is making me think what you really want is to trigger a submit of the enclosing form when the Select value changes. That way the server-side will get the whole picture and be able to do a suitable non-AJAX response. On 13 Jul 2014, at 8:06 pm, Muhammad Gelbana wrote: > Its ok to use Ajax, but is it the only way to update the page after a > value is changed in a Select component ? If yes, wouldn't it be an > improvement to be able to refresh the page without refreshing it and > losing its state ? > > *-* > *Muhammad Gelbana* > http://www.linkedin.com/in/mgelbana > > > On Sun, Jul 13, 2014 at 9:44 AM, Geoff Callender < > geoff.callender.jumpst...@gmail.com> wrote: > >> By returning "this" you're doing a page refresh, which is an HTTP 302 >> redirect, instead of an AJAX response. >> >> The redirect causes the browser to issue a second request - a fresh page >> request - which will be freshly rendered by your stateless page class >> without any knowledge of the value you set in the previous request. You can >> see the 302 response and the second request with the browser's web >> inspector or firebug. >> >> Here's a working example: >> >> >> http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/select1 >> >> Cheers, >> >> Geoff >> >> On 12 Jul 2014, at 11:55 pm, Muhammad Gelbana wrote: >> >>> I hope I selected a valid subject ! >>> >>> When I handle a VALUE_CHANGED event for a Select component. I receive the >>> current value for the Select component as an event handler method >> parameter. >>> >>> I use this parameter to set a member variable in the page's class. >>> >>> @OnEvent(component = "parameterType", value = >> EventConstants.VALUE_CHANGED) private Object pairParameterTypeChanged(ChariotTestTypePairParameterType selectedType) { this.parameterType = selectedType; System.out.println("Type1: " + this.parameterType); return this; } >>> >>> >>> In another part of the page, I use a Delegate to conditionally display a >>> block. >>> >>> public Block getPairParameterInputBlock() { System.out.println("Type2: " + this.parameterType); if (this.parameterType == null) { return null; } switch (this.parameterType) { case TEXT: return this.textPairParameterInput; case NUMERIC: return this.numericPairParameterInput; default: return null; } } >>> >>> >>> What I'm facing there is that *this.parameterType* is always null and >> never >>> sees the value set to it in the Select component's event handler method ! >>> >>> I understand there could be other ways to achieve the same behavior but >> why >>> isn't this behaving as I expect ? >>> >>> *-* >>> *Muhammad Gelbana* >>> http://www.linkedin.com/in/mgelbana >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [t5.4-beta-6] Page class member variable scope
Its ok to use Ajax, but is it the only way to update the page after a value is changed in a Select component ? If yes, wouldn't it be an improvement to be able to refresh the page without refreshing it and losing its state ? *-* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana On Sun, Jul 13, 2014 at 9:44 AM, Geoff Callender < geoff.callender.jumpst...@gmail.com> wrote: > By returning "this" you're doing a page refresh, which is an HTTP 302 > redirect, instead of an AJAX response. > > The redirect causes the browser to issue a second request - a fresh page > request - which will be freshly rendered by your stateless page class > without any knowledge of the value you set in the previous request. You can > see the 302 response and the second request with the browser's web > inspector or firebug. > > Here's a working example: > > > http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/select1 > > Cheers, > > Geoff > > On 12 Jul 2014, at 11:55 pm, Muhammad Gelbana wrote: > > > I hope I selected a valid subject ! > > > > When I handle a VALUE_CHANGED event for a Select component. I receive the > > current value for the Select component as an event handler method > parameter. > > > > I use this parameter to set a member variable in the page's class. > > > > @OnEvent(component = "parameterType", value = > EventConstants.VALUE_CHANGED) > >> private Object pairParameterTypeChanged(ChariotTestTypePairParameterType > >> selectedType) { > >> this.parameterType = selectedType; > >> System.out.println("Type1: " + this.parameterType); > >> return this; > >> } > > > > > > In another part of the page, I use a Delegate to conditionally display a > > block. > > > > public Block getPairParameterInputBlock() { > >> System.out.println("Type2: " + this.parameterType); > >> if (this.parameterType == null) { > >> return null; > >> } > >> switch (this.parameterType) { > >> case TEXT: > >> return this.textPairParameterInput; > >> case NUMERIC: > >> return this.numericPairParameterInput; > >> default: > >> return null; > >> } > >> } > > > > > > What I'm facing there is that *this.parameterType* is always null and > never > > sees the value set to it in the Select component's event handler method ! > > > > I understand there could be other ways to achieve the same behavior but > why > > isn't this behaving as I expect ? > > > > *-* > > *Muhammad Gelbana* > > http://www.linkedin.com/in/mgelbana > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: [t5.4-beta-6] Page class member variable scope
By returning "this" you're doing a page refresh, which is an HTTP 302 redirect, instead of an AJAX response. The redirect causes the browser to issue a second request - a fresh page request - which will be freshly rendered by your stateless page class without any knowledge of the value you set in the previous request. You can see the 302 response and the second request with the browser's web inspector or firebug. Here's a working example: http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/select1 Cheers, Geoff On 12 Jul 2014, at 11:55 pm, Muhammad Gelbana wrote: > I hope I selected a valid subject ! > > When I handle a VALUE_CHANGED event for a Select component. I receive the > current value for the Select component as an event handler method parameter. > > I use this parameter to set a member variable in the page's class. > > @OnEvent(component = "parameterType", value = EventConstants.VALUE_CHANGED) >> private Object pairParameterTypeChanged(ChariotTestTypePairParameterType >> selectedType) { >> this.parameterType = selectedType; >> System.out.println("Type1: " + this.parameterType); >> return this; >> } > > > In another part of the page, I use a Delegate to conditionally display a > block. > > public Block getPairParameterInputBlock() { >> System.out.println("Type2: " + this.parameterType); >> if (this.parameterType == null) { >> return null; >> } >> switch (this.parameterType) { >> case TEXT: >> return this.textPairParameterInput; >> case NUMERIC: >> return this.numericPairParameterInput; >> default: >> return null; >> } >> } > > > What I'm facing there is that *this.parameterType* is always null and never > sees the value set to it in the Select component's event handler method ! > > I understand there could be other ways to achieve the same behavior but why > isn't this behaving as I expect ? > > *-* > *Muhammad Gelbana* > http://www.linkedin.com/in/mgelbana - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[t5.4-beta-6] Page class member variable scope
I hope I selected a valid subject ! When I handle a VALUE_CHANGED event for a Select component. I receive the current value for the Select component as an event handler method parameter. I use this parameter to set a member variable in the page's class. @OnEvent(component = "parameterType", value = EventConstants.VALUE_CHANGED) > private Object pairParameterTypeChanged(ChariotTestTypePairParameterType > selectedType) { > this.parameterType = selectedType; > System.out.println("Type1: " + this.parameterType); > return this; > } In another part of the page, I use a Delegate to conditionally display a block. public Block getPairParameterInputBlock() { > System.out.println("Type2: " + this.parameterType); > if (this.parameterType == null) { > return null; > } > switch (this.parameterType) { > case TEXT: > return this.textPairParameterInput; > case NUMERIC: > return this.numericPairParameterInput; > default: > return null; > } > } What I'm facing there is that *this.parameterType* is always null and never sees the value set to it in the Select component's event handler method ! I understand there could be other ways to achieve the same behavior but why isn't this behaving as I expect ? *-* *Muhammad Gelbana* http://www.linkedin.com/in/mgelbana
Re: When should I use the PERTHREAD scope?
On Thu, 14 Nov 2013 18:57:24 -0200, George Christman wrote: On Thu, Nov 14, 2013 at 3:45 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: When your service has state (injected services doesn't count) which is per thread. Just to clarify, are you saying Injected services wouldn't work in a PerThread Scope? That's a different question and the answer is that they will work. Services won't stop working because they're being injected in a service with a given scope. Tapestry-IoC takes care of the scope and you can mix and match perthread and singleton scopes without even blinking. If your service has state and it (the state) should be the same for more than one thread (in your case, the lock), it cannot be per thread, otherwise you'd had one lock per thread, which would be useless in a multithreaded scenario. Also, considering the lock is a static member, it couldn't be shared across threads? Yep, but then it would make no sense for the service to be perthread, at least not with the code you posted. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: When should I use the PERTHREAD scope?
On Thu, Nov 14, 2013 at 3:45 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > When your service has state (injected services doesn't count) which is per > thread. > > Just to clarify, are you saying Injected services wouldn't work in a PerThread Scope? > > On Thu, 14 Nov 2013 18:35:47 -0200, George Christman < > gchrist...@cardaddy.com> wrote: > > Hello I'm looking to build a service where I would be Injecting a >> hibernate session as well as synchronizing a few methods for multi >> threading. I'm >> confused as for when I should be using the PERTHREAD scope. >> > > If your service has state and it (the state) should be the same for more > than one thread (in your case, the lock), it cannot be per thread, > otherwise you'd had one lock per thread, which would be useless in a > multithreaded scenario. > > Also, considering the lock is a static member, it couldn't be shared across threads? > > If I were to use the second example, would the getLogicMethod be >> synchronized across threads while being called from another service? >> > > Yes. That's how Java works. > Thanks Thiago. > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- George Christman www.CarDaddy.com P.O. Box 735 Johnstown, New York
Re: When should I use the PERTHREAD scope?
When your service has state (injected services doesn't count) which is per thread. On Thu, 14 Nov 2013 18:35:47 -0200, George Christman wrote: Hello I'm looking to build a service where I would be Injecting a hibernate session as well as synchronizing a few methods for multi threading. I'm confused as for when I should be using the PERTHREAD scope. If your service has state and it (the state) should be the same for more than one thread (in your case, the lock), it cannot be per thread, otherwise you'd had one lock per thread, which would be useless in a multithreaded scenario. If I were to use the second example, would the getLogicMethod be synchronized across threads while being called from another service? Yes. That's how Java works. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
When should I use the PERTHREAD scope?
Hello I'm looking to build a service where I would be Injecting a hibernate session as well as synchronizing a few methods for multi threading. I'm confused as for when I should be using the PERTHREAD scope. Scope(ScopeContants.PERTHREAD) public class MyServiceImpl.class implements MyService { private static final Object lock = new Object(); private final Session session; public MyServiceImpl(Session session) { this.session = session; } public void getLogicMethod(String value) { synchronized(lock) { //session do something } } } //Stateless Impl Example public class MyServiceImpl.class implements MyService { private final Session session; public MyServiceImpl(Session session) { this.session = session; } public synchronized void getLogicMethod(String value) { //session do something } } If I were to use the second example, would the getLogicMethod be synchronized across threads while being called from another service? Thanks Guys,
Re: @Scope PerThread may cause PermGen errors?
Yes, as I said the annotation was just there by accident. But thanks for making it clear. I guess using ObjectLocator.proxy has the same effect? One has to be careful not to misuse this feature. Well, Howards, thanks for taking the minute :-) I already had a peek at the latest 5.4 code and even got a small test-app running without problems so far. Great job! Am 30.11.2012 um 18:52 schrieb Howard Lewis Ship: > Per-thread scope means to create a new implementation, via the builder > method, once for every request: buldUserCacheSupport() is invoked the first > time any method of UserCacheSupport is invoked. > > EnvironmentalBuilder creates a proxy class and instance, and is intended to > only be invoked once per service; that is, a singleton service. Since it > is being invoked multiple times, it is creating one proxy class after > another, and these are accumulating in PermGen. > > There is no need to make UserCacheSupport per-thread, since everything in > the Environment is already per-thread. > > > On Fri, Nov 30, 2012 at 9:48 AM, Christian Riedel > wrote: > >> Hi everone, >> >> today I found the reason for a recent memory leak and I thought I'd ask >> what you think of it: >> >> Rather by accident I annotated one of the >> EnvironmentalShadowBuilder-methods with @Scope(PERTHREAD) >> >>@Scope(ScopeConstants.PERTHREAD) >>public UserCacheSupport buildUserCacheSupport() { >> >>return environmentalBuilder.build(UserCacheSupport.class); >>} >> >> (UserCacheSupport is just a custom environmental) >> >> So I removed the annotation and everything is ok again. >> >> But: Isn't that strange? Is that a known behavior? Using jhat I found >> thousands of undead UserCacheSupport classes tied to a PlasticClassLoader. >> So Plastic creates one class per request (i.e. per thread) and.. somehow >> keeps it. Without the explicit @Scope setting there should also be one new >> object per thread, but it does not cause a leak (since there's not a new >> class for each request, I guess). I'm wondering if it's actually a bug in >> Tapestry? >> >> Cheers >> Christian >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Scope PerThread may cause PermGen errors?
Per-thread scope means to create a new implementation, via the builder method, once for every request: buldUserCacheSupport() is invoked the first time any method of UserCacheSupport is invoked. EnvironmentalBuilder creates a proxy class and instance, and is intended to only be invoked once per service; that is, a singleton service. Since it is being invoked multiple times, it is creating one proxy class after another, and these are accumulating in PermGen. There is no need to make UserCacheSupport per-thread, since everything in the Environment is already per-thread. On Fri, Nov 30, 2012 at 9:48 AM, Christian Riedel wrote: > Hi everone, > > today I found the reason for a recent memory leak and I thought I'd ask > what you think of it: > > Rather by accident I annotated one of the > EnvironmentalShadowBuilder-methods with @Scope(PERTHREAD) > > @Scope(ScopeConstants.PERTHREAD) > public UserCacheSupport buildUserCacheSupport() { > > return environmentalBuilder.build(UserCacheSupport.class); > } > > (UserCacheSupport is just a custom environmental) > > So I removed the annotation and everything is ok again. > > But: Isn't that strange? Is that a known behavior? Using jhat I found > thousands of undead UserCacheSupport classes tied to a PlasticClassLoader. > So Plastic creates one class per request (i.e. per thread) and.. somehow > keeps it. Without the explicit @Scope setting there should also be one new > object per thread, but it does not cause a leak (since there's not a new > class for each request, I guess). I'm wondering if it's actually a bug in > Tapestry? > > Cheers > Christian > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
@Scope PerThread may cause PermGen errors?
Hi everone, today I found the reason for a recent memory leak and I thought I'd ask what you think of it: Rather by accident I annotated one of the EnvironmentalShadowBuilder-methods with @Scope(PERTHREAD) @Scope(ScopeConstants.PERTHREAD) public UserCacheSupport buildUserCacheSupport() { return environmentalBuilder.build(UserCacheSupport.class); } (UserCacheSupport is just a custom environmental) So I removed the annotation and everything is ok again. But: Isn't that strange? Is that a known behavior? Using jhat I found thousands of undead UserCacheSupport classes tied to a PlasticClassLoader. So Plastic creates one class per request (i.e. per thread) and.. somehow keeps it. Without the explicit @Scope setting there should also be one new object per thread, but it does not cause a leak (since there's not a new class for each request, I guess). I'm wondering if it's actually a bug in Tapestry? Cheers Christian - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Tapestry/Hibernate/Quartz/Perthread scope
Gratefully wondering if someone could validate my hunches about Tapestry. By way of background, I've got a Tapestry app that manages some training data for a machine learning process. The training process is time consuming, so I want to do that outside of the request/response cycle. I intend to have "training data changed" events dropped onto a message queue (just a shared, thread-safe queue) to a Quartz job. It wakes up from time to time, checks the queue, and returns the results of its calculations the same way (via a different queue). My sense is that the right way to go about this is to inject the HibernateSessionSource into my quartz bean, but manage transactions and close the session manually. Via tapestry-quartz, I could use Tapestry IoC to get the HibernateSessionSource into my quartz bean, but using @CommitAfter within my quartz bean is pointless since nothing will be setting up the quartz threads with Hibernate sessions, nor cleaning them up afterwards. Alternately, I'm wondering if there's some way to enrol quartz worker threads in Tapestry's notion of 'work-doing' threads, in a way that would cause whatever existing plumbing (e.g Hibernate) to work magically. Is this what PerthreadManager.run() is about? Can I just hand it a Runnable and (by virtue of the existing configuration provided by tapestry-hibernate) those runnables can @Inject a Session? Gratefully, Michael
Re: PerThread Scope and Assets
Thanks Howard :) On Fri, Jul 27, 2012 at 6:10 PM, Howard Lewis Ship wrote: > I wouldn't worry about it; there's a lot of caching going on inside > AssetSourceImpl. > > Don't prematurely optimize ... but plan to do real performance testing > if you are expecting your application to be regurlarily saturated. > Otherwise, keep your eyes on your database queries and let the rest > shake out. > > On Fri, Jul 27, 2012 at 1:13 PM, Juan E. Maya wrote: >> Hello, >> >> first of all i am very glad to go back to work with T5 :) I was >> missing the mailing list. :) >> >> I know the PerThread scope service are created per request, but i >> don't want the object to be created for every asset that is loaded, i >> only needed for the PageRender cycle. >> Is there a way to avoid the extra instantiations ? >> >> Thank you >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: PerThread Scope and Assets
I wouldn't worry about it; there's a lot of caching going on inside AssetSourceImpl. Don't prematurely optimize ... but plan to do real performance testing if you are expecting your application to be regurlarily saturated. Otherwise, keep your eyes on your database queries and let the rest shake out. On Fri, Jul 27, 2012 at 1:13 PM, Juan E. Maya wrote: > Hello, > > first of all i am very glad to go back to work with T5 :) I was > missing the mailing list. :) > > I know the PerThread scope service are created per request, but i > don't want the object to be created for every asset that is loaded, i > only needed for the PageRender cycle. > Is there a way to avoid the extra instantiations ? > > Thank you > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
PerThread Scope and Assets
Hello, first of all i am very glad to go back to work with T5 :) I was missing the mailing list. :) I know the PerThread scope service are created per request, but i don't want the object to be created for every asset that is loaded, i only needed for the PageRender cycle. Is there a way to avoid the extra instantiations ? Thank you - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Scope
Tapestry's style of injection is somewhat orthogonal to Spring's. Tapestry will want to create a proxy and, with a contribution like Thiago says, instantiate a new instance for each method invocation. That's probably not what you want, in which case, you should use an explicit factory service, so you can ask for a new instance when it makes sense. On Wed, Oct 12, 2011 at 3:15 PM, Thiago H. de Paula Figueiredo wrote: > On Wed, 12 Oct 2011 18:28:06 -0300, Tony Nelson > wrote: > >> This particular service could have just as easily been a pojo. I'm >> converting a tapestry4/spring application to tapestry5 and I'm trying to >> leave spring behind. As a spring bean this object was simply declared with >> scope="prototype" which gave me a new instance of the object every time I >> accessed it. > > Tapestry-IoC doesn't have a prototype scope out of the box, but it shouldn't > be hard: implement a ServiceLifecycle2 and contribute it to the > ServiceLifecycleSource service configuration. I've never tried that, though. > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and > instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Scope
On Wed, 12 Oct 2011 18:28:06 -0300, Tony Nelson wrote: This particular service could have just as easily been a pojo. I'm converting a tapestry4/spring application to tapestry5 and I'm trying to leave spring behind. As a spring bean this object was simply declared with scope="prototype" which gave me a new instance of the object every time I accessed it. Tapestry-IoC doesn't have a prototype scope out of the box, but it shouldn't be hard: implement a ServiceLifecycle2 and contribute it to the ServiceLifecycleSource service configuration. I've never tried that, though. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Scope
This particular service could have just as easily been a pojo. I'm converting a tapestry4/spring application to tapestry5 and I'm trying to leave spring behind. As a spring bean this object was simply declared with scope="prototype" which gave me a new instance of the object every time I accessed it. It does look like autobuild will do what I need. I'll give it a try. Thank you very much. Tony On Oct 12, 2011, at 5:21 PM, Cezary Biernacki wrote: > Hi, > you can inject ObjectLocator and call 'autobuild' to create a new instance > when needed. So instead of > > @Inject private MyService myService; > ... > myService.doSomething(); > > you would have > @Inject private ObjectLocator locator; > > > locator.autobuild(MyService.class).doSomething(). > > > However I am not sure if your design is correct - do you need really to save > state in the service? It does not look like a proper service. > > Best regards, > Cezary > > > On Wed, Oct 12, 2011 at 11:11 PM, Tony Nelson wrote: > >> I have a service, that I need a new instance of every time it is >> referenced. In ScopeConstants I see DEFAULT, and PERTHREAD. I really need >> a new instance every time I request this particular service because it saves >> state, and yes, there are some occasions where I need several of these in >> the same thread (web request). >> >> For now, I can change all of my references to the service to a new >> instantiation of the implementing class, but that really isn't ideal. >> >> Does anyone have any idea how difficulty this type of change might be, and >> if it might be possible to get it into a 5.3-beta? >> >> Thanks >> Tony >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Scope
Hi, you can inject ObjectLocator and call 'autobuild' to create a new instance when needed. So instead of @Inject private MyService myService; ... myService.doSomething(); you would have @Inject private ObjectLocator locator; locator.autobuild(MyService.class).doSomething(). However I am not sure if your design is correct - do you need really to save state in the service? It does not look like a proper service. Best regards, Cezary On Wed, Oct 12, 2011 at 11:11 PM, Tony Nelson wrote: > I have a service, that I need a new instance of every time it is > referenced. In ScopeConstants I see DEFAULT, and PERTHREAD. I really need > a new instance every time I request this particular service because it saves > state, and yes, there are some occasions where I need several of these in > the same thread (web request). > > For now, I can change all of my references to the service to a new > instantiation of the implementing class, but that really isn't ideal. > > Does anyone have any idea how difficulty this type of change might be, and > if it might be possible to get it into a 5.3-beta? > > Thanks > Tony > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
@Scope
I have a service, that I need a new instance of every time it is referenced. In ScopeConstants I see DEFAULT, and PERTHREAD. I really need a new instance every time I request this particular service because it saves state, and yes, there are some occasions where I need several of these in the same thread (web request). For now, I can change all of my references to the service to a new instantiation of the implementing class, but that really isn't ideal. Does anyone have any idea how difficulty this type of change might be, and if it might be possible to get it into a 5.3-beta? Thanks Tony - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
As a side note: in 5.2 you CAN inject a Messages object at the service layer ... this Messages object provides access to the application's global message catalog (i.e., WEB-INF/app.properties). It's a proxy Messages that internally determines the current Locale and delegates to the correct localization of the global message catalog. On Tue, Aug 30, 2011 at 3:10 AM, nillehammer wrote: >>> public Object doSomethingUseful(Object someParameter, Messages messages) > {...} > Yes, exactly > > In your page/component class: > @Inject > private Messages messages; > > @Inject > MyService myService; > > private Object myValue; > > public final Object getValueFromService() { > return this.myService.doSomethingUseful(this.myObject, this.messages); > } > > In your tml: > > (I try to do method calls with parameters in the java code and avoid them in > the tml, but that is a question of taste). > > > - > http://www.winfonet.eu > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4749543.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
>> public Object doSomethingUseful(Object someParameter, Messages messages) {...} Yes, exactly In your page/component class: @Inject private Messages messages; @Inject MyService myService; private Object myValue; public final Object getValueFromService() { return this.myService.doSomethingUseful(this.myObject, this.messages); } In your tml: (I try to do method calls with parameters in the java code and avoid them in the tml, but that is a question of taste). - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4749543.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
On Mon, 29 Aug 2011 20:53:00 -0300, Paul Stanton wrote: just injecting messages didn't work when i tried it. Caused by: java.lang.RuntimeException: No service implements the interface org.apache.tapestry5.ioc.Messages. Maybe a 'service' isn't what I'm after, Messages isn't a service. It's injection is specially handled for components, pages and mixins only. This is implemented in CommonResourcesInjectionProvider, if you want to check the source. :) It just delegates to the getMessages() method of ComponentResources. but there MUST be a way to do this. Similar to how ComponentResources is configured. Just like ComponentResources: only injectable in the object (component, page or mixin) itself. In your component (or page or mixin class) @Inject private Messages messages; -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
Do you mean I should do the following: public Object doSomethingUseful(Object someParameter, Messages messages) {...} and thereby call: for example? On 30/08/2011 10:14 AM, nillehammer wrote: Don't inject it in the constructor. That isn't possible. Define the Messages as an (additional) parameter to your service method. (This is sometimes referred to as method-Injection, a misleading term in my humble opinion). - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4748239.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
Don't inject it in the constructor. That isn't possible. Define the Messages as an (additional) parameter to your service method. (This is sometimes referred to as method-Injection, a misleading term in my humble opinion). - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4748239.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
just injecting messages didn't work when i tried it. Caused by: java.lang.RuntimeException: No service implements the interface org.apache.tapestry5.ioc.Messages. at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:560) at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getService(ObjectLocatorImpl.java:44) at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:56) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) FYI i'm using 5.1.0.5 Maybe a 'service' isn't what I'm after, but there MUST be a way to do this. Similar to how ComponentResources is configured. Regards, Paul. On 24/08/2011 11:31 PM, Steve Eynon wrote: Hi, If you just want messages for your service (as in messages defined in MyService.properties) then, as nillihammer suggests, simply inject a Messages object. This is because Messages is actually an org.apache.tapestry5.ioc.Messages and is defined and utilised by the IOC layer. I believe Tapestry-Core extends the principle and provides a chain of message objects beginning with the one defined for the current Component / Page. For which object do you need messages for? Steve. -- Steve Eynon mobie: 0750 424 5743 On 24 August 2011 19:53, nillehammer wrote: The easiest way is to define your service methods with an additional Messages parameter. This way you can use the Messages within the service methods. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4730146.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
Hi, If you just want messages for your service (as in messages defined in MyService.properties) then, as nillihammer suggests, simply inject a Messages object. This is because Messages is actually an org.apache.tapestry5.ioc.Messages and is defined and utilised by the IOC layer. I believe Tapestry-Core extends the principle and provides a chain of message objects beginning with the one defined for the current Component / Page. For which object do you need messages for? Steve. -- Steve Eynon mobie: 0750 424 5743 On 24 August 2011 19:53, nillehammer wrote: > The easiest way is to define your service methods with an additional Messages > parameter. This way you can use the Messages within the service methods. > > - > http://www.winfonet.eu > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4730146.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: component scope service with injected messages
The easiest way is to define your service methods with an additional Messages parameter. This way you can use the Messages within the service methods. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4730146.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
component scope service with injected messages
Hi all, I am aware that there is something special about tapestry services/resources such as Request, Messages etc which are only available in the context of a component render. I need to create a service which makes heavy use of the messages store and is available only in the scope of a component render. Can someone explain how I can configure this service correctly so that I can create it with the appropriated Messages object each time it is used? Thanks, Paul. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application Scope
Thanks Robert -- View this message in context: http://tapestry.1045711.n5.nabble.com/Application-Scope-tp3246646p4716851.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application Scope
See: http://tapestry.apache.org/community.html And check out the various modules and tutorials listed. Cheers, Robert On Aug 19, 2011, at 8/192:46 PM , George Christman wrote: > Is there any examples on how to create my own service? > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Application-Scope-tp3246646p4716830.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application Scope
Is there any examples on how to create my own service? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Application-Scope-tp3246646p4716830.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry IoC: Bean Scope
On Tue, 07 Jun 2011 14:47:10 -0300, Dmitriy Vsekhvalnov wrote: did i get you right, that i can simply inject ObjectLocator service to my Quartz JobFactory and instantiate jobs via autobuild() I mean sources saying all dependencies will be injected. Yes. JavaDoc: Autobuilds a class by finding the public constructor with the most parameters. Services and resources will be injected into the parameters of the constructor. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry IoC: Bean Scope
did i get you right, that i can simply inject ObjectLocator service to my Quartz JobFactory and instantiate jobs via autobuild() I mean sources saying all dependencies will be injected. On Tue, Jun 7, 2011 at 8:20 PM, Howard Lewis Ship wrote: > Unfortunately, Tapestry is not Spring :-) The proxy you get back from > a direct or indrect call to getService() is always global, though in > the case of the perthread scope, that core service implementation is > ... another proxy that manages and delegates to the per-thread > instance. > > I think you need to use an explicit factory if you want to control > when new instances are created. In fact, for ordinary beans, you can > get the BeanModelSource, get a BeanModel for a class, and use its > newInstance() method. > > However, that's roundabout, because newInstance() gets the > ObjectLocator (which can be injected into any service) and invokes > autobuild() on it ... so it's a very generic factory. > > On Tue, Jun 7, 2011 at 8:52 AM, Dmitriy Vsekhvalnov > wrote: > > i was hoping someone already did it :) > > > > Last time i was trying to do it with Hivemind, proxy created a new > instance > > every method call, and this is not what i want. I mostly likely want > > no-proxy, but just new instance. > > > > On Tue, Jun 7, 2011 at 6:32 PM, Thiago H. de Paula Figueiredo < > > thiag...@gmail.com> wrote: > > > >> On Tue, 07 Jun 2011 10:47:23 -0300, Dmitriy Vsekhvalnov < > >> dvsekhval...@gmail.com> wrote: > >> > >> Hi all, > >>> > >> > >> Hi! > >> > >> > >>is it possible to have services bound with Bean scope? I'm using > Quartz > >>> scheduler and my jobs are actually services bound in AppModule with all > >>> dependency injection and so on. > >>> But i want different instances of jobs. So every time i call > >>> ServiceResources:getService(..., Job.class) > >>> i want new instance back. > >>> > >> > >> Is what do you want the same as the prototype scope in Spring? > >> > >> > >> I remember it was not possible to implement with Hivemind, how about > >>> Tapestry-IOC? > >>> > >> > >> Tapestry-IoC provides singleton and per-thread scopes out of the box, > but > >> you can add your own ones. Implement ServiceLifecycle2 and contribute it > to > >> the ServiceLifecycleSource service. Take a look at the > >> PerThreadServiceLifecycle source for an example. > >> > >> -- > >> Thiago H. de Paula Figueiredo > >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > >> and instructor > >> Owner, Ars Machina Tecnologia da Informação Ltda. > >> http://www.arsmachina.com.br > >> > > > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: Tapestry IoC: Bean Scope
Unfortunately, Tapestry is not Spring :-) The proxy you get back from a direct or indrect call to getService() is always global, though in the case of the perthread scope, that core service implementation is ... another proxy that manages and delegates to the per-thread instance. I think you need to use an explicit factory if you want to control when new instances are created. In fact, for ordinary beans, you can get the BeanModelSource, get a BeanModel for a class, and use its newInstance() method. However, that's roundabout, because newInstance() gets the ObjectLocator (which can be injected into any service) and invokes autobuild() on it ... so it's a very generic factory. On Tue, Jun 7, 2011 at 8:52 AM, Dmitriy Vsekhvalnov wrote: > i was hoping someone already did it :) > > Last time i was trying to do it with Hivemind, proxy created a new instance > every method call, and this is not what i want. I mostly likely want > no-proxy, but just new instance. > > On Tue, Jun 7, 2011 at 6:32 PM, Thiago H. de Paula Figueiredo < > thiag...@gmail.com> wrote: > >> On Tue, 07 Jun 2011 10:47:23 -0300, Dmitriy Vsekhvalnov < >> dvsekhval...@gmail.com> wrote: >> >> Hi all, >>> >> >> Hi! >> >> >> is it possible to have services bound with Bean scope? I'm using Quartz >>> scheduler and my jobs are actually services bound in AppModule with all >>> dependency injection and so on. >>> But i want different instances of jobs. So every time i call >>> ServiceResources:getService(..., Job.class) >>> i want new instance back. >>> >> >> Is what do you want the same as the prototype scope in Spring? >> >> >> I remember it was not possible to implement with Hivemind, how about >>> Tapestry-IOC? >>> >> >> Tapestry-IoC provides singleton and per-thread scopes out of the box, but >> you can add your own ones. Implement ServiceLifecycle2 and contribute it to >> the ServiceLifecycleSource service. Take a look at the >> PerThreadServiceLifecycle source for an example. >> >> -- >> Thiago H. de Paula Figueiredo >> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, >> and instructor >> Owner, Ars Machina Tecnologia da Informação Ltda. >> http://www.arsmachina.com.br >> > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry IoC: Bean Scope
i was hoping someone already did it :) Last time i was trying to do it with Hivemind, proxy created a new instance every method call, and this is not what i want. I mostly likely want no-proxy, but just new instance. On Tue, Jun 7, 2011 at 6:32 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Tue, 07 Jun 2011 10:47:23 -0300, Dmitriy Vsekhvalnov < > dvsekhval...@gmail.com> wrote: > > Hi all, >> > > Hi! > > >is it possible to have services bound with Bean scope? I'm using Quartz >> scheduler and my jobs are actually services bound in AppModule with all >> dependency injection and so on. >> But i want different instances of jobs. So every time i call >> ServiceResources:getService(..., Job.class) >> i want new instance back. >> > > Is what do you want the same as the prototype scope in Spring? > > > I remember it was not possible to implement with Hivemind, how about >> Tapestry-IOC? >> > > Tapestry-IoC provides singleton and per-thread scopes out of the box, but > you can add your own ones. Implement ServiceLifecycle2 and contribute it to > the ServiceLifecycleSource service. Take a look at the > PerThreadServiceLifecycle source for an example. > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br >
Re: Tapestry IoC: Bean Scope
On Tue, 07 Jun 2011 10:47:23 -0300, Dmitriy Vsekhvalnov wrote: Hi all, Hi! is it possible to have services bound with Bean scope? I'm using Quartz scheduler and my jobs are actually services bound in AppModule with all dependency injection and so on. But i want different instances of jobs. So every time i call ServiceResources:getService(..., Job.class) i want new instance back. Is what do you want the same as the prototype scope in Spring? I remember it was not possible to implement with Hivemind, how about Tapestry-IOC? Tapestry-IoC provides singleton and per-thread scopes out of the box, but you can add your own ones. Implement ServiceLifecycle2 and contribute it to the ServiceLifecycleSource service. Take a look at the PerThreadServiceLifecycle source for an example. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Tapestry IoC: Bean Scope
Hi all, is it possible to have services bound with Bean scope? I'm using Quartz scheduler and my jobs are actually services bound in AppModule with all dependency injection and so on. But i want different instances of jobs. So every time i call ServiceResources:getService(..., Job.class) i want new instance back. I remember it was not possible to implement with Hivemind, how about Tapestry-IOC? Thanks.
Re: Advising a Scope PerThread Services with Context
On Fri, 04 Mar 2011 14:40:54 -0300, rektide wrote: At present, I'm trying to build a MethodAdvice implementation that modifies the behavior of a PerThread Scope'd service. The fact that your service has perthread scope shouldn't change anything. The MethodAdvice needs access to the public members of the Service to perform this advising. What do you mean by public members? Fields? Methods in the service interface? Methods not in the service interface? You shouldn't rely in anything outside methods defined in the service interface. The module that fires the MethodAdviceReceiver can be injected in to, but this is a one time initialization action: it rebuild the MethodAdvice per-request. I've tried various injection annotations in the MethodAdvice itself, but havent had any luck. Is there some programatic means of requesting a Service that I can run inside the MethodAdvice to pull out the current instance of my Service? Any service, including per-threads one, is accessed through a proxy. The the service is per-thread, the proxy will delegate method calls to the appropriate instance. Have you tried decoration instead of advising? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Advising a Scope PerThread Services with Context
Hello everyone. I'm new here, so let me just say hello. I'm rektide, I've been using Tapestry 5.1 since July 2010. Been mostly great, with the main caveat being trying to figure out how to coax my app into having enough context when I run Ajax requests. The component model is awesome, the IOC engine works great, the JS integration is like nothing I've seen & has proved time & time again quite flexible. Good stuff, thanks all. At present, I'm trying to build a MethodAdvice implementation that modifies the behavior of a PerThread Scope'd service. The MethodAdvice needs access to the public members of the Service to perform this advising. I cant find any way to get the Service instance from inside the MethodAdvice. The module that fires the MethodAdviceReceiver can be injected in to, but this is a one time initialization action: it rebuild the MethodAdvice per-request. I've tried various injection annotations in the MethodAdvice itself, but havent had any luck. Is there some programatic means of requesting a Service that I can run inside the MethodAdvice to pull out the current instance of my Service? As a note, it would be awfully handy if Invocation had a getThis() method! Or if the advise method had a second parameter to provide that context! Any suggestions for now, on how to get the Service being advised from within the MethodAdvisor? Regards & thanks, -rektide - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application Scope
On Tue, 02 Nov 2010 10:46:57 -0200, Ulrich Stärk wrote: Not build-in but you can write yourself some singleton service around a hashmap or something. I'd like to add that Tapestry never had an application scope. ApplicationState was renamend to SessionState exactly to prevent this kind of confusion. The application scope in the Servlets API is, in my humble opinion, a very bad idea. As Mats suggested, just create a service that encapsulates the data you need. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application Scope
One solution is to implement your own tapestry service for this. BR Mats Stephan Windmüller skrev 2010-11-02 13:36: Hi! Since the ApplicationState annotation has been renamed to SessionState, I am wondering if there is a usable Application scope in Tapestry where I can store data globally for the application? TIA Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application Scope
Not build-in but you can write yourself some singleton service around a hashmap or something. Uli On 02.11.2010 13:36, Stephan Windmüller wrote: Hi! Since the ApplicationState annotation has been renamed to SessionState, I am wondering if there is a usable Application scope in Tapestry where I can store data globally for the application? TIA Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Application Scope
Hi! Since the ApplicationState annotation has been renamed to SessionState, I am wondering if there is a usable Application scope in Tapestry where I can store data globally for the application? TIA Stephan - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: RenderSupport Scope
Thank you Martin! 2010/5/30 Martin Strand > If you want to declare a global function from within Tapestry.onDOMLoaded, > you can simply add it to the windows object: > > window.myGlobalFunction = function() { > doCoolStuff(); > } > > You can then access that function from anywhere if you prefer to do things > this way: > > > > > Martin > > > On Sun, 30 May 2010 04:59:44 +0200, Pablo dos Reis > wrote: > > Hi Thiago, >> >> When the Tapestry creates the script. >> It puts the script inside a other method. >> Tapestry.onDOMLoaded() in this case. >> >> So when I try call it method using a js the method created by >> RenderSupport >> is not visible for js. >> >> >> >> I resolved the following >> writer.element("script", "language", "JavaScript"); >>writer.write(script); >>writer.end(); >> >> Then ran!! >> >> But maybe is not the better way. >> >> I had to use RenderSupport because in js I don't know the element's id for >> implements a method that return the component value. >> >> 2010/5/29 Thiago H. de Paula Figueiredo >> >> On Sat, 29 May 2010 23:18:28 -0300, Pablo dos Reis < >>> pablodosr...@gmail.com> >>> wrote: >>> >>> When I inject javaScript using renderSupport not is possible access the >>> methods created in the class through a js file. >>> Hi, Pablo! >>> >>> I'm not sure what you're talking about, but remember that any JavaScript >>> code added through RenderSupport.addScript() ends up in a
Re: RenderSupport Scope
If you want to declare a global function from within Tapestry.onDOMLoaded, you can simply add it to the windows object: window.myGlobalFunction = function() { doCoolStuff(); } You can then access that function from anywhere if you prefer to do things this way: Martin On Sun, 30 May 2010 04:59:44 +0200, Pablo dos Reis wrote: Hi Thiago, When the Tapestry creates the script. It puts the script inside a other method. Tapestry.onDOMLoaded() in this case. So when I try call it method using a js the method created by RenderSupport is not visible for js. I resolved the following writer.element("script", "language", "JavaScript"); writer.write(script); writer.end(); Then ran!! But maybe is not the better way. I had to use RenderSupport because in js I don't know the element's id for implements a method that return the component value. 2010/5/29 Thiago H. de Paula Figueiredo On Sat, 29 May 2010 23:18:28 -0300, Pablo dos Reis wrote: When I inject javaScript using renderSupport not is possible access the methods created in the class through a js file. Hi, Pablo! I'm not sure what you're talking about, but remember that any JavaScript code added through RenderSupport.addScript() ends up in a
Re: RenderSupport Scope
Hi Thiago, When the Tapestry creates the script. It puts the script inside a other method. Tapestry.onDOMLoaded() in this case. So when I try call it method using a js the method created by RenderSupport is not visible for js. I resolved the following writer.element("script", "language", "JavaScript"); writer.write(script); writer.end(); Then ran!! But maybe is not the better way. I had to use RenderSupport because in js I don't know the element's id for implements a method that return the component value. 2010/5/29 Thiago H. de Paula Figueiredo > On Sat, 29 May 2010 23:18:28 -0300, Pablo dos Reis > wrote: > > When I inject javaScript using renderSupport not is possible access the >> methods created in the class through a js file. >> > > Hi, Pablo! > > I'm not sure what you're talking about, but remember that any JavaScript > code added through RenderSupport.addScript() ends up in a
Re: RenderSupport Scope
On Sat, 29 May 2010 23:18:28 -0300, Pablo dos Reis wrote: When I inject javaScript using renderSupport not is possible access the methods created in the class through a js file. Hi, Pablo! I'm not sure what you're talking about, but remember that any JavaScript code added through RenderSupport.addScript() ends up in a
RenderSupport Scope
When I inject javaScript using renderSupport not is possible access the methods created in the class through a js file. Are there a way for access a JavaScript method overrided using renderSupport for a classe outside it, in the js for exemple ? -- Pablo Henrique dos Reis
Re: T5: Testing service scope
Thanks anyway :) I guess integration tests on a real registry will be put on hold for now then, since the only viable solution is to implement stubs for some services, which makes me unable to mock and verify their behaviour, which limits my tests quite a bit... I find integration testing in Tapestry 5, both pages, components and services, to be quite hard in general. Our system has a lot of spring beans injected as well as T5 IOC services, so there is a lot to take care of in my test registry before I can actually get some testing done on my pages. Lots of database and filesystem stuff that needs to be mocked/stubbed in a meaningful and mantainable way. But I'll continue trying to find an approach that makes sense :) Inge On Tue, Feb 23, 2010 at 2:13 PM, Paul Field wrote: > Ah - OK. I don't think there's an easy way to do this at the moment. The > obvious way is to either use the registry with real dependencies or else > create a TestModule to fake the dependencies (but you have already > discounted this approach). > > I've been toying with this kind of functionality for Testify, but there > are no easy hooks into the registry creation process that would let me do > it. I do have another ingenious idea though :-) > > Paul > > Inge Solvoll wrote on 23/02/2010 12:51:18: > > > That's what I'm already doing. This time I wanted to test that the > perthread > > scope of my service worked like it should, that's why I need to do an > > integration test with a real live registry. > > > > On Tue, Feb 23, 2010 at 12:42 PM, Paul Field wrote: > > > > > Hi Inge, > > > > > > Testify doesn't support overriding services actually within the > repository > > > (currently, it make components check for overrides before going to the > > > registry - hence the annotation name @ForComponents). > > > > > > However, would a simple unit test of the service do the trick for you? > In > > > other words, just create the ModuleOrderProvider by hand, passing in > the > > > mocked/faked dependencies : > > > ModuleOrderProvider u = new ModuleOrderProviderImpl(settingsFacade); > > > > > > - Paul > > > > > > > > > > > > Inge Solvoll wrote on 23/02/2010 10:42:52: > > > > > > > Ok, so now I need to mock one of the dependencies of a service I'm > > > testing. > > > > I realized that I don't know how to do that when I manually created > my > > > > registry. I don't want to have a "TestModule" that builds fakes for > my > > > > external dependencies, in this case it is enough to just mock the > > > service > > > > that provides configuration values. > > > > > > > > Then I tried using testify, like below, but Mockito claims that my > > > > "settings" service is not a mock, so I guess testify isn't built to > > > support > > > > this kind of mocking... Any ideas? > > > > > > > > @Mock > > > > @ForComponents > > > > private SettingsFacade settings; > > > > > > > > @Test > > > > public void settingValueIsCachedInThread() { > > > > when(settings.get(MODULE_ORDER)).thenReturn("module1,module2"); > > > > ModuleOrderProvider u = > > > tester.getService(ModuleOrderProvider.class); // > > > > This service dependes on the SettingsFacade service > > > > u.getOrder(); > > > > u.getOrder(); > > > > verify(settings.get(MODULE_ORDER), times(1)); > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Feb 18, 2010 at 8:58 AM, Ulrich Stärk > wrote: > > > > > > > > > Hmm, you are right. > > > > > > > > > > The builder method for that service would be called multiple times > > > though > > > > > IIRC. Maybe somehow check that then? > > > > > > > > > > Uli > > > > > > > > > > On 17.02.2010 23:32 schrieb Martin Strand: > > > > > > > > > > Hmm, why different instances? Wouldn't every thread see the same > > > proxy > > > > >> instance? > > > > >> > > > > >> Martin > > > > >> > > > > >> On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk > > > > > >> w
Re: T5: Testing service scope
Ah - OK. I don't think there's an easy way to do this at the moment. The obvious way is to either use the registry with real dependencies or else create a TestModule to fake the dependencies (but you have already discounted this approach). I've been toying with this kind of functionality for Testify, but there are no easy hooks into the registry creation process that would let me do it. I do have another ingenious idea though :-) Paul Inge Solvoll wrote on 23/02/2010 12:51:18: > That's what I'm already doing. This time I wanted to test that the perthread > scope of my service worked like it should, that's why I need to do an > integration test with a real live registry. > > On Tue, Feb 23, 2010 at 12:42 PM, Paul Field wrote: > > > Hi Inge, > > > > Testify doesn't support overriding services actually within the repository > > (currently, it make components check for overrides before going to the > > registry - hence the annotation name @ForComponents). > > > > However, would a simple unit test of the service do the trick for you? In > > other words, just create the ModuleOrderProvider by hand, passing in the > > mocked/faked dependencies : > > ModuleOrderProvider u = new ModuleOrderProviderImpl(settingsFacade); > > > > - Paul > > > > > > > > Inge Solvoll wrote on 23/02/2010 10:42:52: > > > > > Ok, so now I need to mock one of the dependencies of a service I'm > > testing. > > > I realized that I don't know how to do that when I manually created my > > > registry. I don't want to have a "TestModule" that builds fakes for my > > > external dependencies, in this case it is enough to just mock the > > service > > > that provides configuration values. > > > > > > Then I tried using testify, like below, but Mockito claims that my > > > "settings" service is not a mock, so I guess testify isn't built to > > support > > > this kind of mocking... Any ideas? > > > > > > @Mock > > > @ForComponents > > > private SettingsFacade settings; > > > > > > @Test > > > public void settingValueIsCachedInThread() { > > > when(settings.get(MODULE_ORDER)).thenReturn("module1,module2"); > > > ModuleOrderProvider u = > > tester.getService(ModuleOrderProvider.class); // > > > This service dependes on the SettingsFacade service > > > u.getOrder(); > > > u.getOrder(); > > > verify(settings.get(MODULE_ORDER), times(1)); > > > } > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Feb 18, 2010 at 8:58 AM, Ulrich Stärk wrote: > > > > > > > Hmm, you are right. > > > > > > > > The builder method for that service would be called multiple times > > though > > > > IIRC. Maybe somehow check that then? > > > > > > > > Uli > > > > > > > > On 17.02.2010 23:32 schrieb Martin Strand: > > > > > > > > Hmm, why different instances? Wouldn't every thread see the same > > proxy > > > >> instance? > > > >> > > > >> Martin > > > >> > > > >> On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk > > > >> wrote: > > > >> > > > >> Querying the registry for the same service from different threads > > > >>> should yield different instances > > > >>> when using the perthread scope. Just test that. No need for a > > request > > > >>> if your service doesn't > > > >>> require one. > > > >>> > > > >>> Uli > > > >>> > > > >>> On 17.02.2010 11:42 schrieb Inge Solvoll: > > > >>> > > > >>>> Hi! > > > >>>> > > > >>>> I recently encountered a bug in one of my services, where it had > > the > > > >>>> wrong > > > >>>> scope because I put the scope annotation on the interface rather > > than > > > >>>> on the > > > >>>> implementing class. I got the idea that I could manually create a > > T5 IOC > > > >>>> registry to do integration testing on my services. But how can I > > test > > > >>>> "perthread" scope on services in the test registry when there are >
Re: T5: Testing service scope
That's what I'm already doing. This time I wanted to test that the perthread scope of my service worked like it should, that's why I need to do an integration test with a real live registry. On Tue, Feb 23, 2010 at 12:42 PM, Paul Field wrote: > Hi Inge, > > Testify doesn't support overriding services actually within the repository > (currently, it make components check for overrides before going to the > registry - hence the annotation name @ForComponents). > > However, would a simple unit test of the service do the trick for you? In > other words, just create the ModuleOrderProvider by hand, passing in the > mocked/faked dependencies : > ModuleOrderProvider u = new ModuleOrderProviderImpl(settingsFacade); > > - Paul > > > > Inge Solvoll wrote on 23/02/2010 10:42:52: > > > Ok, so now I need to mock one of the dependencies of a service I'm > testing. > > I realized that I don't know how to do that when I manually created my > > registry. I don't want to have a "TestModule" that builds fakes for my > > external dependencies, in this case it is enough to just mock the > service > > that provides configuration values. > > > > Then I tried using testify, like below, but Mockito claims that my > > "settings" service is not a mock, so I guess testify isn't built to > support > > this kind of mocking... Any ideas? > > > > @Mock > > @ForComponents > > private SettingsFacade settings; > > > > @Test > > public void settingValueIsCachedInThread() { > > when(settings.get(MODULE_ORDER)).thenReturn("module1,module2"); > > ModuleOrderProvider u = > tester.getService(ModuleOrderProvider.class); // > > This service dependes on the SettingsFacade service > > u.getOrder(); > > u.getOrder(); > > verify(settings.get(MODULE_ORDER), times(1)); > > } > > > > > > > > > > > > > > > > On Thu, Feb 18, 2010 at 8:58 AM, Ulrich Stärk wrote: > > > > > Hmm, you are right. > > > > > > The builder method for that service would be called multiple times > though > > > IIRC. Maybe somehow check that then? > > > > > > Uli > > > > > > On 17.02.2010 23:32 schrieb Martin Strand: > > > > > > Hmm, why different instances? Wouldn't every thread see the same > proxy > > >> instance? > > >> > > >> Martin > > >> > > >> On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk > > >> wrote: > > >> > > >> Querying the registry for the same service from different threads > > >>> should yield different instances > > >>> when using the perthread scope. Just test that. No need for a > request > > >>> if your service doesn't > > >>> require one. > > >>> > > >>> Uli > > >>> > > >>> On 17.02.2010 11:42 schrieb Inge Solvoll: > > >>> > > >>>> Hi! > > >>>> > > >>>> I recently encountered a bug in one of my services, where it had > the > > >>>> wrong > > >>>> scope because I put the scope annotation on the interface rather > than > > >>>> on the > > >>>> implementing class. I got the idea that I could manually create a > T5 IOC > > >>>> registry to do integration testing on my services. But how can I > test > > >>>> "perthread" scope on services in the test registry when there are > no > > >>>> real > > >>>> requests? I'm assuming this requires mocking the Request object in > > >>>> some way? > > >>>> > > >>>> Inge > > >>>> > > >>> > > >> - > > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > >> For additional commands, e-mail: users-h...@tapestry.apache.org > > >> > > >> > > > - > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > > > > --- > > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and delete this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > > Please refer to http://www.db.com/en/content/eu_disclosures.htm for > additional EU corporate and regulatory disclosures.
Re: T5: Testing service scope
Hi Inge, Testify doesn't support overriding services actually within the repository (currently, it make components check for overrides before going to the registry - hence the annotation name @ForComponents). However, would a simple unit test of the service do the trick for you? In other words, just create the ModuleOrderProvider by hand, passing in the mocked/faked dependencies : ModuleOrderProvider u = new ModuleOrderProviderImpl(settingsFacade); - Paul Inge Solvoll wrote on 23/02/2010 10:42:52: > Ok, so now I need to mock one of the dependencies of a service I'm testing. > I realized that I don't know how to do that when I manually created my > registry. I don't want to have a "TestModule" that builds fakes for my > external dependencies, in this case it is enough to just mock the service > that provides configuration values. > > Then I tried using testify, like below, but Mockito claims that my > "settings" service is not a mock, so I guess testify isn't built to support > this kind of mocking... Any ideas? > > @Mock > @ForComponents > private SettingsFacade settings; > > @Test > public void settingValueIsCachedInThread() { > when(settings.get(MODULE_ORDER)).thenReturn("module1,module2"); > ModuleOrderProvider u = tester.getService(ModuleOrderProvider.class); // > This service dependes on the SettingsFacade service > u.getOrder(); > u.getOrder(); > verify(settings.get(MODULE_ORDER), times(1)); > } > > > > > > > > On Thu, Feb 18, 2010 at 8:58 AM, Ulrich Stärk wrote: > > > Hmm, you are right. > > > > The builder method for that service would be called multiple times though > > IIRC. Maybe somehow check that then? > > > > Uli > > > > On 17.02.2010 23:32 schrieb Martin Strand: > > > > Hmm, why different instances? Wouldn't every thread see the same proxy > >> instance? > >> > >> Martin > >> > >> On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk > >> wrote: > >> > >> Querying the registry for the same service from different threads > >>> should yield different instances > >>> when using the perthread scope. Just test that. No need for a request > >>> if your service doesn't > >>> require one. > >>> > >>> Uli > >>> > >>> On 17.02.2010 11:42 schrieb Inge Solvoll: > >>> > >>>> Hi! > >>>> > >>>> I recently encountered a bug in one of my services, where it had the > >>>> wrong > >>>> scope because I put the scope annotation on the interface rather than > >>>> on the > >>>> implementing class. I got the idea that I could manually create a T5 IOC > >>>> registry to do integration testing on my services. But how can I test > >>>> "perthread" scope on services in the test registry when there are no > >>>> real > >>>> requests? I'm assuming this requires mocking the Request object in > >>>> some way? > >>>> > >>>> Inge > >>>> > >>> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >> For additional commands, e-mail: users-h...@tapestry.apache.org > >> > >> > > - > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Re: T5: Testing service scope
Ok, so now I need to mock one of the dependencies of a service I'm testing. I realized that I don't know how to do that when I manually created my registry. I don't want to have a "TestModule" that builds fakes for my external dependencies, in this case it is enough to just mock the service that provides configuration values. Then I tried using testify, like below, but Mockito claims that my "settings" service is not a mock, so I guess testify isn't built to support this kind of mocking... Any ideas? @Mock @ForComponents private SettingsFacade settings; @Test public void settingValueIsCachedInThread() { when(settings.get(MODULE_ORDER)).thenReturn("module1,module2"); ModuleOrderProvider u = tester.getService(ModuleOrderProvider.class); // This service dependes on the SettingsFacade service u.getOrder(); u.getOrder(); verify(settings.get(MODULE_ORDER), times(1)); } On Thu, Feb 18, 2010 at 8:58 AM, Ulrich Stärk wrote: > Hmm, you are right. > > The builder method for that service would be called multiple times though > IIRC. Maybe somehow check that then? > > Uli > > On 17.02.2010 23:32 schrieb Martin Strand: > > Hmm, why different instances? Wouldn't every thread see the same proxy >> instance? >> >> Martin >> >> On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk >> wrote: >> >> Querying the registry for the same service from different threads >>> should yield different instances >>> when using the perthread scope. Just test that. No need for a request >>> if your service doesn't >>> require one. >>> >>> Uli >>> >>> On 17.02.2010 11:42 schrieb Inge Solvoll: >>> >>>> Hi! >>>> >>>> I recently encountered a bug in one of my services, where it had the >>>> wrong >>>> scope because I put the scope annotation on the interface rather than >>>> on the >>>> implementing class. I got the idea that I could manually create a T5 IOC >>>> registry to do integration testing on my services. But how can I test >>>> "perthread" scope on services in the test registry when there are no >>>> real >>>> requests? I'm assuming this requires mocking the Request object in >>>> some way? >>>> >>>> Inge >>>> >>> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: T5: Testing service scope
Hmm, you are right. The builder method for that service would be called multiple times though IIRC. Maybe somehow check that then? Uli On 17.02.2010 23:32 schrieb Martin Strand: Hmm, why different instances? Wouldn't every thread see the same proxy instance? Martin On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk wrote: Querying the registry for the same service from different threads should yield different instances when using the perthread scope. Just test that. No need for a request if your service doesn't require one. Uli On 17.02.2010 11:42 schrieb Inge Solvoll: Hi! I recently encountered a bug in one of my services, where it had the wrong scope because I put the scope annotation on the interface rather than on the implementing class. I got the idea that I could manually create a T5 IOC registry to do integration testing on my services. But how can I test "perthread" scope on services in the test registry when there are no real requests? I'm assuming this requires mocking the Request object in some way? Inge - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Testing service scope
Hmm, why different instances? Wouldn't every thread see the same proxy instance? Martin On Wed, 17 Feb 2010 12:17:35 +0100, Ulrich Stärk wrote: Querying the registry for the same service from different threads should yield different instances when using the perthread scope. Just test that. No need for a request if your service doesn't require one. Uli On 17.02.2010 11:42 schrieb Inge Solvoll: Hi! I recently encountered a bug in one of my services, where it had the wrong scope because I put the scope annotation on the interface rather than on the implementing class. I got the idea that I could manually create a T5 IOC registry to do integration testing on my services. But how can I test "perthread" scope on services in the test registry when there are no real requests? I'm assuming this requires mocking the Request object in some way? Inge - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Testing service scope
I think that should work, yes. Uli On 17.02.2010 12:38 schrieb Inge Solvoll: Ok, thanks! One more stupid question: Each test method runs in its own thread, right? So the only place where I need to use Runnable and Thread are inside test methods that need to test if several threads don't share the same cached value? Given that the registry is stored and cached globally in my test superclass so all tests use the same registry instance. On Wed, Feb 17, 2010 at 12:17 PM, Ulrich Stärk wrote: Querying the registry for the same service from different threads should yield different instances when using the perthread scope. Just test that. No need for a request if your service doesn't require one. Uli On 17.02.2010 11:42 schrieb Inge Solvoll: Hi! I recently encountered a bug in one of my services, where it had the wrong scope because I put the scope annotation on the interface rather than on the implementing class. I got the idea that I could manually create a T5 IOC registry to do integration testing on my services. But how can I test "perthread" scope on services in the test registry when there are no real requests? I'm assuming this requires mocking the Request object in some way? Inge - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Testing service scope
Ok, thanks! One more stupid question: Each test method runs in its own thread, right? So the only place where I need to use Runnable and Thread are inside test methods that need to test if several threads don't share the same cached value? Given that the registry is stored and cached globally in my test superclass so all tests use the same registry instance. On Wed, Feb 17, 2010 at 12:17 PM, Ulrich Stärk wrote: > Querying the registry for the same service from different threads should > yield different instances when using the perthread scope. Just test that. No > need for a request if your service doesn't require one. > > Uli > > On 17.02.2010 11:42 schrieb Inge Solvoll: > > Hi! >> >> I recently encountered a bug in one of my services, where it had the wrong >> scope because I put the scope annotation on the interface rather than on >> the >> implementing class. I got the idea that I could manually create a T5 IOC >> registry to do integration testing on my services. But how can I test >> "perthread" scope on services in the test registry when there are no real >> requests? I'm assuming this requires mocking the Request object in some >> way? >> >> Inge >> >> > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: T5: Testing service scope
Querying the registry for the same service from different threads should yield different instances when using the perthread scope. Just test that. No need for a request if your service doesn't require one. Uli On 17.02.2010 11:42 schrieb Inge Solvoll: Hi! I recently encountered a bug in one of my services, where it had the wrong scope because I put the scope annotation on the interface rather than on the implementing class. I got the idea that I could manually create a T5 IOC registry to do integration testing on my services. But how can I test "perthread" scope on services in the test registry when there are no real requests? I'm assuming this requires mocking the Request object in some way? Inge - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: Testing service scope
On Wed, 17 Feb 2010 08:42:38 -0200, Inge Solvoll wrote: Hi! Hi! But how can I test "perthread" scope on services in the test registry when there are no real requests? I'm assuming this requires mocking the Request object in some way? Only if your service or some of its dependencies use the Request. Perthread scope means per thread, not per request. ;) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5: Testing service scope
Hi! I recently encountered a bug in one of my services, where it had the wrong scope because I put the scope annotation on the interface rather than on the implementing class. I got the idea that I could manually create a T5 IOC registry to do integration testing on my services. But how can I test "perthread" scope on services in the test registry when there are no real requests? I'm assuming this requires mocking the Request object in some way? Inge
Re: Why does Registry.get(Class, AnnotationProvider) ignore @Scope?
Well, actually it does compile - if the class is written in Groovy. :-) Have to investigate this further. Anyway, I now understand that @Scope is allowed on a service implementation class, but not on its fields. Thanks for the clarification! Cheers, Peter Thiago H. de Paula Figueiredo wrote: > > Hi! > > The @Scope can't be used in fields: it wouldn't compile (@Scope is > defined with @Target(value={TYPE,METHOD})). In addition, each service > has only one scope, defined in its builder method. From > http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html: > > "Each service has a lifecycle that controls when the service > implementation is instantiated." > "Service lifecycle is specified using the @Scope annotation, which is > attached to a builder method." When this annotation is not present, > the default scope, "singleton" is used." > > -- > Thiago > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/Why-does-Registry.get%28Class%2C-AnnotationProvider%29-ignore-%40Scope--tp25323724p25323942.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Why does Registry.get(Class, AnnotationProvider) ignore @Scope?
Hi! The @Scope can't be used in fields: it wouldn't compile (@Scope is defined with @Target(value={TYPE,METHOD})). In addition, each service has only one scope, defined in its builder method. From http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html: "Each service has a lifecycle that controls when the service implementation is instantiated." "Service lifecycle is specified using the @Scope annotation, which is attached to a builder method." When this annotation is not present, the default scope, "singleton" is used." -- Thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Why does Registry.get(Class, AnnotationProvider) ignore @Scope?
I'm using Registry.get(Class, AnnotationProvider) to find matching services for fields of an object that is not under Tapestry's control. Everything works fine, except that annotating a field with @Scope("myOwnScope") has no effect. Is this a bug? If not, what can I do to obtain a service with the requested scope? (Annotating the service builder method with @Scope("myOwnScope") works as expected, but isn't appropriate in this case.) Cheers, Peter -- View this message in context: http://www.nabble.com/Why-does-Registry.get%28Class%2C-AnnotationProvider%29-ignore-%40Scope--tp25323724p25323724.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application scope services
Hi, I had a similar needs before, what I did is, write a scheduler using Quarts, then initialize it at time of IOC start up: // Start the SMSScheduler from IOC public static void contributeRegistryStartup(OrderedConfiguration configuration, final SMSScheduler scheduler) { configuration.add("SMSSchedulerStartup", new Runnable() { public void run() { try { scheduler.run(); } catch (SchedulerException e) { e.printStackTrace(); } } }); } sodium wrote: > > > Just few quick questions. I've skim through the documentation as well as > the only Tap5 book i recently bought and i didn't find any reference to > this. > > Is it possible to bind some sort of services using Tap5 when the container > init the Tap5 application? Also, is it possible to have those services > declared in application scope? For instance, i wanted the application to > constantly check for incoming sms from mobile connected via javacomm. > > And also, I was looking at the ajax documentation. It didn't state whether > if the ajax supported is secured or not. I only wanted authenticated user > to be able to call the ajax. Is this possible with Tap5 at the moment? > > > -- View this message in context: http://www.nabble.com/Application-scope-services-tp23354009p23354325.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Application scope services
sodium schrieb: Just few quick questions. I've skim through the documentation as well as the only Tap5 book i recently bought and i didn't find any reference to this. Is it possible to bind some sort of services using Tap5 when the container init the Tap5 application? Yes, absolutely. Have a look at the tapestry-ioc documentation. Also, is it possible to have those services declared in application scope? For instance, i wanted the application to constantly check for incoming sms from mobile connected via javacomm. I'd do that with the help of quartz. The third-party component library Chenillekit has support for it IIRC. Also search the list archive (tapestry.markmail.org), there has been some discussion about Tapestry and Quart in the past. And also, I was looking at the ajax documentation. It didn't state whether if the ajax supported is secured or not. I only wanted authenticated user to be able to call the ajax. Is this possible with Tap5 at the moment? Sure. Use the if component and only render ajax-enabled components if the user is authenticated. Uli - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Application scope services
Just few quick questions. I've skim through the documentation as well as the only Tap5 book i recently bought and i didn't find any reference to this. Is it possible to bind some sort of services using Tap5 when the container init the Tap5 application? Also, is it possible to have those services declared in application scope? For instance, i wanted the application to constantly check for incoming sms from mobile connected via javacomm. And also, I was looking at the ajax documentation. It didn't state whether if the ajax supported is secured or not. I only wanted authenticated user to be able to call the ajax. Is this possible with Tap5 at the moment? -- View this message in context: http://www.nabble.com/Application-scope-services-tp23354009p23354009.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: tapestry-ioc scope problem in a standalone program
kristian.marinkovic wrote: > > add following instruction after you have started the thread: > Thread.currentThread().join() > > changes are good that you main program (process) is terminated > before the thread is started. > > g, > kris > Thank you for your reply. But it seems not a correct solution. I just got the same result with the statement added. -- View this message in context: http://www.nabble.com/T5%3A-tapestry-ioc-scope-problem-in-a-standalone-program-tp19405294p19428352.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: tapestry-ioc scope problem in a standalone program
add following instruction after you have started the thread: Thread.currentThread().join() changes are good that you main program (process) is terminated before the thread is started. g, kris "hua.jiang" <[EMAIL PROTECTED]> 10.09.2008 04:35 Bitte antworten an "Tapestry users" An users@tapestry.apache.org Kopie Thema T5: tapestry-ioc scope problem in a standalone program Hello, every one. I met the following problem when trying to use tapestry-ioc in a standalone program. According to the tapestry official site, a service builder method should be invoked multiple times, if it is annotated with @Scope("perthread") and the service is used in multi threads. So I wrote the following program, trying to demonstrate it. In the program, ServiceA is used in two threads, but the builder method is invoked only one time. Why? public class Main { public static void main(String[] args) { RegistryBuilder regBuilder = new RegistryBuilder(); regBuilder.add(ModuleA.class); final Registry reg = regBuilder.build(); final ServiceA a = reg.getService(ServiceA.class); a.print(); new Thread() { @Override public void run() { ServiceA aInAnotherThread = reg.getService(ServiceA.class); aInAnotherThread.print(); } }.start(); } } public class ServiceA { public ServiceA() { System.out.println("A new instance of ServiceA is under construction!"); } public void print() { System.out.println(this); } } public class ModuleA { @Scope("perthread") public static ServiceA builder() { System.out.println("Building a new instance of ServiceA ..."); return new ServiceA(); } } -- View this message in context: http://www.nabble.com/T5%3A-tapestry-ioc-scope-problem-in-a-standalone-program-tp19405294p19405294.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: tapestry-ioc scope problem in a standalone program
Hello, every one. I met the following problem when trying to use tapestry-ioc in a standalone program. According to the tapestry official site, a service builder method should be invoked multiple times, if it is annotated with @Scope("perthread") and the service is used in multi threads. So I wrote the following program, trying to demonstrate it. In the program, ServiceA is used in two threads, but the builder method is invoked only one time. Why? public class Main { public static void main(String[] args) { RegistryBuilder regBuilder = new RegistryBuilder(); regBuilder.add(ModuleA.class); final Registry reg = regBuilder.build(); final ServiceA a = reg.getService(ServiceA.class); a.print(); new Thread() { @Override public void run() { ServiceA aInAnotherThread = reg.getService(ServiceA.class); aInAnotherThread.print(); } }.start(); } } public class ServiceA { public ServiceA() { System.out.println("A new instance of ServiceA is under construction!"); } public void print() { System.out.println(this); } } public class ModuleA { @Scope("perthread") public static ServiceA builder() { System.out.println("Building a new instance of ServiceA ..."); return new ServiceA(); } } -- View this message in context: http://www.nabble.com/T5%3A-tapestry-ioc-scope-problem-in-a-standalone-program-tp19405294p19405294.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session and application scope
How can i instanciate an Application Object? @ApplicationState private MyObject objectName_; how i use a request @Inject private RequestGlobals requestGlobals_; Then you have access to the Servlet API with things like: HttpServletRequest request = requestGlobals.getHTTPServletRequest(); Gianluigi wrote: Hi to all, i'm a JSP developer and i want to know a more on Tapestry 5, it seem very cool! :) Only a question, how i use a request or a Session in Tapestry 5? How can i instanciate an Application Object? in JSP i wrote : HttpSession session and session.setProperty("Key"); and in Tapestry 5? Thanks a lot Muzero ___ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html - 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]
Re: Session and application scope
On 10/23/07, Gianluigi <[EMAIL PROTECTED]> wrote: > Only a question, how i use a request or a Session in Tapestry 5? How can i > instanciate an > Application Object? > > in JSP i wrote : HttpSession session and session.setProperty("Key"); > and in Tapestry 5? Take a look at application state: http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/appstate.html -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session and application scope
Hi to all, i'm a JSP developer and i want to know a more on Tapestry 5, it seem very cool! :) Only a question, how i use a request or a Session in Tapestry 5? How can i instanciate an Application Object? in JSP i wrote : HttpSession session and session.setProperty("Key"); and in Tapestry 5? Thanks a lot Muzero ___ L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A Hopefully Simple Question About Action Link Scope
On 9/17/07, Davor Hrg <[EMAIL PROTECTED]> wrote: > The problem is that you must give action link something > to identify your object. > > in the page you mentioned you have only one instance of > the MatchInfo component that get's rendered multiple times with different > data. > So when your action is called, you have the last element passed as > parameter. That's what really confused me. I wrongly thought you would get a new MatchInfo Object for every iteration of the loop. Thanks for clearing that up. > if in you AppModule you make following TypeCoercers : > String->DateeeMatch > and > DateeeMatch -> String I have been looking at Type Coercion, and I am still a little confused. As I understand it I need to provide a way for Tapestry to convert my DateeeMatch object to a string. The DateeeMatch is too complex to serialise directly in to the page. Is there some way, I can store it in the session, then use some type of ID to retrieve the correct object from the session. I could then just put the ID in the actually URL. Is there some standard way of providing this type of Coercion in tapestry or do I need to implement all storing to and retrieving from the session functionality my self. According to the docs there's a standard Object -> String coercion in built in, I am currently trying to find the source of that to see if that will give me any pointers. Is this the best approach to Coercion of more complex objects (not single data objects like Strings)? Thanks again for the help. Charlie M - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A Hopefully Simple Question About Action Link Scope
The problem is that you must give action link something to identify your object. in the page you mentioned you have only one instance of the MatchInfo component that get's rendered multiple times with different data. So when your action is called, you have the last element passed as parameter. you shoud link it like this: Changed Your Mind public void onActionFromChangedMind(Long id) { //load match from database by the id System.out.println(match.getName()); } - if in you AppModule you make following TypeCoercers : String->DateeeMatch and DateeeMatch -> String above code can look like this: Changed Your Mind public void onActionFromChangedMind(DateeeMatch match) { //load match from database by the id System.out.println(match.getName()); } Davor Hrg On 9/17/07, Charles Mason <[EMAIL PROTECTED]> wrote: > > On 9/17/07, Francois Armand <[EMAIL PROTECTED]> wrote: > > Well, I'm not sure that I understand what you do correctly, may you > > provide the actual code ? > > As far as I can tell, you persists a field that is used as value for the > > loop, and so it's always the last MacthInfo that is persists. > > > > You may want to have a look at > > http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html > > and look how Tapestry deals with context and onActivate/onPassivate > methods. > > Thanks for your reply however, I don't think was very clear about what > I'm trying to do. > > I was trying to avoid posting code from lots of different files but. I > think I can find the relevant snippets, which should make things > clearer. > > So here goes: > > From Start.html: > > > > > > From Start.java: > > @Persist > private List matches; > > @Persist > private DateeeMatch currentMatch; > > matches is filled from a long DB query. > > The action link in MatchInfo.html: > > > Changed Your Mind > > > From MatchInfo.java > > @Parameter(required=true) > private DateeeMatch match; > > > public void onActionFromChangedMind() > { > System.out.println(match.getName()); > } > > > My problem is when you click the action link on any of the MatchInfo > components on the start page. The console shows the name of the last > match not the one clicked on. The MatchInfo component also correctly > displays lots of info from the match parameter, so that is defiantly > OK. > > Can anyone shed some light on this for me? > > Charlie M > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: T5: A Hopefully Simple Question About Action Link Scope
On 9/17/07, Francois Armand <[EMAIL PROTECTED]> wrote: > Well, I'm not sure that I understand what you do correctly, may you > provide the actual code ? > As far as I can tell, you persists a field that is used as value for the > loop, and so it's always the last MacthInfo that is persists. > > You may want to have a look at > http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html > and look how Tapestry deals with context and onActivate/onPassivate methods. Thanks for your reply however, I don't think was very clear about what I'm trying to do. I was trying to avoid posting code from lots of different files but. I think I can find the relevant snippets, which should make things clearer. So here goes: >From Start.html: >From Start.java: @Persist private List matches; @Persist private DateeeMatch currentMatch; matches is filled from a long DB query. The action link in MatchInfo.html: Changed Your Mind >From MatchInfo.java @Parameter(required=true) private DateeeMatch match; public void onActionFromChangedMind() { System.out.println(match.getName()); } My problem is when you click the action link on any of the MatchInfo components on the start page. The console shows the name of the last match not the one clicked on. The MatchInfo component also correctly displays lots of info from the match parameter, so that is defiantly OK. Can anyone shed some light on this for me? Charlie M - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A Hopefully Simple Question About Action Link Scope
Charles Mason wrote: Hi All [..] Hi, [..] The method called by the action link uses the persistent field which stores the actual Match object which the component gets data from. However when ever I use the page and click the action link, its as though the action link is clicked on the last MatchInfo component, even when I click the action link on a different MatchInfo component. Well, I'm not sure that I understand what you do correctly, may you provide the actual code ? As far as I can tell, you persists a field that is used as value for the loop, and so it's always the last MacthInfo that is persists. You may want to have a look at http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html and look how Tapestry deals with context and onActivate/onPassivate methods. -- Francois Armand Etudes & Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: A Hopefully Simple Question About Action Link Scope
Hi All I am currently experiencing a problem which seems to contradict the model of how action link works. I have a page called start.html. It has a for loop which for every iteration contains a custom component, called MatchInfo. This renders a box containing the info about the match. MatchInfo has an action link tag and event method, which does something with the match. The method called by the action link uses the persistent field which stores the actual Match object which the component gets data from. However when ever I use the page and click the action link, its as though the action link is clicked on the last MatchInfo component, even when I click the action link on a different MatchInfo component. I thought the action link would call the method of the component object that generated it not just the last object. I am not sure if this is a bug or a "Feature"? Can anyone shed some light on this for me. Charlie M - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
scope session help
Hello, I've the following need I've a component that have a parameter that it's not necessarly bound to session scope. Is there a way to ma it bound to session whan managed by the component. i.e. I'd like this parameter to be boud to a property of the component that is session scoped. kiuma
Re: Persisted Object with session scope is getting lost between the pages.
er <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> >> >> >> >> >> >> Hi, >> >> >> >>I am new to Tapestry. I am facing a problem with >> >> Mater-Detail >> >> >> >> Pages >> >> >> >> [ >> >> >> >> Orders List -> Item List -> Item Edit/Add/Delete.] >> >> >> >> >> >> >> >> OrderList Page displays: >> >> >> >> >> >> >> >> OrderId - OrderNumber - ItemDetails >> >> >> >> 123-ABC123 -Link to ItemDetails (OrderId is passed >> as >> >> >> >> parameter) >> >> >> >> >> >> >> >> >> >> >> >> ItemList Page Displays: >> >> >> >> >> >> >> >> Order Number: ABC123 >> >> >> >> - >> >> >> >> Add new item button >> >> >> >> >> >> >> >> ItemId - ItemName - Qty >> >> >> >> 1 -Book1 - 2 (link to item details for edit/delete) >> >> >> >> 2 - Book2 - 3 (link to item details) >> >> >> >> >> >> >> >> >> >> >> >> In OrderListPage.java: >> >> >> >> >> >> >> >> In viewItems() method: >> >> >> >> >> >> >> >> ItemListPage nextPage = (ItemListPage ) cycle >> >> >> >> .getPage("ItemListPage"); >> >> >> >> nextPage.setOrder(order); >> >> >> >> cycle.activate(nextPage); >> >> >> >> >> >> >> >> >> >> >> >> In ItemListPage.java: I am persisting the order object. >> >> >> >> >> >> >> >> @Persist("session") >> >> >> >> public abstract void setOrder(Order order); >> >> >> >> public abstract Order getOrder(); >> >> >> >> >> >> >> >> In ItemForm.java: I am persisting the order object. ( Don't how >> to >> >> >> access >> >> >> >> the persisted object in the previous page). >> >> >> >> >> >> >> >> @Persist("session") >> >> >> >> public abstract void setOrder(Order order); >> >> >> >> public abstract Order getOrder(); >> >> >> >> >> >> >> >> >> >> >> >> When I am saving Item, getOrder() is returning null. This value >> >> exists >> >> >> >> when >> >> >> >> I navigate to new Item Page. But it is getting lost while >> accessing >> >> >> save >> >> >> >> method in ItemForm.java. >> >> >> >> >> >> >> >> Please help... >> >> >> >> >> >> >> >> Thanks in advance... >> >> >> >> >> >> >> >> -Sri >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> >> View this message in context: >> >> >> >> >> >> >> >> >> >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 >> >> >> >> Sent from the Tapestry - User mailing list archive at >> Nabble.com. >> >> >> >> >> >> >> >> >> >> >> >> >> >> - >> >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> >> >> >> > >> >> >> > >> >> >> >> >> >> -- >> >> >> View this message in context: >> >> >> >> >> >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9749874 >> >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> >> >> >> >> - >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> > >> >> > >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9763239 >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> - >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9773540 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9905779 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Persisted Object with session scope is getting lost between the pages.
lete) >> >> >> 2 - Book2 - 3 (link to item details) >> >> >> >> >> >> >> >> >> In OrderListPage.java: >> >> >> >> >> >> In viewItems() method: >> >> >> >> >> >> ItemListPage nextPage = (ItemListPage ) cycle >> >> >> .getPage("ItemListPage"); >> >> >> nextPage.setOrder(order); >> >> >> cycle.activate(nextPage); >> >> >> >> >> >> >> >> >> In ItemListPage.java: I am persisting the order object. >> >> >> >> >> >> @Persist("session") >> >> >> public abstract void setOrder(Order order); >> >> >> public abstract Order getOrder(); >> >> >> >> >> >> In ItemForm.java: I am persisting the order object. ( Don't how to >> >> access >> >> >> the persisted object in the previous page). >> >> >> >> >> >> @Persist("session") >> >> >> public abstract void setOrder(Order order); >> >> >> public abstract Order getOrder(); >> >> >> >> >> >> >> >> >> When I am saving Item, getOrder() is returning null. This value >> exists >> >> >> when >> >> >> I navigate to new Item Page. But it is getting lost while accessing >> >> save >> >> >> method in ItemForm.java. >> >> >> >> >> >> Please help... >> >> >> >> >> >> Thanks in advance... >> >> >> >> >> >> -Sri >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> View this message in context: >> >> >> >> >> >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 >> >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> >> >> >> >> - >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> > >> >> > >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9749874 >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> - >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9763239 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9773540 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Persisted Object with session scope is getting lost between the pages.
Thanks again. I am trying to implement Master-Detail pages ( Order List -> Item List). On oder List, I am trying to implement Edit/Add/View and Item List button. On clicking item list button, I am displaying Item List. On Item List I am implementing Add/Delelte/View/Edit Item. On Order Page, I am trying to edit only few fields. Could you please suggest any example? Thanks. Srini. Martino Piccinato wrote: > > Actually the situation you are describing is not completely clear to me it > seems you might want to do another > getOrder() on form rewinding and merge the additional/showed fields with > the > previously persisted fields or add hidden input field components for the > remaining fields but your case is not completely clear to me. > > On 3/31/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> Hi Martino, >> Thanks. It works. I am having another issue with an >> entity >> values. I have 10+ fields in Order Object. I am displaying only 5 fields >> in >> Order.html. I have Order.page file with 5 fields. In editOrder( >> IRequestCycle cycle) method, I am setting >> nextPage.setOrder(serviceManager.getOrder(id)). Order Object values are >> getting lost after I do form sumbit ( save method). In Save method, I am >> calling serviceManager.Save(getOrder()); >> Could you please give me some hints? Do I need to specify all the fileds >> in >> the page spec? >> >> Thanks. >> Sri. >> >> >> >> Martino Piccinato wrote: >> > >> > Yes is exactly the same, I quoted 4.1 documentation just because I'm >> > investigating 4.1 now >> > >> > This is 4.0 docs for it: >> > >> > http://tapestry.apache.org/tapestry4/UsersGuide/state.html#state.aso >> > >> > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Hi Martino, >> >> Thanks for the reply. I am using Tapestry 4.0.2. Is >> ASO >> >> exist in 4.1+? >> >> >> >> Thanks. >> >> Sri >> >> >> >> >> >> Martino Piccinato wrote: >> >> > >> >> > properties persisted on a page (being client or session persisted) >> are >> >> > persisted just for that page (it's called "persistent PAGE >> >> properties"). >> >> > Just to give you an idea the key of the session attribute named used >> to >> >> > store the property contains the page name . It's intended to be so. >> >> > >> >> > Usually if you want to implement a shopping cart you'd have to use >> >> > Application Stato Objects, ASO, see documentation about ASO at >> >> > http://tapestry.apache.org/tapestry4.1/usersguide/state.html >> >> > >> >> > basically you just create whatever object you want to persist (e.g. >> >> your >> >> > shopping cart) , configure it as an ASO using >> >> > >> >> > tapestry.state.ApplicationObjects and then you can easily inject it >> >> > with an annotation in whatever page you need it. >> >> > >> >> > >> >> > >> >> > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> >> >> >> Hi, >> >> >>I am new to Tapestry. I am facing a problem with >> Mater-Detail >> >> >> Pages >> >> >> [ >> >> >> Orders List -> Item List -> Item Edit/Add/Delete.] >> >> >> >> >> >> OrderList Page displays: >> >> >> >> >> >> OrderId - OrderNumber - ItemDetails >> >> >> 123-ABC123 -Link to ItemDetails (OrderId is passed as >> >> >> parameter) >> >> >> >> >> >> >> >> >> ItemList Page Displays: >> >> >> >> >> >> Order Number: ABC123 >> >> >> - >> >> >> Add new item button >> >> >> >> >> >> ItemId - ItemName - Qty >> >> >> 1 -Book1 - 2 (link to item details for edit/delete) >> >> >> 2 - Book2 - 3 (link to item details) >> >> >> >> >> >> >> >> >> In OrderListPage.java: >> >> >> >> >> >> In viewItems() method: >> >> >> >>
Re: Persisted Object with session scope is getting lost between the pages.
Actually the situation you are describing is not completely clear to me it seems you might want to do another getOrder() on form rewinding and merge the additional/showed fields with the previously persisted fields or add hidden input field components for the remaining fields but your case is not completely clear to me. On 3/31/07, tapuser <[EMAIL PROTECTED]> wrote: Hi Martino, Thanks. It works. I am having another issue with an entity values. I have 10+ fields in Order Object. I am displaying only 5 fields in Order.html. I have Order.page file with 5 fields. In editOrder( IRequestCycle cycle) method, I am setting nextPage.setOrder(serviceManager.getOrder(id)). Order Object values are getting lost after I do form sumbit ( save method). In Save method, I am calling serviceManager.Save(getOrder()); Could you please give me some hints? Do I need to specify all the fileds in the page spec? Thanks. Sri. Martino Piccinato wrote: > > Yes is exactly the same, I quoted 4.1 documentation just because I'm > investigating 4.1 now > > This is 4.0 docs for it: > > http://tapestry.apache.org/tapestry4/UsersGuide/state.html#state.aso > > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> Hi Martino, >> Thanks for the reply. I am using Tapestry 4.0.2. Is ASO >> exist in 4.1+? >> >> Thanks. >> Sri >> >> >> Martino Piccinato wrote: >> > >> > properties persisted on a page (being client or session persisted) are >> > persisted just for that page (it's called "persistent PAGE >> properties"). >> > Just to give you an idea the key of the session attribute named used to >> > store the property contains the page name . It's intended to be so. >> > >> > Usually if you want to implement a shopping cart you'd have to use >> > Application Stato Objects, ASO, see documentation about ASO at >> > http://tapestry.apache.org/tapestry4.1/usersguide/state.html >> > >> > basically you just create whatever object you want to persist (e.g. >> your >> > shopping cart) , configure it as an ASO using >> > >> > tapestry.state.ApplicationObjects and then you can easily inject it >> > with an annotation in whatever page you need it. >> > >> > >> > >> > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Hi, >> >>I am new to Tapestry. I am facing a problem with Mater-Detail >> >> Pages >> >> [ >> >> Orders List -> Item List -> Item Edit/Add/Delete.] >> >> >> >> OrderList Page displays: >> >> >> >> OrderId - OrderNumber - ItemDetails >> >> 123-ABC123 -Link to ItemDetails (OrderId is passed as >> >> parameter) >> >> >> >> >> >> ItemList Page Displays: >> >> >> >> Order Number: ABC123 >> >> - >> >> Add new item button >> >> >> >> ItemId - ItemName - Qty >> >> 1 -Book1 - 2 (link to item details for edit/delete) >> >> 2 - Book2 - 3 (link to item details) >> >> >> >> >> >> In OrderListPage.java: >> >> >> >> In viewItems() method: >> >> >> >> ItemListPage nextPage = (ItemListPage ) cycle >> >> .getPage("ItemListPage"); >> >> nextPage.setOrder(order); >> >> cycle.activate(nextPage); >> >> >> >> >> >> In ItemListPage.java: I am persisting the order object. >> >> >> >> @Persist("session") >> >> public abstract void setOrder(Order order); >> >> public abstract Order getOrder(); >> >> >> >> In ItemForm.java: I am persisting the order object. ( Don't how to >> access >> >> the persisted object in the previous page). >> >> >> >> @Persist("session") >> >> public abstract void setOrder(Order order); >> >> public abstract Order getOrder(); >> >> >> >> >> >> When I am saving Item, getOrder() is returning null. This value exists >> >> when >> >> I navigate to new Item Page. But it is getting lost while accessing >> save >> >> method in ItemForm.java. >> >> >> >> Please help... >> >> >> >> Thanks in advance... >> >> >> >> -Sri >&
Re: Persisted Object with session scope is getting lost between the pages.
Hi Martino, Thanks. It works. I am having another issue with an entity values. I have 10+ fields in Order Object. I am displaying only 5 fields in Order.html. I have Order.page file with 5 fields. In editOrder( IRequestCycle cycle) method, I am setting nextPage.setOrder(serviceManager.getOrder(id)). Order Object values are getting lost after I do form sumbit ( save method). In Save method, I am calling serviceManager.Save(getOrder()); Could you please give me some hints? Do I need to specify all the fileds in the page spec? Thanks. Sri. Martino Piccinato wrote: > > Yes is exactly the same, I quoted 4.1 documentation just because I'm > investigating 4.1 now > > This is 4.0 docs for it: > > http://tapestry.apache.org/tapestry4/UsersGuide/state.html#state.aso > > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> Hi Martino, >> Thanks for the reply. I am using Tapestry 4.0.2. Is ASO >> exist in 4.1+? >> >> Thanks. >> Sri >> >> >> Martino Piccinato wrote: >> > >> > properties persisted on a page (being client or session persisted) are >> > persisted just for that page (it's called "persistent PAGE >> properties"). >> > Just to give you an idea the key of the session attribute named used to >> > store the property contains the page name . It's intended to be so. >> > >> > Usually if you want to implement a shopping cart you'd have to use >> > Application Stato Objects, ASO, see documentation about ASO at >> > http://tapestry.apache.org/tapestry4.1/usersguide/state.html >> > >> > basically you just create whatever object you want to persist (e.g. >> your >> > shopping cart) , configure it as an ASO using >> > >> > tapestry.state.ApplicationObjects and then you can easily inject it >> > with an annotation in whatever page you need it. >> > >> > >> > >> > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Hi, >> >>I am new to Tapestry. I am facing a problem with Mater-Detail >> >> Pages >> >> [ >> >> Orders List -> Item List -> Item Edit/Add/Delete.] >> >> >> >> OrderList Page displays: >> >> >> >> OrderId - OrderNumber - ItemDetails >> >> 123-ABC123 -Link to ItemDetails (OrderId is passed as >> >> parameter) >> >> >> >> >> >> ItemList Page Displays: >> >> >> >> Order Number: ABC123 >> >> - >> >> Add new item button >> >> >> >> ItemId - ItemName - Qty >> >> 1 -Book1 - 2 (link to item details for edit/delete) >> >> 2 - Book2 - 3 (link to item details) >> >> >> >> >> >> In OrderListPage.java: >> >> >> >> In viewItems() method: >> >> >> >> ItemListPage nextPage = (ItemListPage ) cycle >> >> .getPage("ItemListPage"); >> >> nextPage.setOrder(order); >> >> cycle.activate(nextPage); >> >> >> >> >> >> In ItemListPage.java: I am persisting the order object. >> >> >> >> @Persist("session") >> >> public abstract void setOrder(Order order); >> >> public abstract Order getOrder(); >> >> >> >> In ItemForm.java: I am persisting the order object. ( Don't how to >> access >> >> the persisted object in the previous page). >> >> >> >> @Persist("session") >> >> public abstract void setOrder(Order order); >> >> public abstract Order getOrder(); >> >> >> >> >> >> When I am saving Item, getOrder() is returning null. This value exists >> >> when >> >> I navigate to new Item Page. But it is getting lost while accessing >> save >> >> method in ItemForm.java. >> >> >> >> Please help... >> >> >> >> Thanks in advance... >> >> >> >> -Sri >> >> >> >> >> >> >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> - >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9749874 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9763239 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Persisted Object with session scope is getting lost between the pages.
Yes is exactly the same, I quoted 4.1 documentation just because I'm investigating 4.1 now This is 4.0 docs for it: http://tapestry.apache.org/tapestry4/UsersGuide/state.html#state.aso On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: Hi Martino, Thanks for the reply. I am using Tapestry 4.0.2. Is ASO exist in 4.1+? Thanks. Sri Martino Piccinato wrote: > > properties persisted on a page (being client or session persisted) are > persisted just for that page (it's called "persistent PAGE properties"). > Just to give you an idea the key of the session attribute named used to > store the property contains the page name . It's intended to be so. > > Usually if you want to implement a shopping cart you'd have to use > Application Stato Objects, ASO, see documentation about ASO at > http://tapestry.apache.org/tapestry4.1/usersguide/state.html > > basically you just create whatever object you want to persist (e.g. your > shopping cart) , configure it as an ASO using > > tapestry.state.ApplicationObjects and then you can easily inject it > with an annotation in whatever page you need it. > > > > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> Hi, >>I am new to Tapestry. I am facing a problem with Mater-Detail >> Pages >> [ >> Orders List -> Item List -> Item Edit/Add/Delete.] >> >> OrderList Page displays: >> >> OrderId - OrderNumber - ItemDetails >> 123-ABC123 -Link to ItemDetails (OrderId is passed as >> parameter) >> >> >> ItemList Page Displays: >> >> Order Number: ABC123 >> - >> Add new item button >> >> ItemId - ItemName - Qty >> 1 -Book1 - 2 (link to item details for edit/delete) >> 2 - Book2 - 3 (link to item details) >> >> >> In OrderListPage.java: >> >> In viewItems() method: >> >> ItemListPage nextPage = (ItemListPage ) cycle >> .getPage("ItemListPage"); >> nextPage.setOrder(order); >> cycle.activate(nextPage); >> >> >> In ItemListPage.java: I am persisting the order object. >> >> @Persist("session") >> public abstract void setOrder(Order order); >> public abstract Order getOrder(); >> >> In ItemForm.java: I am persisting the order object. ( Don't how to access >> the persisted object in the previous page). >> >> @Persist("session") >> public abstract void setOrder(Order order); >> public abstract Order getOrder(); >> >> >> When I am saving Item, getOrder() is returning null. This value exists >> when >> I navigate to new Item Page. But it is getting lost while accessing save >> method in ItemForm.java. >> >> Please help... >> >> Thanks in advance... >> >> -Sri >> >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9749874 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Persisted Object with session scope is getting lost between the pages.
Hi Martino, Thanks for the reply. I am using Tapestry 4.0.2. Is ASO exist in 4.1+? Thanks. Sri Martino Piccinato wrote: > > properties persisted on a page (being client or session persisted) are > persisted just for that page (it's called "persistent PAGE properties"). > Just to give you an idea the key of the session attribute named used to > store the property contains the page name . It's intended to be so. > > Usually if you want to implement a shopping cart you'd have to use > Application Stato Objects, ASO, see documentation about ASO at > http://tapestry.apache.org/tapestry4.1/usersguide/state.html > > basically you just create whatever object you want to persist (e.g. your > shopping cart) , configure it as an ASO using > > tapestry.state.ApplicationObjects and then you can easily inject it > with an annotation in whatever page you need it. > > > > On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: >> >> >> Hi, >>I am new to Tapestry. I am facing a problem with Mater-Detail >> Pages >> [ >> Orders List -> Item List -> Item Edit/Add/Delete.] >> >> OrderList Page displays: >> >> OrderId - OrderNumber - ItemDetails >> 123-ABC123 -Link to ItemDetails (OrderId is passed as >> parameter) >> >> >> ItemList Page Displays: >> >> Order Number: ABC123 >> - >> Add new item button >> >> ItemId - ItemName - Qty >> 1 -Book1 - 2 (link to item details for edit/delete) >> 2 - Book2 - 3 (link to item details) >> >> >> In OrderListPage.java: >> >> In viewItems() method: >> >> ItemListPage nextPage = (ItemListPage ) cycle >> .getPage("ItemListPage"); >> nextPage.setOrder(order); >> cycle.activate(nextPage); >> >> >> In ItemListPage.java: I am persisting the order object. >> >> @Persist("session") >> public abstract void setOrder(Order order); >> public abstract Order getOrder(); >> >> In ItemForm.java: I am persisting the order object. ( Don't how to access >> the persisted object in the previous page). >> >> @Persist("session") >> public abstract void setOrder(Order order); >> public abstract Order getOrder(); >> >> >> When I am saving Item, getOrder() is returning null. This value exists >> when >> I navigate to new Item Page. But it is getting lost while accessing save >> method in ItemForm.java. >> >> Please help... >> >> Thanks in advance... >> >> -Sri >> >> >> >> >> -- >> View this message in context: >> http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9749874 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Persisted Object with session scope is getting lost between the pages.
properties persisted on a page (being client or session persisted) are persisted just for that page (it's called "persistent PAGE properties"). Just to give you an idea the key of the session attribute named used to store the property contains the page name . It's intended to be so. Usually if you want to implement a shopping cart you'd have to use Application Stato Objects, ASO, see documentation about ASO at http://tapestry.apache.org/tapestry4.1/usersguide/state.html basically you just create whatever object you want to persist (e.g. your shopping cart) , configure it as an ASO using tapestry.state.ApplicationObjects and then you can easily inject it with an annotation in whatever page you need it. On 3/30/07, tapuser <[EMAIL PROTECTED]> wrote: Hi, I am new to Tapestry. I am facing a problem with Mater-Detail Pages [ Orders List -> Item List -> Item Edit/Add/Delete.] OrderList Page displays: OrderId - OrderNumber - ItemDetails 123-ABC123 -Link to ItemDetails (OrderId is passed as parameter) ItemList Page Displays: Order Number: ABC123 - Add new item button ItemId - ItemName - Qty 1 -Book1 - 2 (link to item details for edit/delete) 2 - Book2 - 3 (link to item details) In OrderListPage.java: In viewItems() method: ItemListPage nextPage = (ItemListPage ) cycle .getPage("ItemListPage"); nextPage.setOrder(order); cycle.activate(nextPage); In ItemListPage.java: I am persisting the order object. @Persist("session") public abstract void setOrder(Order order); public abstract Order getOrder(); In ItemForm.java: I am persisting the order object. ( Don't how to access the persisted object in the previous page). @Persist("session") public abstract void setOrder(Order order); public abstract Order getOrder(); When I am saving Item, getOrder() is returning null. This value exists when I navigate to new Item Page. But it is getting lost while accessing save method in ItemForm.java. Please help... Thanks in advance... -Sri -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Persisted Object with session scope is getting lost between the pages.
Hi, I am new to Tapestry. I am facing a problem with Mater-Detail Pages [ Orders List -> Item List -> Item Edit/Add/Delete.] OrderList Page displays: OrderId - OrderNumber - ItemDetails 123-ABC123 -Link to ItemDetails (OrderId is passed as parameter) ItemList Page Displays: Order Number: ABC123 - Add new item button ItemId - ItemName - Qty 1 -Book1 - 2 (link to item details for edit/delete) 2 - Book2 - 3 (link to item details) In OrderListPage.java: In viewItems() method: ItemListPage nextPage = (ItemListPage ) cycle .getPage("ItemListPage"); nextPage.setOrder(order); cycle.activate(nextPage); In ItemListPage.java: I am persisting the order object. @Persist("session") public abstract void setOrder(Order order); public abstract Order getOrder(); In ItemForm.java: I am persisting the order object. ( Don't how to access the persisted object in the previous page). @Persist("session") public abstract void setOrder(Order order); public abstract Order getOrder(); When I am saving Item, getOrder() is returning null. This value exists when I navigate to new Item Page. But it is getting lost while accessing save method in ItemForm.java. Please help... Thanks in advance... -Sri -- View this message in context: http://www.nabble.com/Persisted-Object-with-session-scope-is-getting-lost-between-the-pages.-tf3490484.html#a9747985 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Injecting services into application scope ASO
I think what you need is an initialize-method. setConfig cannot be called before the Manager constructor. See http://hivemind.apache.org/hivemind1/hivemind/BuilderFactory.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Injecting services into application scope ASO
Half way there... Using Hiveutils I managed to write this, but in the Manager ASO constructor the config is null. The setter for the config is never called. The Manager is instantiated by a Border component when method ping() is called. I can use spring provided config in Border component just fine. What did I miss? ### hivemodule.xml ### and ### Manager.java ### public class Manager implements StateObjectFactory { // Commons Configuration private Configuration config; /** * Manager is an application scope ASO (Application State Object). This * class is instantiated lazily - when first page injects it. */ public Manager() { logger.info("config: " + config); // <<<<<< THIS IS NULL String address = config.getString("person.address"); } public Object createStateObject() { return this; } public String ping() { return "pong"; } public Configuration getConfig() { return config; } public void setConfig(Configuration config) { // <<<<<<< never gets called logger.info("SETTING CONFIG: " + config); this.config = config; } } ### applicationContext.xml ### class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean"> class="org.apache.commons.configuration.XMLConfiguration"> value="classpath:posting-config.xml" /> class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/> factory-method="getConfiguration"/> ### Border.java ### public abstract class Border extends BaseComponent { @InjectState("manager") abstract public Manager getManager(); @InjectObject("spring:configuration") public abstract Configuration getConfig(); public void finishLoad() { logger.info("person.address: " + getConfig().getString("person.address")); // correctly print the value logger.info("manager.ping:" + getManager().ping()); // invokes Manager } On 15.3.2007 20:25, Borut Bolčina wrote: Hello, can someone provide some code hints to Hivemind and Spring newb - that would be me - on how to inject 1. Hivemind service into application scope ASO 2. Spring service into application scope ASO I want to cache some long term objects in the global ASO, but want (if it is at all reasonable?) those objects provided by Hivemind and/or Spring services. I am at the very beginning of learning of the SOA. I know how to inject services from both frameworks into Tapestry pages. Cheers, Borut - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Injecting services into application scope ASO
Hello, can someone provide some code hints to Hivemind and Spring newb - that would be me - on how to inject 1. Hivemind service into application scope ASO 2. Spring service into application scope ASO I want to cache some long term objects in the global ASO, but want (if it is at all reasonable?) those objects provided by Hivemind and/or Spring services. I am at the very beginning of learning of the SOA. I know how to inject services from both frameworks into Tapestry pages. Cheers, Borut
Re: RE: Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ?
Thanks Ben, That's what I did and it works great ! Best regards, D. 2007/1/4, Ben Dotte <[EMAIL PROTECTED]>: Crap.. I forgot about that dependency on the web request. That never made sense to me for the case of application-scope ASOs. In any case, here is a wild idea. If you can capture and hold onto the Hivemind-created instance of the ASO, you could then give out access to it through a static getter, similar to a regular old singleton. To do this you would need to wire up the ASO through a StateObjectFactory. So in hivemodule.xml: In MyAppObjectFactory you can instantiate the object you want to use as an ASO: public class MyAppObjectFactory implements StateObjectFactory { public Object createStateObject() { return new MyApplicationObject(); } } Then in MyApplicationObject you could store the instance that gets created: public class MyApplicationObject { private static MyApplicationObject instance; public MyApplicationObject() { instance = this; } public static MyApplicationObject getInstance() { return instance; } } Then in your ServletContextListener you can just call MyApplicationObject.getInstance(). Not the prettiest solution but I believe this would work. Ben -Original Message- From: Tapestry User List [mailto:[EMAIL PROTECTED] Sent: Thursday, January 04, 2007 9:19 AM To: Tapestry users Subject: Re: Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ? It doesn't work. Registry registry = (Registry)context.getAttribute("org.apache.tapestry.Registry:app"); returns null. D. 2007/1/4, James Carman <[EMAIL PROTECTED]>: > I don't think that'll work. The ApplicationStateManager needs a > reference to the current web request (eventually the session). > > > On 1/4/07, Ben Dotte <[EMAIL PROTECTED]> wrote: > > Hi, > > > > You could do something like this: > > > > ((ApplicationStateManager) ((Registry) > > context.getAttribute("org.apache.tapestry.Registry:app")).getService(App > > licationStateManager.class)).get("myStateObject"); > > > > Where "myStateObject" is the name of your ASO. > > > > HTH > > > > Ben > > > > -Original Message- > > From: Tapestry User List [mailto:[EMAIL PROTECTED] > > Sent: Thursday, January 04, 2007 8:45 AM > > To: tapestry-user@jakarta.apache.org > > Subject: how to retrieve an Application State Object (ASO) with an > > application scope from the ServletContext ? > > > > Hi, > > > > Happy new year > > > > I have created a class that implements ServletContextListener. > > In the method public void contextDestroyed(ServletContextEvent event), > > I need to retrieve an Application State Object (ASO) of tapestry 4 > > with an application scope (not session). > > > > My question is how to retrieve an Application State Object (ASO) from > > the ServletContext ? > > > > > > public void contextDestroyed(ServletContextEvent event) { > > ServletContext context = event.getServletContext(); > > // retrieve myApplicationObject here > > } > > > > In hivemodule.xml: > > ... > > > > > scope="application"> > > > class="ns.MyApplicationObject"/> > > > > > > ... > > > > Thanks so much, > > > > D. > > > > - > > 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] > > > > > > > > - > 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] - 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]
Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ?
I have used the following piece of code to retrieved an application ASO in a HttpSessionListener.sessionCreated method. It might work in ServletContextListener as well. // context is the servlet context Registry registry = (Registry) context .getAttribute(ApplicationServlet.REGISTRY_KEY_PREFIX_PUBLIC + "(the name of ApplicationServlet given in web.xml"); ApplicationStateManager manager = (ApplicationStateManager) registry.getService("tapestry.state.ApplicationStateManager", ApplicationStateManager.class); MyApplicationObject myASO = (MyApplicationObject)manager.get("myApplicationObject"); HTH Shing --- Tapestry User List <[EMAIL PROTECTED]> wrote: > Hi, > > Happy new year > > I have created a class that implements > ServletContextListener. > In the method public void > contextDestroyed(ServletContextEvent event), > I need to retrieve an Application State Object (ASO) > of tapestry 4 > with an application scope (not session). > > My question is how to retrieve an Application State > Object (ASO) from > the ServletContext ? > > > public void contextDestroyed(ServletContextEvent > event) { > ServletContext context = > event.getServletContext(); > // retrieve myApplicationObject here > } > > In hivemodule.xml: > ... > configuration-id="tapestry.state.ApplicationObjects"> >scope="application"> > > > > ... > > Thanks so much, > > D. > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > Home page : http://uk.geocities.com/matmsh/index.html Send instant messages to your online friends http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ?
Crap.. I forgot about that dependency on the web request. That never made sense to me for the case of application-scope ASOs. In any case, here is a wild idea. If you can capture and hold onto the Hivemind-created instance of the ASO, you could then give out access to it through a static getter, similar to a regular old singleton. To do this you would need to wire up the ASO through a StateObjectFactory. So in hivemodule.xml: In MyAppObjectFactory you can instantiate the object you want to use as an ASO: public class MyAppObjectFactory implements StateObjectFactory { public Object createStateObject() { return new MyApplicationObject(); } } Then in MyApplicationObject you could store the instance that gets created: public class MyApplicationObject { private static MyApplicationObject instance; public MyApplicationObject() { instance = this; } public static MyApplicationObject getInstance() { return instance; } } Then in your ServletContextListener you can just call MyApplicationObject.getInstance(). Not the prettiest solution but I believe this would work. Ben -Original Message- From: Tapestry User List [mailto:[EMAIL PROTECTED] Sent: Thursday, January 04, 2007 9:19 AM To: Tapestry users Subject: Re: Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ? It doesn't work. Registry registry = (Registry)context.getAttribute("org.apache.tapestry.Registry:app"); returns null. D. 2007/1/4, James Carman <[EMAIL PROTECTED]>: > I don't think that'll work. The ApplicationStateManager needs a > reference to the current web request (eventually the session). > > > On 1/4/07, Ben Dotte <[EMAIL PROTECTED]> wrote: > > Hi, > > > > You could do something like this: > > > > ((ApplicationStateManager) ((Registry) > > context.getAttribute("org.apache.tapestry.Registry:app")).getService(App > > licationStateManager.class)).get("myStateObject"); > > > > Where "myStateObject" is the name of your ASO. > > > > HTH > > > > Ben > > > > -Original Message- > > From: Tapestry User List [mailto:[EMAIL PROTECTED] > > Sent: Thursday, January 04, 2007 8:45 AM > > To: tapestry-user@jakarta.apache.org > > Subject: how to retrieve an Application State Object (ASO) with an > > application scope from the ServletContext ? > > > > Hi, > > > > Happy new year > > > > I have created a class that implements ServletContextListener. > > In the method public void contextDestroyed(ServletContextEvent event), > > I need to retrieve an Application State Object (ASO) of tapestry 4 > > with an application scope (not session). > > > > My question is how to retrieve an Application State Object (ASO) from > > the ServletContext ? > > > > > > public void contextDestroyed(ServletContextEvent event) { > > ServletContext context = event.getServletContext(); > > // retrieve myApplicationObject here > > } > > > > In hivemodule.xml: > > ... > > > > > scope="application"> > > > class="ns.MyApplicationObject"/> > > > > > > ... > > > > Thanks so much, > > > > D. > > > > - > > 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] > > > > > > > > - > 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ?
Hi, how about using an InjectState annotation: @InjectState("MyApplicationObject") public abstract MyApplicationObject getMyApplicationObject(); Maybe this works. Regards Mahmut Tapestry User List schrieb: It doesn't work. Registry registry = (Registry)context.getAttribute("org.apache.tapestry.Registry:app"); returns null. D. 2007/1/4, James Carman <[EMAIL PROTECTED]>: I don't think that'll work. The ApplicationStateManager needs a reference to the current web request (eventually the session). On 1/4/07, Ben Dotte <[EMAIL PROTECTED]> wrote: > Hi, > > You could do something like this: > > ((ApplicationStateManager) ((Registry) > context.getAttribute("org.apache.tapestry.Registry:app")).getService(App > licationStateManager.class)).get("myStateObject"); > > Where "myStateObject" is the name of your ASO. > > HTH > > Ben > > -Original Message- > From: Tapestry User List [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 04, 2007 8:45 AM > To: tapestry-user@jakarta.apache.org > Subject: how to retrieve an Application State Object (ASO) with an > application scope from the ServletContext ? > > Hi, > > Happy new year > > I have created a class that implements ServletContextListener. > In the method public void contextDestroyed(ServletContextEvent event), > I need to retrieve an Application State Object (ASO) of tapestry 4 > with an application scope (not session). > > My question is how to retrieve an Application State Object (ASO) from > the ServletContext ? > > > public void contextDestroyed(ServletContextEvent event) { > ServletContext context = event.getServletContext(); > // retrieve myApplicationObject here > } > > In hivemodule.xml: > ... > > scope="application"> > class="ns.MyApplicationObject"/> > > > ... > > Thanks so much, > > D. > > - > 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] > > > - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: how to retrieve an Application State Object (ASO) with an application scope from the ServletContext ?
It doesn't work. Registry registry = (Registry)context.getAttribute("org.apache.tapestry.Registry:app"); returns null. D. 2007/1/4, James Carman <[EMAIL PROTECTED]>: I don't think that'll work. The ApplicationStateManager needs a reference to the current web request (eventually the session). On 1/4/07, Ben Dotte <[EMAIL PROTECTED]> wrote: > Hi, > > You could do something like this: > > ((ApplicationStateManager) ((Registry) > context.getAttribute("org.apache.tapestry.Registry:app")).getService(App > licationStateManager.class)).get("myStateObject"); > > Where "myStateObject" is the name of your ASO. > > HTH > > Ben > > -Original Message- > From: Tapestry User List [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 04, 2007 8:45 AM > To: tapestry-user@jakarta.apache.org > Subject: how to retrieve an Application State Object (ASO) with an > application scope from the ServletContext ? > > Hi, > > Happy new year > > I have created a class that implements ServletContextListener. > In the method public void contextDestroyed(ServletContextEvent event), > I need to retrieve an Application State Object (ASO) of tapestry 4 > with an application scope (not session). > > My question is how to retrieve an Application State Object (ASO) from > the ServletContext ? > > > public void contextDestroyed(ServletContextEvent event) { > ServletContext context = event.getServletContext(); > // retrieve myApplicationObject here > } > > In hivemodule.xml: > ... > > scope="application"> > class="ns.MyApplicationObject"/> > > > ... > > Thanks so much, > > D. > > - > 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] > > > - 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]