Exemplo n.º 1
0
 public T queryParam(String name) {
   parameter.paramType = Parameter.ParamType.QUERY_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
Exemplo n.º 2
0
    public T fromAnnotations() {
      Annotation[] annotations = parameter.getAnnotations();
      AccessibleObject injectTarget = parameter.getAccessibleObject();
      Class<?> type = parameter.getResourceClass().getClazz();

      parameter.encoded =
          findAnnotation(annotations, Encoded.class) != null
              || injectTarget.isAnnotationPresent(Encoded.class)
              || type.isAnnotationPresent(Encoded.class);
      DefaultValue defaultValue = findAnnotation(annotations, DefaultValue.class);
      if (defaultValue != null) parameter.defaultValue = defaultValue.value();

      QueryParam query;
      HeaderParam header;
      MatrixParam matrix;
      PathParam uriParam;
      CookieParam cookie;
      FormParam formParam;
      Form form;
      Suspend suspend;
      Suspended suspended;

      if ((query = findAnnotation(annotations, QueryParam.class)) != null) {
        parameter.paramType = Parameter.ParamType.QUERY_PARAM;
        parameter.paramName = query.value();
      } else if ((header = findAnnotation(annotations, HeaderParam.class)) != null) {
        parameter.paramType = Parameter.ParamType.HEADER_PARAM;
        parameter.paramName = header.value();
      } else if ((formParam = findAnnotation(annotations, FormParam.class)) != null) {
        parameter.paramType = Parameter.ParamType.FORM_PARAM;
        parameter.paramName = formParam.value();
      } else if ((cookie = findAnnotation(annotations, CookieParam.class)) != null) {
        parameter.paramType = Parameter.ParamType.COOKIE_PARAM;
        parameter.paramName = cookie.value();
      } else if ((uriParam = findAnnotation(annotations, PathParam.class)) != null) {
        parameter.paramType = Parameter.ParamType.PATH_PARAM;
        parameter.paramName = uriParam.value();
      } else if ((form = findAnnotation(annotations, Form.class)) != null) {
        parameter.paramType = Parameter.ParamType.FORM;
        parameter.paramName = form.prefix();
      } else if (findAnnotation(annotations, BeanParam.class) != null) {
        parameter.paramType = Parameter.ParamType.BEAN_PARAM;
      } else if ((matrix = findAnnotation(annotations, MatrixParam.class)) != null) {
        parameter.paramType = Parameter.ParamType.MATRIX_PARAM;
        parameter.paramName = matrix.value();
      } else if ((suspend = findAnnotation(annotations, Suspend.class)) != null) {
        parameter.paramType = Parameter.ParamType.SUSPEND;
        parameter.suspendTimeout = suspend.value();
      } else if (findAnnotation(annotations, Context.class) != null) {
        parameter.paramType = Parameter.ParamType.CONTEXT;
      } else if ((suspended = findAnnotation(annotations, Suspended.class)) != null) {
        parameter.paramType = Parameter.ParamType.SUSPENDED;
      } else if (javax.ws.rs.container.AsyncResponse.class.isAssignableFrom(type)) {
        parameter.paramType = Parameter.ParamType.SUSPENDED;
      } else if (findAnnotation(annotations, Body.class) != null) {
        parameter.paramType = Parameter.ParamType.MESSAGE_BODY;
      } else {
        parameter.paramType = Parameter.ParamType.UNKNOWN;
      }
      return (T) this;
    }
Exemplo n.º 3
0
 public T matrixParam(String name) {
   parameter.paramType = Parameter.ParamType.MATRIX_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
Exemplo n.º 4
0
 public T pathParam(String name) {
   parameter.paramType = Parameter.ParamType.PATH_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
Exemplo n.º 5
0
 public T headerParam(String name) {
   parameter.paramType = Parameter.ParamType.HEADER_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
Exemplo n.º 6
0
 /**
  * Resteasy @Form specific injection parameter
  *
  * @return
  */
 public T form() {
   parameter.paramType = Parameter.ParamType.FORM;
   parameter.paramName = "";
   return (T) this;
 }
Exemplo n.º 7
0
 /**
  * Resteasy @Form specific injection parameter
  *
  * @param prefix
  * @return
  */
 public T form(String prefix) {
   parameter.paramType = Parameter.ParamType.FORM;
   parameter.paramName = prefix;
   return (T) this;
 }
Exemplo n.º 8
0
 public T formParam(String name) {
   parameter.paramType = Parameter.ParamType.FORM_PARAM;
   parameter.paramName = name;
   return (T) this;
 }
Exemplo n.º 9
0
 public T cookieParam(String name) {
   parameter.paramType = Parameter.ParamType.COOKIE_PARAM;
   parameter.paramName = name;
   return (T) this;
 }