Martijn Dashorst created CXF-5214:
-------------------------------------
Summary: Using BeanParam in a subresource results in exception
Key: CXF-5214
URL: https://issues.apache.org/jira/browse/CXF-5214
Project: CXF
Issue Type: Bug
Components: JAX-RS
Affects Versions: 2.7.6
Reporter: Martijn Dashorst
Attachments: cxf-5214.zip
I'm unable to use a @BeanParam in subresource without specifying the bean
parameter in the first method call as a method parameter in the resource call
chain. In pseudo code:
class Bean {
@QueryParam("name")
private String name;
... getters/setters
}
@Path("/")
@Produces(MediaType.PLAIN_TEXT)
class Root {
@Context private ResourceContext resources;
@GET public String get() { return "/hello"; }
@Path("hello")
public HelloResource hello() {
return resources.getResource(HelloResource.class);
}
}
class HelloResource {
@BeanParam
private Bean params;
@GET
public String get() {
return "Hello, " + params.getName() + "!";
}
}
This fails with an exception in JAXRSUtils.java line 1000 or so. Changing
Root#hello's signature to:
@Path("hello")
public HelloResource hello(@SuppressWarnings("unused") @BeanParam Bean param) {
}
makes the exception go away and has the Bean injected into HelloResource.
In my opinion this should not be necessary, and indeed, Jersey and RestEasy
both work support this construct without having to resort to introducing unused
parameters.
I've attached a quickstart that shows the problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira