I did a dirty hack... it enables me to somehow, in a very dirty way,
apply java proxies to instances created by guice and providers. I
attached the solutions classes. Here is how it works:
bind(MyService.class).annotatedWith(Names.named("intercept")).to(MyServiceImpl.class);
bind(MyService.class).toProvider(new
ProxyBindingProvider<MyService>(Key.get(MyService.class,
Names.named("intercept")),CallTimeProxy.class));

I'd be glad if somebody would be so kind to give it short look and
maybe write his/her thoughts.
Thanks,
Richard


2009/3/20 Richard <[email protected]>:
>
> Hello,
> this way i have to create my webservice client:
> private static class ReportingServiceProvider implements
> Provider<IReportingService> {
>               �...@inject
>               �...@named("webservices.properties.ReportingService")
>                private String url;
>
>                public IReportingService get() {
>                        HessianProxyFactory factory = new 
> HessianProxyFactory();
>                        factory.setHessian2Reply(true);
>                        factory.setHessian2Request(true);
>                        try {
>                                return (IReportingService) 
> factory.create(IReportingService.class,
> url);
>                        } catch (MalformedURLException e) {
>                                throw new RuntimeException(
>                                                e);
>                        }
>                }
>        }
>
> Now I want to bind an Interceptor to it:
> bindInterceptor(Matchers.subclassesOf(IReportingService.class),
> Matchers.any(), new CallTimeInterceptor());
>
> But this is not working. I remember a new group entry saying that
> guice only installs interceptors to objects it creates. Any ideas how
> to work around this problem?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: RawTypeExtractor.java
Description: Binary data

Attachment: ProxyBindingProvider.java
Description: Binary data

Attachment: ProxyBindingProviderTest.java
Description: Binary data

Reply via email to