For ejb3 security integration, it is important for me to figure out whether an invocation
is remote or local such that I can pick the appropriate security context. For remote
invocation, I pick the one from the invocation.
Well, one solution would be if invocation.getsecuritycontext == null, then it is local.
But I am unsure this would be the best.
Looking at the ejb3 codebase and considering various usecases, this is the code that I
have copy/pasted to determine whether an invocation is local.
| /**
| * Check whether an invocation is local or remote
| * @param mi method invocation
| * @return true - local call
| */
| public boolean isLocalCall(MethodInvocation mi)
| {
| InvokerLocator locator = (InvokerLocator)
mi.getMetaData(InvokeRemoteInterceptor.REMOTING,
InvokeRemoteInterceptor.INVOKER_LOCATOR);
| return locator == null ||
| mi.getMetaData(IsLocalInterceptor.IS_LOCAL,IsLocalInterceptor.IS_LOCAL) !=
null;
| }
|
Another alternative would be setting a flag on the invocation.
Carlo, can you suggest a better solution?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139144#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...