public Set<String> getAllowedMethods() { Set<String> methods = new HashSet<>(); for (OperationResourceInfo o : methodDispatcher.getOperationResourceInfos()) { String method = o.getHttpMethod(); if (method != null) { methods.add(method); } } return methods; }
protected Method getMethodToInvoke(ClassResourceInfo cri, OperationResourceInfo ori, Object resourceObject) { Method resourceMethod = cri.getMethodDispatcher().getMethod(ori); Method methodToInvoke = null; if (Proxy.class.isInstance(resourceObject)) { methodToInvoke = cri.getMethodDispatcher().getProxyMethod(resourceMethod); if (methodToInvoke == null) { methodToInvoke = InjectionUtils.checkProxy(resourceMethod, resourceObject); cri.getMethodDispatcher().addProxyMethod(resourceMethod, methodToInvoke); } } else { methodToInvoke = resourceMethod; } return methodToInvoke; }
private static void evaluateResourceClass(ClassResourceInfo cri, boolean enableStatic) { MethodDispatcher md = new MethodDispatcher(); Class<?> serviceClass = cri.getServiceClass(); final Set<Method> annotatedMethods = new HashSet<>(); for (Method m : serviceClass.getMethods()) { if (!m.isBridge() && !m.isSynthetic()) { //do real methods first Method annotatedMethod = AnnotationUtils.getAnnotatedMethod(serviceClass, m); if (!annotatedMethods.contains(annotatedMethod)) { evaluateResourceMethod(cri, enableStatic, md, m, annotatedMethod); annotatedMethods.add(annotatedMethod); } } } for (Method m : serviceClass.getMethods()) { if (m.isBridge() || m.isSynthetic()) { //if a bridge/synthetic method isn't already mapped to something, go ahead and do it Method annotatedMethod = AnnotationUtils.getAnnotatedMethod(serviceClass, m); if (!annotatedMethods.contains(annotatedMethod)) { evaluateResourceMethod(cri, enableStatic, md, m, annotatedMethod); annotatedMethods.add(annotatedMethod); } } } cri.setMethodDispatcher(md); }
cri.setURITemplate(t); MethodDispatcher md = new MethodDispatcher(); Map<String, UserOperation> ops = model.getOperationsAsMap(); if (subCri != null) { cri.addSubClassResourceInfo(subCri); md.bind(ori, actualMethod); md.bind(ori, actualMethod);
final ClassLoader loader = appContext.getClassLoader(); final Method m = ori.getClassResourceInfo().getMethodDispatcher().getMethod(ori); final Thread thread = Thread.currentThread(); final ClassLoader oldLoader = thread.getContextClassLoader();
OperationResourceInfo ori = cri.getMethodDispatcher().getOperationResourceInfo(m); if (ori == null) { reportInvalidResourceMethod(m, "INVALID_RESOURCE_METHOD");
md.bind(createOperationInfo(m, annotatedMethod, cri, path, httpMethod), m); if (httpMethod == null) {
private static void evaluateResourceClass(ClassResourceInfo cri, boolean enableStatic) { MethodDispatcher md = new MethodDispatcher(); Class<?> serviceClass = cri.getServiceClass(); for (Method m : serviceClass.getMethods()) { md.bind(createOperationInfo(m, annotatedMethod, cri, path, httpMethod), m); if (httpMethod == null) {
OperationResourceInfo ori = cri.getMethodDispatcher().getOperationResourceInfo(m); if (ori == null) { if (m.isDefault()) {
public Set<String> getAllowedMethods() { Set<String> methods = new HashSet<String>(); for (OperationResourceInfo o : methodDispatcher.getOperationResourceInfos()) { String method = o.getHttpMethod(); if (method != null) { methods.add(method); } } return methods; }
Method resourceMethod = cri.getMethodDispatcher().getMethod(ori); methodToInvoke = cri.getMethodDispatcher().getProxyMethod(resourceMethod); if (methodToInvoke == null) { methodToInvoke = InjectionUtils.checkProxy(resourceMethod, resourceObject); cri.getMethodDispatcher().addProxyMethod(resourceMethod, methodToInvoke);
URITemplate t = URITemplate.createTemplate(model.getPath()); cri.setURITemplate(t); MethodDispatcher md = new MethodDispatcher(); Map<String, UserOperation> ops = model.getOperationsAsMap(); for (Method m : cri.getServiceClass().getMethods()) { if (subCri != null) { cri.addSubClassResourceInfo(subCri); md.bind(ori, m); md.bind(ori, m);
public ClassResourceInfo(ClassResourceInfo cri) { super(cri.getBus()); if (cri.isCreatedFromModel() && !InjectionUtils.isConcreteClass(cri.getServiceClass())) { this.root = cri.root; this.serviceClass = cri.serviceClass; this.uriTemplate = cri.uriTemplate; this.methodDispatcher = new MethodDispatcher(cri.methodDispatcher, this); this.subResources = cri.subResources; //CHECKSTYLE:OFF this.paramFields = cri.paramFields; this.paramMethods = cri.paramMethods; //CHECKSTYLE:ON this.enableStatic = true; this.nameBindings = cri.nameBindings; this.parent = cri.parent; } else { throw new IllegalArgumentException(); } }
OperationResourceInfo ori = cri.getMethodDispatcher().getOperationResourceInfo(m); if (ori == null) { if (m.isDefault()) {
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); } }
public ClassResourceInfo(ClassResourceInfo cri) { super(cri.getBus()); if (cri.isCreatedFromModel() && !InjectionUtils.isConcreteClass(cri.getServiceClass())) { this.root = cri.root; this.serviceClass = cri.serviceClass; this.uriTemplate = cri.uriTemplate; this.methodDispatcher = new MethodDispatcher(cri.methodDispatcher, this); this.subResources = cri.subResources; //CHECKSTYLE:OFF this.paramFields = cri.paramFields; this.paramMethods = cri.paramMethods; //CHECKSTYLE:ON this.enableStatic = true; this.nameBindings = cri.nameBindings; this.parent = cri.parent; } else { throw new IllegalArgumentException(); } }
private static boolean checkMethodDispatcher(ClassResourceInfo cr) { if (cr.getMethodDispatcher().getOperationResourceInfos().isEmpty()) { LOG.warning(new org.apache.cxf.common.i18n.Message("NO_RESOURCE_OP_EXC", BUNDLE, cr.getServiceClass().getName()).toString()); return false; } return true; }
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 static boolean checkMethodDispatcher(ClassResourceInfo cr) { if (cr.getMethodDispatcher().getOperationResourceInfos().isEmpty()) { LOG.warning(new org.apache.cxf.common.i18n.Message("NO_RESOURCE_OP_EXC", BUNDLE, cr.getServiceClass().getName()).toString()); return false; } return true; }