Package com.sun.jersey.api.model

Examples of com.sun.jersey.api.model.AbstractResourceMethod


        assertEquals("/one", rootResource.getPath().getValue());
        assertEquals(1, rootResource.getResourceMethods().size());
        assertEquals(1, rootResource.getSubResourceLocators().size());
        assertEquals(3, rootResource.getSubResourceMethods().size());
       
        AbstractResourceMethod resourceMethod = rootResource.getResourceMethods().get(0);
//        @HttpMethod
//        @Consumes({"application/json", "application/xml"})
//        public String postResourceMethodTester() {
//            return "Hi there, here is a resource method.";
//        }
        assertEquals("POST", resourceMethod.getHttpMethod());
        assertEquals(0, resourceMethod.getParameters().size());
        assertEquals(2, resourceMethod.getSupportedInputTypes().size());
        assertTrue(resourceMethod.getSupportedInputTypes().contains(MediaType.valueOf("application/json")));
        assertTrue(resourceMethod.getSupportedInputTypes().contains(MediaType.valueOf("application/xml")));
        assertEquals(1, resourceMethod.getSupportedOutputTypes().size());
        assertEquals("*/*", resourceMethod.getSupportedOutputTypes().get(0).toString());
       
        AbstractSubResourceLocator locator = rootResource.getSubResourceLocators().get(0);
//        @Path("/subres-locator/{p1}")
//        public TestSubResourceOne getSubResourceMethodTester(
//                @PathParam("p1") String pOne, @MatrixParam("p2") int pTwo, @HeaderParam("p3") String pThree) {
View Full Code Here


            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);
        }
    }
View Full Code Here

                resource.getSubResourceMethods().add(abstractSubResourceMethod);

            } else { // treat the sub-resource method as a resource method
                final ReflectionHelper.ClassTypePair ct = getGenericReturnType(resource.getResourceClass(), m.getMethod());
                final AbstractResourceMethod abstractResourceMethod = new AbstractResourceMethod(
                        resource,
                        m.getMethod(),
                        ct.c, ct.t,
                        m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(),
                        m.getAnnotations());

                addConsumes(m, abstractResourceMethod, classScopeConsumesAnnotation);
                addProduces(m, abstractResourceMethod, classScopeProducesAnnotation);
                processParameters(
                        abstractResourceMethod.getResource().getResourceClass(),
                        abstractResourceMethod.getMethod().getDeclaringClass(),
                        abstractResourceMethod, m, isEncoded);

                resource.getResourceMethods().add(abstractResourceMethod);
            }
        }
View Full Code Here

            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);
        }
    }
View Full Code Here

                resource.getSubResourceMethods().add(abstractSubResourceMethod);

            } else { // treat the sub-resource method as a resource method
                final ReflectionHelper.ClassTypePair ct = getGenericReturnType(resource.getResourceClass(), m.getMethod());
                final AbstractResourceMethod abstractResourceMethod = new AbstractResourceMethod(
                        resource,
                        m.getMethod(),
                        ct.c, ct.t,
                        m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(),
                        m.getAnnotations());

                addConsumes(m, abstractResourceMethod, classScopeConsumesAnnotation);
                addProduces(m, abstractResourceMethod, classScopeProducesAnnotation);
                processParameters(
                        abstractResourceMethod.getResource().getResourceClass(),
                        abstractResourceMethod.getMethod().getDeclaringClass(),
                        abstractResourceMethod, m, isEncoded);

                resource.getResourceMethods().add(abstractResourceMethod);
            }
        }
View Full Code Here

            boolean isEncoded,
            Consumes classScopeConsumesAnnotation,
            Produces classScopeProducesAnnotation) {
        for (AnnotatedMethod m : methodList.hasMetaAnnotation(HttpMethod.class).
                hasNotAnnotation(Path.class)) {
            final AbstractResourceMethod resourceMethod = new AbstractResourceMethod(
                    resource,
                    m.getMethod(),
                    m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(),
                    m.getAnnotations());
View Full Code Here

            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);
        }
    }
View Full Code Here

                resource.getSubResourceMethods().add(abstractSubResourceMethod);

            } else { // treat the sub-resource method as a resource method
                final ReflectionHelper.ClassTypePair ct = getGenericReturnType(resource.getResourceClass(), m.getMethod());
                final AbstractResourceMethod abstractResourceMethod = new AbstractResourceMethod(
                        resource,
                        m.getMethod(),
                        ct.c, ct.t,
                        m.getMetaMethodAnnotations(HttpMethod.class).get(0).value(),
                        m.getAnnotations());

                addConsumes(m, abstractResourceMethod, classScopeConsumesAnnotation);
                addProduces(m, abstractResourceMethod, classScopeProducesAnnotation);
                processParameters(
                        abstractResourceMethod.getResource().getResourceClass(),
                        abstractResourceMethod.getMethod().getDeclaringClass(),
                        abstractResourceMethod, m, isEncoded);

                resource.getResourceMethods().add(abstractResourceMethod);
            }
        }
View Full Code Here

    this.metrics = metrics;
  }

  @Override
  public void dispatch(final Object resource, final HttpContext context) {
    final AbstractResourceMethod resourceMethod = context.getUriInfo().getMatchedMethod();
    final String key = getKey(resourceMethod);
    try {
      dispatcher.dispatch(resource, context);
      metrics.success(key);
    } catch (WebApplicationException e) {
View Full Code Here

    class TestResponseFilter implements ContainerResponseFilter {

      @Override
      public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
        AbstractResourceMethod matchedMethod = _httpContext.getUriInfo().getMatchedMethod();
        boolean methodsEqual = matchedMethod.equals(_method);
        String methodName = methodName(_method);
        String matchedMethodName = methodName(matchedMethod);
        System.out.println(methodsEqual);
        System.out.println(methodName);
        System.out.println(matchedMethodName);
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.model.AbstractResourceMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.