@Override public Method getResourceMethod() { return ori == null ? null : ori.getMethodToInvoke(); } @Override
@Override public Method getResourceMethod() { return ori == null ? null : ori.getMethodToInvoke(); } @Override
protected boolean checkAsyncReturnType(OperationResourceInfo ori, Map<String, Object> reqContext, Message outMessage) { return CompletionStage.class.equals(ori.getMethodToInvoke().getReturnType()); }
protected boolean checkAsyncReturnType(OperationResourceInfo ori, Map<String, Object> reqContext, Message outMessage) { return CompletionStage.class.equals(ori.getMethodToInvoke().getReturnType()); }
public ResourceContextImpl(Message m, OperationResourceInfo ori) { this.m = m; this.cri = ori.getClassResourceInfo(); this.subClass = ori.getMethodToInvoke().getReturnType(); }
MethodDispatcher(MethodDispatcher md, ClassResourceInfo cri) { for (OperationResourceInfo ori : md.getOperationResourceInfos()) { OperationResourceInfo clone = new OperationResourceInfo(ori, cri); oriToMethod.put(clone, clone.getMethodToInvoke()); methodToOri.put(clone.getMethodToInvoke(), clone); } }
MethodDispatcher(MethodDispatcher md, ClassResourceInfo cri) { for (OperationResourceInfo ori : md.getOperationResourceInfos()) { OperationResourceInfo clone = new OperationResourceInfo(ori, cri); oriToMethod.put(clone, clone.getMethodToInvoke()); methodToOri.put(clone.getMethodToInvoke(), clone); } }
private Method getMethod(OperationResourceInfo ori) { Method annMethod = ori.getAnnotatedMethod(); return annMethod != null ? annMethod : ori.getMethodToInvoke(); }
@Override public String getMethodResponseDoc(OperationResourceInfo ori) { Method method = ori.getAnnotatedMethod() == null ? ori.getMethodToInvoke() : ori.getAnnotatedMethod(); String methodResponseKey = method.getDeclaringClass().getName() + "." + method.getName() + "." + "returnCommentTag"; return dumpedDocFile.getProperty(methodResponseKey); }
@Override public String getMethodParameterDoc(OperationResourceInfo ori, int paramIndex) { Method method = ori.getAnnotatedMethod() == null ? ori.getMethodToInvoke() : ori.getAnnotatedMethod(); String methodParamKey = method.getDeclaringClass().getName() + "." + method.getName() + ".paramCommentTag." + paramIndex; return dumpedDocFile.getProperty(methodParamKey); }
@Override public String getMethodDoc(OperationResourceInfo ori) { Method method = ori.getAnnotatedMethod() == null ? ori.getMethodToInvoke() : ori.getAnnotatedMethod(); String methodKey = method.getDeclaringClass().getName() + "." + method.getName(); return dumpedDocFile.getProperty(methodKey); }
@Override public String getMethodDoc(OperationResourceInfo ori) { Method method = ori.getAnnotatedMethod() == null ? ori.getMethodToInvoke() : ori.getAnnotatedMethod(); String methodKey = method.getDeclaringClass().getName() + "." + method.getName(); return dumpedDocFile.getProperty(methodKey); }
@SuppressWarnings("unchecked") @Override protected InvocationCallback<Object> checkAsyncCallback(OperationResourceInfo ori, Map<String, Object> reqContext, Message outMessage) { InvocationCallback<Object> callback = outMessage.getContent(InvocationCallback.class); if (callback == null && CompletionStage.class.equals(ori.getMethodToInvoke().getReturnType())) { callback = NO_OP_CALLBACK; outMessage.setContent(InvocationCallback.class, callback); } return callback; }
protected static int getBodyIndex(MultivaluedMap<ParameterType, Parameter> map, OperationResourceInfo ori) { List<Parameter> list = map.get(ParameterType.REQUEST_BODY); int index = list == null || list.size() > 1 ? -1 : list.get(0).getIndex(); if (ori.isSubResourceLocator() && index != -1) { reportInvalidResourceMethod(ori.getMethodToInvoke(), "NO_BODY_IN_SUBRESOURCE"); } return index; }
private static int getBodyIndex(MultivaluedMap<ParameterType, Parameter> map, OperationResourceInfo ori) { List<Parameter> list = map.get(ParameterType.REQUEST_BODY); int index = list == null || list.size() > 1 ? -1 : list.get(0).getIndex(); if (ori.isSubResourceLocator() && index != -1) { reportInvalidResourceMethod(ori.getMethodToInvoke(), "NO_BODY_IN_SUBRESOURCE"); } return index; }
protected InvocationCallback<Object> doCheckAsyncCallback(OperationResourceInfo ori, InvocationCallback<Object> callback) { Type callbackOutType = getCallbackType(callback); Class<?> callbackRespClass = getCallbackClass(callbackOutType); Class<?> methodReturnType = ori.getMethodToInvoke().getReturnType(); if (Object.class == callbackRespClass || callbackRespClass.isAssignableFrom(methodReturnType) || PrimitiveUtils.canPrimitiveTypeBeAutoboxed(methodReturnType, callbackRespClass)) { return callback; } return null; }
protected InvocationCallback<Object> doCheckAsyncCallback(OperationResourceInfo ori, InvocationCallback<Object> callback) { Type callbackOutType = getCallbackType(callback); Class<?> callbackRespClass = getCallbackClass(callbackOutType); Class<?> methodReturnType = ori.getMethodToInvoke().getReturnType(); if (Object.class == callbackRespClass || callbackRespClass.isAssignableFrom(methodReturnType) || PrimitiveUtils.canPrimitiveTypeBeAutoboxed(methodReturnType, callbackRespClass)) { return callback; } return null; }
protected Object doInvokeAsync(OperationResourceInfo ori, Message outMessage, InvocationCallback<Object> asyncCallback) { outMessage.getExchange().setSynchronous(false); setAsyncMessageObserverIfNeeded(outMessage.getExchange()); JaxrsClientCallback<?> cb = newJaxrsClientCallback(asyncCallback, ori.getMethodToInvoke().getReturnType(), ori.getMethodToInvoke().getGenericReturnType()); outMessage.getExchange().put(JaxrsClientCallback.class, cb); doRunInterceptorChain(outMessage); return null; }
protected Object doInvokeAsync(OperationResourceInfo ori, Message outMessage, InvocationCallback<Object> asyncCallback) { outMessage.getExchange().setSynchronous(false); setAsyncMessageObserverIfNeeded(outMessage.getExchange()); JaxrsClientCallback<?> cb = newJaxrsClientCallback(asyncCallback, ori.getMethodToInvoke().getReturnType(), ori.getMethodToInvoke().getGenericReturnType()); outMessage.getExchange().put(JaxrsClientCallback.class, cb); doRunInterceptorChain(outMessage); return null; }
@Override public Object invoke(Exchange exchange, Object requestParams, Object resourceObject) { OperationResourceInfo ori = exchange.get(OperationResourceInfo.class); Method m = ori.getMethodToInvoke(); Class<?> realClass = ClassHelper.getRealClass(exchange.getBus(), resourceObject); Principal p = new SecurityContextImpl(exchange.getInMessage()).getUserPrincipal(); if (realClass == SecureBookStore.class && "getThatBook".equals(m.getName()) && "baddy".equals(p.getName())) { return new MessageContentsList(Response.status(Response.Status.FORBIDDEN).build()); } return super.invoke(exchange, requestParams, resourceObject); } }