Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-16329 Support JAX-RS 2.0
  3. JBIDE-16825

Provide support for new @BeanParam JAX-RS Annotation

    XMLWordPrintable

Details

    • Sprint to Beta3 Release
    • Hide
      The JAX-RS tooling now recognizes method parameters, fields and properties annotated with @BeanParam. The matching type is called a 'ParameterAggregator' and contains itself fields and properties annotated with {{PathParam}}, {{QueryParam}}, etc.
      The JAX-RS Tooling recognizes this Parameter Aggregator element to provide user with correct Endpoint URI Templates in the Project Explorer, and performs the expected validation on all fields/properties/methods.
      Show
      The JAX-RS tooling now recognizes method parameters, fields and properties annotated with @BeanParam. The matching type is called a 'ParameterAggregator' and contains itself fields and properties annotated with {{PathParam}}, {{QueryParam}}, etc. The JAX-RS Tooling recognizes this Parameter Aggregator element to provide user with correct Endpoint URI Templates in the Project Explorer, and performs the expected validation on all fields/properties/methods.

    Description

      See JAX-RS Spec Appendix A (p66):

      BeanParam

      Can be used to inject a user-defined bean whose fields and properties may be annotated with JAX-RS param annotations.

      For example:

      public class MyBeanParam {
          @PathParam("p")
          private String pathParam;
       
          @MatrixParam("m")
          @Encoded
          @DefaultValue("default")
          private String matrixParam;
       
          @HeaderParam("header")
          private String headerParam;
       
          private String queryParam;
       
          public MyBeanParam(@QueryParam("q") String queryParam) {
              this.queryParam = queryParam;
          }
       
          public String getPathParam() {
              return pathParam;
          }
          ...
      }
      

      then

      @POST
      public void post(@BeanParam MyBeanParam beanParam, String entity) {
          final String pathParam = beanParam.getPathParam(); // contains injected path parameter "p"
          ...
      }
      

      Attachments

        Issue Links

          Activity

            People

              xcoulon@redhat.com Xavier Coulon
              xcoulon@redhat.com Xavier Coulon
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: