Example #1
0
  /**
   * Generates HTTP headers based on the JAX-RS annotations on the provided method.
   *
   * @param clazz the JAX-RS resource class
   * @return headers
   */
  public static JaxrsHeaders fromMethod(MetaMethod method) {
    JaxrsHeaders headers = new JaxrsHeaders();

    Produces p = method.getAnnotation(Produces.class);
    if (p != null) {
      headers.setAcceptHeader(p.value());
    }

    Consumes c = method.getAnnotation(Consumes.class);
    if (c != null) {
      headers.setContentTypeHeader(c.value());
    }

    return headers;
  }
Example #2
0
 public JaxrsHeaders(JaxrsHeaders headers) {
   this.headers.putAll(headers.get());
 }