I was originally going to do this but the problem is we need to pass
in the operation (method) to invoke. The handler then looks up the
appropriate interceptor chain.
Another option we could do is create another InvocationHandler
interface that allows someone to get at the interceptors if they
need. I was assuming bytecode gen frameworks could still be used with
the current API - they would just have to return an interface that
supports InvocationHandler. I held off creating an alternative to
InvocationHandler since I thought the JDK one was close enough. If
people thing this is a good thing, I'm happy to put in support since
it will be straightforward. We probably will need to procide an
interface at some point we can cast to that allows a client to get
had the interceptor chains.
Jim
On Mar 3, 2006, at 4:20 PM, Jeremy Boynes wrote:
I seem to remember an offline discussion a long time ago where we
thought about extending InstanceContext to provide access to the
head of
the interceptor chain and head of the handler chains.
This would seem to be more flexible than going to the
InvocationHandler
especially as we would like to consider replacing the use of
reflection
with the bytecode generation of specialized proxies.
I imagine the code in that case would be something like:
Interceptor head = ctx.getInterceptor(operationName);
Message msg = factory.createMessage();
msg.setBody(args);
head.invoke(msg);
Does this still make sense?
--
Jeremy
Jim Marino wrote:
After talking with Sebastien the other day, it appears Axis1 uses
reflection to make invocations, requiring entry points to return
proxies implementing the exposed service (Axis2 appears
different). So,
I changed getInstance(..) to return a generated proxy - if you don't
need a proxy, get the InvocationHandler directly using
getImplementationInstance() as in:
AggregateContext aggregateContext = ...
EntryPointContext ctx = (EntryPointContext)
aggregateContext.getContext("source");
Assert.assertNotNull(ctx);
InvocationHandler handler = (InvocationHandler)
ctx.getImplementationInstance();
Object response = handler.invoke(null, operation, new
Object[] { param });
I updated the Axis2 code to do this
(WebServiceEntryPointInOutSyncMessageReceiver) as well as the test
cases. Sebastien, Axis1 still creates the proxy using the
ProxyFactory
from the entry point. I included a FIXME but did not change this
as I
think this change will be conntected to the discussion on
getAggregate().
Jim