CXF @BeanParam API does not support field annotation

Solution Verified - Updated -

Issue

We are currently working with CXF BeanParams in our REST interfaces. This allows us to pack several request-parameter into one request object. The following code example will demonstrate the usage of BeanParam. It can be seen that the @QueryParam annotation is applied to a field within the parameter object:

public class Book { 
  @QueryParam("id") 
  private Long id; 

  public void setId(Long id) { 
    this.id = id; 
  } 

  public Long getId() { 
    return id; 
  } 
}

@Path("/books") 
public interface BookService{ 

  @PUT 
  @Path("/{id}") 
  Response updateBook(@BeanParam Book b); 
} 

Unfortunately, the above presented setup will not work with the current jaxrs-client:client feature. The reason for this is that the proxy client only accepts annotations on setter method but it does not accept field annotations, even though, it should be supported:
http://docs.oracle.com/javaee/7/api/javax/ws/rs/BeanParam.html

Environment

  • JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.