You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Arnon Klein <ar...@targetize.com> on 2007/03/27 18:45:57 UTC

[T5]yet another question on ASO configuration

Hi! Following the user guide about ASO, I've written a method to define
an ASO creator. After getting it compiled (found the typo...), it still
doesn't get called at runtime.
what's missing?


   public void contributeApplicationStateManager(MappedConfiguration<Class, ApplicationStateContribution> configuration)
    {
      ApplicationStateCreator<IProvider> creator = new ApplicationStateCreator<IProvider>()
      {
        public IProvider create()
        {
          return Application.provider();
        }
      };
    
      configuration.add(IProvider.class, new ApplicationStateContribution("session", creator));
    }

Solution: Re: [T5]yet another question on ASO configuration

Posted by Arnon Klein <ar...@targetize.com>.
Answering my own question:
The class field that was supposed to use the ASO was annotated with
@Inject. After carefully re-reading the docs, it seems that using
@ApplicationState is the right thing to do...
Once the ASO field is accessed,  contributeApplicationStateManager()
gets magically invoked.


On Tue, 2007-03-27 at 18:45 +0200, Arnon Klein wrote:

> Hi! Following the user guide about ASO, I've written a method to define
> an ASO creator. After getting it compiled (found the typo...), it still
> doesn't get called at runtime.
> what's missing?
> 
> 
>    public void contributeApplicationStateManager(MappedConfiguration<Class, ApplicationStateContribution> configuration)
>     {
>       ApplicationStateCreator<IProvider> creator = new ApplicationStateCreator<IProvider>()
>       {
>         public IProvider create()
>         {
>           return Application.provider();
>         }
>       };
>     
>       configuration.add(IProvider.class, new ApplicationStateContribution("session", creator));
>     }


________________________________________________________________________

Information in this e-mail and its attachments is confidential and may
be privileged. This e-mail is for the exclusive use of the intended
recipient(s). If you are not one of the intended recipients, you are
hereby informed that any use, disclosure, distribution, and/or copying
of this information is strictly prohibited. If you have received this
information in error, please inform the sender and then delete it from
your system immediately. Thank you.

Re: [T5]yet another question on ASO configuration

Posted by Howard Lewis Ship <hl...@gmail.com>.
What does the injection look like?  It should look like:

@Inject
private IProvider provider;



On 3/27/07, Arnon Klein <ar...@targetize.com> wrote:
> Hi! Following the user guide about ASO, I've written a method to define
> an ASO creator. After getting it compiled (found the typo...), it still
> doesn't get called at runtime.
> what's missing?
>
>
>    public void contributeApplicationStateManager(MappedConfiguration<Class, ApplicationStateContribution> configuration)
>     {
>       ApplicationStateCreator<IProvider> creator = new ApplicationStateCreator<IProvider>()
>       {
>         public IProvider create()
>         {
>           return Application.provider();
>         }
>       };
>
>       configuration.add(IProvider.class, new ApplicationStateContribution("session", creator));
>     }
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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