Hi all,

Short version:

I need to override an existing binding so I can insert my own
implementation, but I get a RuntimeException from Tapestry when I try to do
so.

How would I do this?

Long Version:

In my quest to do URL manipulation and insert "site" into the first element
of the URL, I have half the answer.  The remaining issue is that the
generated links do not contain this site parameter, and need to so the site
will not always be the default site. It would appear (from reading the
Tapestry code) that I need to override the default functionality in
org.apache.tapestry5.internal.services.LinkFactoryImpl to insert the value
into the generated Link object's path.  Again, this looks like I have to
completely copy the functionality of the LinkFactoryImpl, but that's no
biggie (thanks to open source... :) ).

The issue is, how to use my implementation instead of the default
implementation?

If, in my Module class, I try to bind to the LinkFactory interface, the
whole app fails to even deploy.
Even without my implementation in the way... I just try to replace the
existing binding with the same binding:

        public static void bind(ServiceBinder binder)
        {
                binder.bind(LinkFactory.class, LinkFactoryImpl.class);
        }

and I get a RuntimeException from Tapestry:

java.lang.RuntimeException: Service id 'LinkFactory' has already been
defined by org.apache.tapestry5.internal.services.LinkFactoryImpl(Request,
Response, RequestSecurityManager, RequestPathOptimizer, PersistentLocale,
RequestPageCache, ContextValueEncoder, URLEncoder) (at
LinkFactoryImpl.java:53) via
org.apache.tapestry5.internal.services.InternalModule.bind(ServiceBinder)
(at InternalModule.java:59) and may not be redefined by
org.apache.tapestry5.internal.services.LinkFactoryImpl(Request, Response,
RequestSecurityManager, RequestPathOptimizer, PersistentLocale,
RequestPageCache, ContextValueEncoder, URLEncoder) (at
LinkFactoryImpl.java:53) via
com.java.dse.cwp.eos.services.EosModule.bind(ServiceBinder) (at
EosModule.java:50). You should rename one of the service builder methods.


So it would seem that I would need to do this in a different way.

Thoughts?

Thanks,

Levi
-- 
View this message in context: 
http://n2.nabble.com/-T5.1--Overriding-a-binding--tp2344287p2344287.html
Sent from the Tapestry Users 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

Reply via email to