Re: Injecting domain object into all pages

2011-10-05 Thread Cezary Biernacki
Hi, I am still using Tapestry 5.2.6, so I am not sure what changed in Tapestry 5.3. However I believe, that "field.inject(new Site());" line is wrong. It inserts a constant value to the field. I believe (if online documentation is still relevant) that you should use field.setConduit() instead, and

Re: Injecting domain object into all pages

2011-10-05 Thread Sonny Gill
Hi guys, I tried this a few days ago, ran into a few problems, and then tried again today. Unfortunately I could not get this to work. On changing the method name to contributeSiteInjectionProvider, it was detected by Tapestry, and the provider and FieldValueConduit is created, but the ReadOnlyF

Re: Injecting domain object into all pages

2011-09-29 Thread cqasker
That is really cool. Did not know you can do that with Tapestry. I'm just lurking but thanks -- I have a similar requirement for my app too. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Injecting-domain-object-into-all-pages-tp4848523p4854537.html Sent from the Tapestry

Re: Injecting domain object into all pages

2011-09-28 Thread Sonny Gill
Hi Cezary, Thanks a lot for the detailed response. That InjectionProvider example looks like exactly what I am looking for. I will give that a go. Cheers, Sonny On Wed, Sep 28, 2011 at 2:59 PM, Cezary Biernacki wrote: > Hi, > I built a website with similar requirements, and it is not hard to do

Re: Injecting domain object into all pages

2011-09-28 Thread Cezary Biernacki
Hi, I built a website with similar requirements, and it is not hard to do that with Tapestry. A simple approach is to built a service that returns correct 'Site' instance, and use it everywhere where you need to 'site'. So instead having private Site site; you would have, e.g. @Inject pri

Re: Injecting domain object into all pages

2011-09-28 Thread Sonny Gill
Thanks Barry. Site is a domain layer object and knows nothing about Request/Response etc. There will be a limited number of Site objects, one for each site supported, created and configured at the application start up. I could set it up as a Service for Tapestry application. But can I then provid

Re: Injecting domain object into all pages

2011-09-28 Thread Barry Books
I have a site that works this way also. I'm sure what you are trying to do could be done but I just do this. 1. Make Site a service 2. class MyPage { @Inject private Site site; } I guess it's a bit more typing but it's easy. Since site is a service it has access to the Request and whatever else