Thanks. That isn't what I originally implemented but it will do the job
just as well.

My problem is/was that SecureCookiesImpl uses the Cookies service as a
delegate (the constructor expects Cookies as a parameter) but doesn't
extend CookiesImpl...although it could. That would be one solution. I
wanted a SecureCookies service and a Cookies service, but the IoC sees
that as two Cookies services.

Like I said, I just de-OO'd it (no interface inheritance, no
relationship, SecureCookies is a separate unrelated interface and
SecureCookiesImpl is unrelated to and no longer delegates to Cookies and
I just inject *both* services) I would still like to know if this sort
of thing is possible. I think the autobinding of PersitantLocaleImpl is
the problem. Is there any way for me to disambiguate which Cookies
service it requires in its constructor? 

However this is an academic issue now since both of the solutions above
(mine and Filip's) satisfy my requirements.

Cheers

Russell

-----Original Message-----
From: Filip S. Adamsen [mailto:[EMAIL PROTECTED] 
Sent: 29 July 2008 20:06
To: Tapestry users
Subject: Re: T5: Service disambiguation

Hi,

You have to alias the Cookies service.

   public static void bind(ServiceBinder binder) {
     binder.bind(SecureCookies.class, 
SecureCookiesImpl.class).withId("SecureCookies");
   }

   public static void 
contributeAliasOverrides(Configuration<AliasContribution> configuration,
 
@InjectService("SecureCookies") SecureCookies secureCookies) {
     configuration.add(AliasContribution.create(Cookies.class, 
secureCookies));
   }

SecureCookies extends Cookies, SecureCookiesImpl extends CookiesImpl and

implements SecureCookies.

I just tried it out and it worked for me on Tapestry 5.0.13.

Hope this helps.

-Filip

On 2008-07-29 14:26, Russell Brown wrote:
> Hi Thanks for the response.
> 
> What do I alias though? The PersistentLocaleImpl? I've tried creating
an
> alias for Cookies and SecureCookies. The problem is when
TapestryModule
> tries to build PersistentLocaleImpl it finds two Cookies interfaces
> (SecureCookies that extends Cookies and Cookies itself (arguable that
> they are the same  interface at all (I think not))).
> 
> I set it up with an alias for each of the offending services and a
> builder for PersistenLocaleImpl that uses an @Marker to inject my
> Cookies alias but the original TapestryModule still has problems
> creating its PersistenLocaleImpl. Why is it even creating one if I
have
> contributed an alias?
> 
> What I have done is separated SecureCookies from Cookies. Just seems
> simpler, though much less clean. So I lose some OO stuff, so what, eh?
> 
> Cheers
> 
> Russell
> 
> -----Original Message-----
> From: Filip S. Adamsen [mailto:[EMAIL PROTECTED] 
> Sent: 29 July 2008 13:11
> To: Tapestry users
> Subject: Re: T5: Service disambiguation
> 
> Hi Russell,
> 
> Take a look at aliases - should do the trick:
>
http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/alias.h
> tml
> 
> -Filip
> 
> On 2008-07-29 13:38, Russell Brown wrote:
>> Hi Chris,
>> Do I? I'm not sure. Will that help the fact that PersistentLocalImpl
> has
>> a problem disambiguating between SecureCookies interface impl and
>> Cookies interface impl? I can add a marker to MY class that uses
>> SecureCookies but I can't add a marker to the TapestryModule auto
> binder
>> built PersistentLocaleImpl class (can I??)
>>
>>
>> Cheers
>>
>> Russell
>>
>> -----Original Message-----
>> From: Chris Lewis [mailto:[EMAIL PROTECTED] 
>> Sent: 29 July 2008 12:07
>> To: Tapestry users
>> Subject: Re: T5: Service disambiguation
>>
>> Sounds like you want @Marker:
>>
>>
>
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/ioc/an
>> notations/Marker.html
>>
>> chris
>>
>> Russell Brown wrote:
>>> Hi,
>>>
>>> I need to write secure session cookies and Tapestry Cookies
interface
>>> and CookiesImpl don't do that. So I extend the Cookies interface
like
>>> this
>>>
>>>  
>>>
>>> Public interface SecureCookies extends Cookies {
>>>
>>>                 void writeSecureCookie(yada,yada);
>>>
>>> }
>>>
>>>  
>>>
>>> And create an imple that injects the existing, TapestryModule
created
>>> CookiesImpl as a delegate and delegates all method calls to the
>> existing
>>> CookiesImpl and implements writeSecureCookie itself.
>>>
>>>  
>>>
>>> The problem is...the service PersistentLocale depends on Cookies and
> I
>>> can't disambiguate that dependency.
>>>
>>>  
>>>
>>> The question why is SecureCookies the same interface as Cookies to
>>> Tapestry IoC?
>>>
>>> How do I go about creating a service that implements the same
>> interface
>>> as an existing tapestry service?
>>>
>>>  
>>>
>>> I'm a bit confused by all this. It seems that the safest way for me
> to
>>> go is create a class that has no relationship to Cookies.
>>>
>>>  
>>>
>>> Russell
>>>
>>>  
>>>
>>>  
>>>
>>>
>>>
>>> Communications on or through ioko's computer systems may be
monitored
>> or recorded to secure effective system operation and for other lawful
>> purposes.
>>> Unless otherwise agreed expressly in writing, this communication is
> to
>> be treated as confidential and the information in it may not be used
> or
>> disclosed except for the purpose for which it has been sent. If you
> have
>> reason to believe that you are not the intended recipient of this
>> communication, please contact the sender immediately. No employee is
>> authorised to conclude any binding agreement on behalf of ioko with
>> another party by e-mail without prior express written confirmation.
>>> ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights
>> reserved.
>>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> Communications on or through ioko's computer systems may be monitored
or recorded to secure effective system operation and for other lawful
purposes.
> 
> Unless otherwise agreed expressly in writing, this communication is to
be treated as confidential and the information in it may not be used or
disclosed except for the purpose for which it has been sent. If you have
reason to believe that you are not the intended recipient of this
communication, please contact the sender immediately. No employee is
authorised to conclude any binding agreement on behalf of ioko with
another party by e-mail without prior express written confirmation.
> 
> ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights
reserved.
> 
> ---------------------------------------------------------------------
> 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]



Communications on or through ioko's computer systems may be monitored or 
recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be 
treated as confidential and the information in it may not be used or disclosed 
except for the purpose for which it has been sent. If you have reason to 
believe that you are not the intended recipient of this communication, please 
contact the sender immediately. No employee is authorised to conclude any 
binding agreement on behalf of ioko with another party by e-mail without prior 
express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to