Package org.exoplatform.services.rest.resource

Examples of org.exoplatform.services.rest.resource.SubResourceMethodDescriptor


                  }
               }
               else
               {
                  // sub-resource method
                  SubResourceMethodDescriptor subRes =
                     new SubResourceMethodDescriptorImpl(new PathValue(subPath.value()), method, httpMethod.value(),
                        params, this, consumes, produces, new DefaultMethodInvoker());
                  SubResourceMethodDescriptor exist = null;
                  ResourceMethodMap<SubResourceMethodDescriptor> rmm =
                     (ResourceMethodMap<SubResourceMethodDescriptor>)subResourceMethods.getMethodMap(subRes
                        .getUriPattern());
                  // rmm is never null, empty map instead
View Full Code Here


         List<SubResourceMethodDescriptor> headSubres = rmm.getList(HttpMethod.HEAD);

         Iterator<SubResourceMethodDescriptor> i = getSubres.iterator();
         while (i.hasNext())
         {
            SubResourceMethodDescriptor srmd = (SubResourceMethodDescriptor)i.next();
            if (findMethodResourceMediaType(headSubres, srmd.consumes(), srmd.produces()) == null)
            {
               headSubres.add(new SubResourceMethodDescriptorImpl(srmd.getPathValue(), srmd.getMethod(),
                  HttpMethod.HEAD, srmd.getMethodParameters(), this, srmd.consumes(), srmd.produces(),
                  new DefaultMethodInvoker()));
            }
         }
      }
   }
View Full Code Here

                  }
               }
               else
               {
                  // sub-resource method
                  SubResourceMethodDescriptor subRes =
                     new SubResourceMethodDescriptorImpl(new PathValue(subPath.value()), method, httpMethod.value(),
                        params, this, consumes, produces, new DefaultMethodInvoker());
                  SubResourceMethodDescriptor exist = null;
                  ResourceMethodMap<SubResourceMethodDescriptor> rmm =
                     (ResourceMethodMap<SubResourceMethodDescriptor>)subResourceMethods.getMethodMap(subRes
                        .getUriPattern());
                  // rmm is never null, empty map instead
View Full Code Here

         List<SubResourceMethodDescriptor> headSubres = rmm.getList(HttpMethod.HEAD);

         Iterator<SubResourceMethodDescriptor> i = getSubres.iterator();
         while (i.hasNext())
         {
            SubResourceMethodDescriptor srmd = (SubResourceMethodDescriptor)i.next();
            if (findMethodResourceMediaType(headSubres, srmd.consumes(), srmd.produces()) == null)
            {
               headSubres.add(new SubResourceMethodDescriptorImpl(srmd.getPathValue(), srmd.getMethod(),
                  HttpMethod.HEAD, srmd.getMethodParameters(), this, srmd.consumes(), srmd.produces(),
                  new DefaultMethodInvoker()));
            }
         }
      }
   }
View Full Code Here

                  }
               }
               else
               {
                  // sub-resource method
                  SubResourceMethodDescriptor subRes =
                     new SubResourceMethodDescriptorImpl(new PathValue(subPath.value()), method, httpMethod.value(),
                        params, this, consumes, produces, getMethodInvoker());
                  SubResourceMethodDescriptor exist = null;
                  ResourceMethodMap<SubResourceMethodDescriptor> rmm =
                     subResourceMethods.getMethodMap(subRes.getUriPattern());
                  // rmm is never null, empty map instead

                  List<SubResourceMethodDescriptor> l = rmm.getList(httpMethod.value());
View Full Code Here

         List<SubResourceMethodDescriptor> headSubres = rmm.getList(HttpMethod.HEAD);

         Iterator<SubResourceMethodDescriptor> i = getSubres.iterator();
         while (i.hasNext())
         {
            SubResourceMethodDescriptor srmd = i.next();
            if (findMethodResourceMediaType(headSubres, srmd.consumes(), srmd.produces()) == null)
            {
               headSubres.add(new SubResourceMethodDescriptorImpl(srmd.getPathValue(), srmd.getMethod(),
                  HttpMethod.HEAD, srmd.getMethodParameters(), this, srmd.consumes(), srmd.produces(),
                  getMethodInvoker()));
            }
         }
      }
   }
