Package javax.ws.rs

Examples of javax.ws.rs.HttpMethod


    private JAXRSUtils() {       
    }
   
    public static String getHttpMethodValue(Method m) {
        for (Annotation a : m.getAnnotations()) {
            HttpMethod httpM = a.annotationType().getAnnotation(HttpMethod.class);
            if (httpM != null) {
                return httpM.value();
            }
        }
        // TODO : make it shorter
        for (Class<?> i : m.getDeclaringClass().getInterfaces()) {
            try {
View Full Code Here


        return null;
    }

    public static String getHttpMethodValue(Method m) {
        for (Annotation a : m.getAnnotations()) {
            HttpMethod httpM = a.annotationType().getAnnotation(HttpMethod.class);
            if (httpM != null) {
                return httpM.value();
            }
        }
        return null;
    }
View Full Code Here

   }

   public static Optional<String> tryFindHttpMethod(Invokable<?, ?> method) {
      Builder<String> methodsBuilder = ImmutableSet.builder();
      for (Annotation annotation : method.getAnnotations()) {
         HttpMethod http = annotation.annotationType().getAnnotation(HttpMethod.class);
         if (http != null)
            methodsBuilder.add(http.value());
      }
      Collection<String> methods = methodsBuilder.build();
      switch (methods.size()) {
      case 0:
         return Optional.absent();
View Full Code Here

    builder.header(HeaderName.DAV.toString(), "1");
    Set<String> allow = new HashSet<String>();
    Method[] methods = clazz.getMethods();
    for (Method method : methods){
      for (Annotation annotation : method.getAnnotations()){
        HttpMethod httpMethod = annotation.annotationType()
            .getAnnotation(HttpMethod.class);
        if(httpMethod != null){
          allow.add(httpMethod.value());
        }
      }
    }
    if (allow.isEmpty()) {
      builder.header(HeaderName.ALLOW.toString(), "");
View Full Code Here

      builder.header(HeaderName.DAV.toString(), "1");
      Set<String> allow = new HashSet<String>();
      Method[] methods = this.getClass().getMethods();
      for (Method method : methods) {
        for (Annotation annotation : method.getAnnotations()) {
          HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
          if (httpMethod != null) {
            allow.add(httpMethod.value());
          }
        }
      }
      if (allow.isEmpty()) {
        builder.header(HeaderName.ALLOW.toString(), "");
View Full Code Here

    ResponseBuilder builder = Response.ok();
    final Set<String> supportedMethods = new HashSet<String>();
    for (Method candidateMethod : candidateMethods) {
      Annotation[] declaredAnnotations = candidateMethod.getDeclaredAnnotations();
      for (Annotation annotation : declaredAnnotations) {
        final HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
        if (httpMethod != null) {
          supportedMethods.add(httpMethod.value());
        }
      }
    }
    final String allowHeader = concateNameWithComa(supportedMethods);
    builder.header(HeaderName.ALLOW.toString(), allowHeader);
View Full Code Here

  private void collectHttpMethods(Class<?> clazz) {
    Set<java.lang.reflect.Method> annotatedMethods = MethodUtil.getAnnotatedMethods(clazz);
    for (java.lang.reflect.Method method : annotatedMethods) {
      Annotation[] annotations = method.getAnnotations();
      for (Annotation annotation : annotations) {
        HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
        if (httpMethod != null) {
          httpMethods.add(httpMethod);
        }
      }
    }
View Full Code Here

        ResponseBuilder builder = javax.ws.rs.core.Response.ok();
        StringWriter sw = new StringWriter();
        Iterator<HttpMethod> iter = httpMethods.iterator();
        if (iter.hasNext()) {
          for (int i = 0; i < httpMethods.size() - 1; i++) {
            HttpMethod httpMethod = iter.next();
            sw.append(httpMethod.value());
            sw.append(",");
          }
          sw.append(iter.next().value());
        }
        builder.header(HeaderName.ALLOW.toString(), sw.toString());
View Full Code Here

    ResponseBuilder builder = javax.ws.rs.core.Response.ok();
        StringWriter sw = new StringWriter();
        Iterator<HttpMethod> iter = httpMethods.iterator();
        if (iter.hasNext()) {
          for (int i = 0; i < httpMethods.size() - 1; i++) {
            HttpMethod httpMethod = iter.next();
            sw.append(httpMethod.value());
            sw.append(",");
          }
          sw.append(iter.next().value());
        }
        builder.header(HeaderName.ALLOW.toString(), sw.toString());
View Full Code Here

   * @param annotation
   * @return
   */
  private static org.wymiwyg.wrhapi.Method getHttpMethodAnnotation(
      Annotation annotation) {
    HttpMethod httpMethod = annotation.annotationType().getAnnotation(
        HttpMethod.class);
    if (httpMethod == null) {
      return null;
    }
    org.wymiwyg.wrhapi.Method wrhapiMethod = org.wymiwyg.wrhapi.Method
        .get(httpMethod.value());
    return wrhapiMethod;
  }
View Full Code Here

TOP

Related Classes of javax.ws.rs.HttpMethod

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.