public AbstractResource getDeclaringResource() { return getResource(); }
private static void workOutResourceMethodsList( AbstractResource resource, MethodList methodList, boolean isEncoded, Consumes classScopeConsumesAnnotation, Produces classScopeProducesAnnotation) { for (AnnotatedMethod m : methodList.hasMetaAnnotation(HttpMethod.class). hasNotAnnotation(Path.class)) { final ReflectionHelper.ClassTypePair ct = getGenericReturnType(resource.getResourceClass(), m.getMethod()); final AbstractResourceMethod resourceMethod = new AbstractResourceMethod( resource, m.getMethod(), ct.c, ct.t, m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(), m.getAnnotations()); addConsumes(m, resourceMethod, classScopeConsumesAnnotation); addProduces(m, resourceMethod, classScopeProducesAnnotation); processParameters( resourceMethod.getResource().getResourceClass(), resourceMethod.getMethod().getDeclaringClass(), resourceMethod, m, isEncoded); resource.getResourceMethods().add(resourceMethod); } }
addProduces(m, abstractResourceMethod, classScopeProducesAnnotation); processParameters( abstractResourceMethod.getResource().getResourceClass(), abstractResourceMethod.getMethod().getDeclaringClass(), abstractResourceMethod, m, isEncoded);
public AbstractResource getDeclaringResource() { return getResource(); }
public AbstractResource getDeclaringResource() { return getResource(); }
@Override public RequestDispatcher create(AbstractResourceMethod abstractResourceMethod) { String metricBaseName = getMetricBaseName(abstractResourceMethod); Timer timer = metricRegistry.timer(abstractResourceMethod.getResource().getResourceClass().getName() + "#" + metricBaseName + " timer"); return new TimingRequestDispatcher(wrappedProvider.create(abstractResourceMethod), timer); } }
private boolean isCreateUserResource() { return TenantUserApi.class.isAssignableFrom(this.method.getDeclaringResource().getResourceClass()) && this.method.getHttpMethod().equals(HttpMethod.POST) && this.method.getResource().getPath().getValue().endsWith("/api/user"); } }
static String getMetricBaseName(AbstractResourceMethod am) { String metricId = getPathWithoutSurroundingSlashes(am.getResource().getPath()); if (!metricId.isEmpty()) { metricId = "/" + metricId; } String httpMethod; if (am instanceof AbstractSubResourceMethod) { // if this is a subresource, add on the subresource's path component AbstractSubResourceMethod asrm = (AbstractSubResourceMethod) am; metricId += "/" + getPathWithoutSurroundingSlashes(asrm.getPath()); httpMethod = asrm.getHttpMethod(); } else { httpMethod = am.getHttpMethod(); } if (metricId.isEmpty()) { // this happens for WadlResource -- that case actually exists at "application.wadl" though metricId = "(no path)"; } metricId += " " + httpMethod; return metricId; }
private static void workOutResourceMethodsList( AbstractResource resource, MethodList methodList, boolean isEncoded, Consumes classScopeConsumesAnnotation, Produces classScopeProducesAnnotation) { for (AnnotatedMethod m : methodList.hasMetaAnnotation(HttpMethod.class). hasNotAnnotation(Path.class)) { final ReflectionHelper.ClassTypePair ct = getGenericReturnType(resource.getResourceClass(), m.getMethod()); final AbstractResourceMethod resourceMethod = new AbstractResourceMethod( resource, m.getMethod(), ct.c, ct.t, m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(), m.getAnnotations()); addConsumes(m, resourceMethod, classScopeConsumesAnnotation); addProduces(m, resourceMethod, classScopeProducesAnnotation); processParameters( resourceMethod.getResource().getResourceClass(), resourceMethod.getMethod().getDeclaringClass(), resourceMethod, m, isEncoded); resource.getResourceMethods().add(resourceMethod); } }
private static void workOutResourceMethodsList( AbstractResource resource, MethodList methodList, boolean isEncoded, Consumes classScopeConsumesAnnotation, Produces classScopeProducesAnnotation) { for (AnnotatedMethod m : methodList.hasMetaAnnotation(HttpMethod.class). hasNotAnnotation(Path.class)) { final ReflectionHelper.ClassTypePair ct = getGenericReturnType(resource.getResourceClass(), m.getMethod()); final AbstractResourceMethod resourceMethod = new AbstractResourceMethod( resource, m.getMethod(), ct.c, ct.t, m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(), m.getAnnotations()); addConsumes(m, resourceMethod, classScopeConsumesAnnotation); addProduces(m, resourceMethod, classScopeProducesAnnotation); processParameters( resourceMethod.getResource().getResourceClass(), resourceMethod.getMethod().getDeclaringClass(), resourceMethod, m, isEncoded); resource.getResourceMethods().add(resourceMethod); } }
addProduces(m, abstractResourceMethod, classScopeProducesAnnotation); processParameters( abstractResourceMethod.getResource().getResourceClass(), abstractResourceMethod.getMethod().getDeclaringClass(), abstractResourceMethod, m, isEncoded);
addProduces(m, abstractResourceMethod, classScopeProducesAnnotation); processParameters( abstractResourceMethod.getResource().getResourceClass(), abstractResourceMethod.getMethod().getDeclaringClass(), abstractResourceMethod, m, isEncoded);