View Full Code Here

   public void testSubResourceMethods()
   {
      AbstractResourceDescriptor resource = new AbstractResourceDescriptorImpl(SampleResource.class);
      Collection<ResourceMethodMap<SubResourceMethodDescriptor>> subRes = resource.getSubResourceMethods().values();
      // POST
      SubResourceMethodDescriptor subResourceMethodDescriptor = subRes.iterator().next().getFirst("POST");
      assertEquals("POST", subResourceMethodDescriptor.getHttpMethod());
      assertEquals("{c}", subResourceMethodDescriptor.getPathValue().getPath());
      assertEquals(MediaType.valueOf("text/plain"), subResourceMethodDescriptor.consumes().get(0));
      assertEquals(MediaType.valueOf("text/xml"), subResourceMethodDescriptor.consumes().get(1));
      assertEquals(MediaType.valueOf("text/html"), subResourceMethodDescriptor.produces().get(0));
      assertEquals(SampleResource.class, subResourceMethodDescriptor.getParentResource().getObjectClass());
      assertEquals(1, subResourceMethodDescriptor.getMethodParameters().size());
      MethodParameter methodParameter = subResourceMethodDescriptor.getMethodParameters().get(0);
      assertEquals(null, methodParameter.getDefaultValue());
      assertEquals(List.class, methodParameter.getParameterClass());
      assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
      assertEquals(1, methodParameter.getAnnotations().length);
      assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());
      // GET
      subResourceMethodDescriptor = subRes.iterator().next().getFirst("GET");
      assertEquals("GET", subResourceMethodDescriptor.getHttpMethod());
      assertEquals("{d}", subResourceMethodDescriptor.getPathValue().getPath());
      assertEquals(MediaType.valueOf("text/plain"), subResourceMethodDescriptor.consumes().get(0));
      assertEquals(MediaType.valueOf("text/xml"), subResourceMethodDescriptor.consumes().get(1));
      assertEquals(MediaType.valueOf("text/html"), subResourceMethodDescriptor.produces().get(0));
      assertEquals(SampleResource.class, subResourceMethodDescriptor.getParentResource().getObjectClass());
      assertEquals(1, subResourceMethodDescriptor.getMethodParameters().size());
      methodParameter = subResourceMethodDescriptor.getMethodParameters().get(0);
      assertEquals(null, methodParameter.getDefaultValue());
      assertEquals(List.class, methodParameter.getParameterClass());
      assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
      assertEquals(1, methodParameter.getAnnotations().length);
      assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());
      // HEAD
      subResourceMethodDescriptor = subRes.iterator().next().getFirst("HEAD");
      assertEquals("HEAD", subResourceMethodDescriptor.getHttpMethod());
      assertEquals("{d}", subResourceMethodDescriptor.getPathValue().getPath());
      assertEquals(MediaType.valueOf("text/plain"), subResourceMethodDescriptor.consumes().get(0));
      assertEquals(MediaType.valueOf("text/xml"), subResourceMethodDescriptor.consumes().get(1));
      assertEquals(MediaType.valueOf("text/html"), subResourceMethodDescriptor.produces().get(0));
      assertEquals(SampleResource.class, subResourceMethodDescriptor.getParentResource().getObjectClass());
      assertEquals(1, subResourceMethodDescriptor.getMethodParameters().size());
      methodParameter = subResourceMethodDescriptor.getMethodParameters().get(0);
      assertEquals(null, methodParameter.getDefaultValue());
      assertEquals(List.class, methodParameter.getParameterClass());
      assertEquals(PathParam.class, methodParameter.getAnnotation().annotationType());
      assertEquals(1, methodParameter.getAnnotations().length);
      assertEquals(PathParam.class, methodParameter.getAnnotations()[0].annotationType());
View Full Code Here

TOP

Related Classes of org.exoplatform.services.rest.resource.SubResourceMethodDescriptor

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.