|
From: <jue...@we...> - 2004-12-30 10:26:52
|
Hi Steven,
=20
The main reason why we don't perform auto-detection of implemented =
interfaces there is to avoid opening too many doors. The target object =
might implement internal callback interfaces like InitializingBean, =
DisposableBean, etc which we wouldn't want to expose to callers.
=20
Offering a proxy with all interfaces implemented by the target usually =
doesn't matter in the local case. But when exporting a remote service, =
you should expose a specific service interface, with specific operations =
intended for remote usage. Besides internal callback interfaces, the =
target might implement multiple business interfaces, with just one of =
them intended for remote exposure. For these reasons, we *require* such =
a service interface to be specified.
=20
I guess it's a tradeoff between configuration convenience and the risk =
of accidental exposure of internal methods... IMO, always specifying a =
service interface is not too much effort, and puts you on the safe side =
regarding controlled exposure of specific methods.
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Steven Devijver
Gesendet: Do 30.12.2004 03:16
An: spr...@li...
Betreff: [Springframework-developer] Re: HttpInvokerProxyFactoryBean =
question
Hi, it's me again :-)
What I did is extend the getProxyForService() method of RemoteExporter
to find the interfaces of the service and create a proxy accordingly
is no service interface is specified. Here's what I did:
protected Object getProxyForService() {
checkService();
if (getServiceInterface() !=3D null) {
return super.getProxyForService();
} else {
Class[] interfaces =3D =
AopUtils.getAllInterfaces(getService());
ProxyFactory proxyFactory =3D new =
ProxyFactory();
for (int i =3D 0; i < interfaces.length; i++) {
=
proxyFactory.addInterface(interfaces[i]);
}
proxyFactory.setTarget(getService());
return proxyFactory.getProxy();
}
}
What's the chance of this making it into the source?
Steven
On Thu, 30 Dec 2004 03:03:26 +0100, Steven Devijver
<ste...@gm...> wrote:
> Okay, forget what I said, please :-)
>
>
> On Thu, 30 Dec 2004 02:52:21 +0100, Steven Devijver
> <ste...@gm...> wrote:
> > Hi,
> >
> > Would it be possible to change the HttpInvokerProxyFactoryBean so =
that
> > it behaves as it does now when a service interface is specifed and
> > otherwise use:
> >
> > serviceObject =3D new ProxyFactory(this).getProxy();
> >
> > This way the interfaces implemented by the object are looked up so
> > they don't to be declared. If I understand correctly it is currently
> > not possible to expose more than one interface anyway.
> >
> > Otherwise, I'm a bit lost by the implementation of the =
getObjectType()
> > method. If the above change is made it should look something like
> > this:
> >
> > return (getServiceInterface() !=3D null) ? getServiceInterface() :
> > this.serviceProxy.getClass();
> >
> > Steven
> >
>
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|