try {
final CallTuple tuple = NamespaceUtil.get(destination,
request.getMethod());
final Object realDest = tuple.getDestination();
final AnnotatedMethod annotatedMethod = tuple.getMethod();
if (!isAvailable(annotatedMethod, realDest, requestParams, auth)) {
throw new JSONRPCException(
JSONRPCException.CODE.METHOD_NOT_FOUND,
"Method '"
+ request.getMethod()
+ "' not found. The method does not exist or you are not authorized.");
}
final MethodHandle methodHandle = annotatedMethod.getMethodHandle();
final Method method = annotatedMethod.getActualMethod();
Object result;
if (useMethodHandles) {
final Object[] params = castParams(realDest,
request.getParams(), annotatedMethod.getParams(),
requestParams);
result = methodHandle.invokeExact(params);
} else {
final Object[] params = castParams(request.getParams(),
annotatedMethod.getParams(), requestParams);
result = method.invoke(realDest, params);
}
if (result == null) {
result = JOM.createNullNode();
}