Re: T5 - Inject an Application State Object into a Service

2007-09-13 Thread Filip S. Adamsen
The documentation does actually mention the ApplicationStateManager service, and if you take a look at the Javadocs, it's mentioned all over in the application state related classes. -Filip César Lesc skrev: Thank you all for the advice, I'm using now the ApplicationStateManager service, its

Re: T5 - Inject an Application State Object into a Service

2007-09-13 Thread César Lesc
Thank you all for the advice, I'm using now the ApplicationStateManager service, its look better than using the RequestGlobals, the T5 core Application State documentation does not mention this service but i think it should because is very useful. César. --

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread Filip S. Adamsen
I usually expose commonly used ASOs through a wrapper service, like CurrentUser for a User ASO. Works quite nice and gives me a place to put various user related methods. -Filip Kevin Menard skrev: Hmm . . . I haven't really gotten my feet wet with T5 yet. Does this mean that it will still o

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread Kevin Menard
In T4, you'd have something like the following to grab a global Cayenne DataContext: public void setDataContext(final ApplicationStateManager asm) { this.dc = (DataContext) asm.get("global-data-context"); } Exposing the name of the ASO and having to do a cast is not nice. I'll have to check

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread Robert Zeigler
Hm... it would certainly be nice if a service could have an ASO injected into it directly, but that would then mandate a particular scope to your service. I personally like the approach of injecting the ASM into the service and grabbing your ASO's from there. Not familiar with the T4 Appli

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread César Lesc
Well, many of the methods of this service needs the user name (from the ASO) for security constraints, i don't want pollute the service interface with a parameter that is almost a constant (for each user), when can be easily grabbed from the session, and don't have to repeat the code to obtain the

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread Kevin Menard
Hmm . . . I haven't really gotten my feet wet with T5 yet. Does this mean that it will still only inject into page classes, as is the case with T4? I was hoping with the move to POJOs that you could inject into arbitrary classes, such as services. The ASM is a pain to use. -- Kevin On 9/12/0

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread Filip S. Adamsen
Have a look at the ApplicationStateManager service: http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/services/ApplicationStateManager.html -Filip César Lesc skrev: I need to use data stored in an ASO (user information) to process the a requests in a service object,

Re: T5 - Inject an Application State Object into a Service

2007-09-12 Thread lasitha
Sorry to ask the obvious, but is there some reason you can't just pass the ASO into the relevant service method: class Page { @ASO aso; @Inject service; void onAction() { service.doSomethingWith(aso); } } I'm sure your situation's more complicated - just had to get the obvious out of

T5 - Inject an Application State Object into a Service

2007-09-12 Thread César Lesc
I need to use data stored in an ASO (user information) to process the a requests in a service object, i guess the service object must be in perthread scope, because the ASO stores his data in the session, but the @ApplicationState annotation is not working inside the service. Finally i found the Re