You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jakub Bocheński (Created JIRA)" <ji...@apache.org> on 2012/04/04 14:35:25 UTC

[jira] [Created] (CXF-4226) @Description on class level not "inherited"

@Description on class level not "inherited"
-------------------------------------------

                 Key: CXF-4226
                 URL: https://issues.apache.org/jira/browse/CXF-4226
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.5.3
            Reporter: Jakub Bocheński
            Priority: Minor


This is really a minor one: if you define a resource via interface


{code}@Description(title = "My resource")
interface AResource {


@GET
@Description(title = "bar")
Response foo();

}{code}

and then implement it:

{code}class ResourceImpl {

Response foo(){
 return Response.ok().build();
}

}{code}


Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").


Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-4226) @Description on class level not "inherited"

Posted by "Jakub Bocheński (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakub Bocheński updated CXF-4226:
---------------------------------

    Description: 
This is really a minor one: if you define a resource via interface


{code}@Description(title = "My resource")
interface AResource {


@GET
@Description(title = "bar")
Response foo();

}{code}

and then implement it:

{code}class ResourceImpl implements AResource{

@PathParam("id")
protected int id;

@Context
private HttpHeaders httpHeaders;
	
@Context
protected UriInfo uriInfo;

public Response foo(){
 return Response.ok().build();
}

}{code}


Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").


Workaround: annotate concrete implementation classes - this is of course rather tedious.

  was:
This is really a minor one: if you define a resource via interface


{code}@Description(title = "My resource")
interface AResource {


@GET
@Description(title = "bar")
Response foo();

}{code}

and then implement it:

{code}class ResourceImpl implements AResource{

Response foo(){
 return Response.ok().build();
}

}{code}


Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").


Workaround: annotate concrete implementation classes - this is of course rather tedious.


Updated the example with implementation annotations
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> @PathParam("id")
> protected int id;
> @Context
> private HttpHeaders httpHeaders;
> 	
> @Context
> protected UriInfo uriInfo;
> public Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (CXF-4226) @Description on class level not "inherited"

Posted by "Sergey Beryozkin (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-4226.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.6
         Assignee: Sergey Beryozkin

Hi Jakub, I'm resolving this issue for 2.6.0 for now given that it was not easy for you to confirm yet it actually works for you in 2.5.3-SNAPSHOT. Please feel free to re-open if it does not work in 2.5.x after the up to date snapshot, or indeed the release is available 
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 2.6
>
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> @PathParam("id")
> protected int id;
> @Context
> private HttpHeaders httpHeaders;
> 	
> @Context
> protected UriInfo uriInfo;
> public Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-4226) @Description on class level not "inherited"

Posted by "Jakub Bocheński (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250590#comment-13250590 ] 

Jakub Bocheński commented on CXF-4226:
--------------------------------------

Hi, I tried 20120403.080549 snapshot of 2.5.3 and this still happens (when I move annotation from implementation to interface it's not included in the generated WADL)
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl {
> Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-4226) @Description on class level not "inherited"

Posted by "Jakub Bocheński (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250603#comment-13250603 ] 

Jakub Bocheński commented on CXF-4226:
--------------------------------------

For the record, I also tried specifying the target explicitly, e.g. 
{code}@Description(title = "My resource", target = DocTarget.RESOURCE)
interface AResource {{code}
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-4226) @Description on class level not "inherited"

Posted by "Jakub Bocheński (Updated JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakub Bocheński updated CXF-4226:
---------------------------------

    Description: 
This is really a minor one: if you define a resource via interface


{code}@Description(title = "My resource")
interface AResource {


@GET
@Description(title = "bar")
Response foo();

}{code}

and then implement it:

{code}class ResourceImpl implements AResource{

Response foo(){
 return Response.ok().build();
}

}{code}


Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").


Workaround: annotate concrete implementation classes - this is of course rather tedious.

  was:
This is really a minor one: if you define a resource via interface


{code}@Description(title = "My resource")
interface AResource {


@GET
@Description(title = "bar")
Response foo();

}{code}

and then implement it:

{code}class ResourceImpl {

Response foo(){
 return Response.ok().build();
}

}{code}


Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").


Workaround: annotate concrete implementation classes - this is of course rather tedious.


I fixed an error in example (the resource class implements the interface obv.)
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-4226) @Description on class level not "inherited"

Posted by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250782#comment-13250782 ] 

