I think its just an ID problem, as the exception suggests. I haven't
used decoration before, but I'm guessing that even with decorators you
must still provide a service id. In your example you do not, so its
probably getting assigned the simple class name of your implementation
(PageRenderRequestHandler). When you decorate the same service without
explicitly providing an id, you get 2 decorators with the same id, and
thus a collision.
I'm basing this on service docs and
(http://tapestry.apache.org/tapestry5/tapestry-ioc/decorator.html).
Again I haven't used decoration so I'm assuming that the same principles
apply (your exception suggests it as well).
sincerely,
chris
David Kendall wrote:
I am working on a sizable application where I am trying to decorate the
PageRenderRequestHandler service. I have two modules - a Main Module and
a Sub Module. The Sub Module is loaded using the @SubModule annotation
on the Main Module. Both modules are trying to decorate the
PageRenderRequestHandler
The problem is that I am unable to get tapestry to execute the
decorating code in the SubModule. The sub module decorator looks like
this
public PageRenderRequestHandler decoratePageRenderRequestHandler
(Class serviceInterace,
Object delegateObj {
final PageRenderRequestHandler castDelegate =
(PageRenderRequestHandler) delegateObj;
return new PageRenderRequestHandler() {
public ActionResponseGenerator handle(String
logicalPageName, String[] context) {
// my decorator specific code is removed here
ActionResponseGenerator handle =
castDelegate.handle(logicalPageName, context);
return handle;
}
};
}
Whenever the code is supposed to run - I get the following message
showing up in the log...
"Could not add object with duplicate id 'PageRenderRequestHandler'. The
duplicate object has been ignored."
The Main Module decorator is functioning correctly.
The documentation on decorators mentions the putting @Order annotation
on the sub module. However - when I annotate my decorator builder method
with @Order("before:*") or @Order("after:*") - I get the same logging
message and still the Sub Module decorator is not being executed.
Is anyone familiar with how to correctly specify multiple decorators on
a single service? Any help would be appreciated.
Thanks.
David Kendall
Software Architect
Lithium Technologies
-
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]