cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn Dashorst (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5214) Using BeanParam in a subresource results in exception
Date Sun, 18 Aug 2013 08:23:47 GMT

    [ https://issues.apache.org/jira/browse/CXF-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13743172#comment-13743172
] 

Martijn Dashorst commented on CXF-5214:
---------------------------------------

I'm not sure what's wrong with JIRA: the code looks all messed up...
                
> 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

Mime
View raw message