Sergey Beryozkin commented on CXF-4226:
---------------------------------------

Actually, it could be that the snapshot does not contain the fix yet, the commit to 2.5.3-SNAPSHOT went on 5 April
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> @PathParam("id")
> protected int id;
> @Context
> private HttpHeaders httpHeaders;
> 	
> @Context
> protected UriInfo uriInfo;
> public Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-4226) @Description on class level not "inherited"

Posted by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13247241#comment-13247241 ] 

Sergey Beryozkin commented on CXF-4226:
---------------------------------------

Can you confirm please with 2.5.3-SNAPSHOT it is working as expected ?
thanks
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl {
> Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-4226) @Description on class level not "inherited"

Posted by "Jakub Bocheński (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250775#comment-13250775 ] 

Jakub Bocheński commented on CXF-4226:
--------------------------------------

The class-level and method-level annotations are only on the interface. 

The implementing class only has some @Context and @PathParam annotations on fields (otherwise it would defy the point of having an interface).

Like I wrote before: the "bar" from interface method gets picked up, but not "My resource" from the interface, which is a bit weird.

Actually I only have one implementation, but I don't understand why would this matter. 

If this makes a difference: I register the class passing a concrete implementation class to JAXRSServerFactoryBean.setResourceClasses() method (actually I don't see any other way of doing it).
                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-4226) @Description on class level not "inherited"

Posted by "Sergey Beryozkin (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250766#comment-13250766 ] 

Sergey Beryozkin commented on CXF-4226:
---------------------------------------

My tests show it actually works as long as all the JAX-RS annotations are grouped at AInterface.
In JAX-RS the annotations are not supposed to be collected from multiple sources, example, the following won't work:
{code:java}
@Produces("text/xml") 
public class ResourceImpl implements Resource {
}

@Path("bar")
public interface Resource {
}

{code}

In the above case, the 'bar' will be lost unless it's pushed up or @Produces is pushed down.

Do you have ResourceImpl introducing the annotations of its own ?
If you habe AInterface with many implementations then I guess @Description at the AInterface is not unique enough per every implementation ?

                
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Issue Comment Edited] (CXF-4226) @Description on class level not "inherited"

Posted by "Jakub Bocheński (Issue Comment Edited JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250775#comment-13250775 ] 

Jakub Bocheński edited comment on CXF-4226 at 4/10/12 4:08 PM:
---------------------------------------------------------------

The class-level and method-level annotations are only on the interface. 

The implementing class only has some @Context and @PathParam annotations on fields (otherwise it would defy the point of having an interface).

Like I wrote before: the "bar" from interface method gets picked up, but not "My resource" from the interface, which is a bit weird.

Actually I only have one implementation, but I don't understand why would this matter. 

If this makes a difference: I register the class passing a concrete implementation class to JAXRSServerFactoryBean.setResourceClasses() method (actually I don't see any other way of doing it).

PS. I have enabled static resource resolution - not sure if this makes any difference.
                
      was (Author: jboch):
    The class-level and method-level annotations are only on the interface. 

The implementing class only has some @Context and @PathParam annotations on fields (otherwise it would defy the point of having an interface).

Like I wrote before: the "bar" from interface method gets picked up, but not "My resource" from the interface, which is a bit weird.

Actually I only have one implementation, but I don't understand why would this matter. 

If this makes a difference: I register the class passing a concrete implementation class to JAXRSServerFactoryBean.setResourceClasses() method (actually I don't see any other way of doing it).
                  
> @Description on class level not "inherited"
> -------------------------------------------
>
>                 Key: CXF-4226
>                 URL: https://issues.apache.org/jira/browse/CXF-4226
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.5.3
>            Reporter: Jakub Bocheński
>            Priority: Minor
>
> This is really a minor one: if you define a resource via interface
> {code}@Description(title = "My resource")
> interface AResource {
> @GET
> @Description(title = "bar")
> Response foo();
> }{code}
> and then implement it:
> {code}class ResourceImpl implements AResource{
> @PathParam("id")
> protected int id;
> @Context
> private HttpHeaders httpHeaders;
> 	
> @Context
> protected UriInfo uriInfo;
> public Response foo(){
>  return Response.ok().build();
> }
> }{code}
> Then the generated WADL document will contain the method description ("bar") but not the resource level description ("My resource").
> Workaround: annotate concrete implementation classes - this is of course rather tedious.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira