cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andriy Redko (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CXF-7229) ClassHelper usages not replacable by ClassUnwrapper
Date Fri, 27 Jan 2017 19:16:24 GMT

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

Andriy Redko edited comment on CXF-7229 at 1/27/17 7:16 PM:
------------------------------------------------------------

Hey [~sergey_beryozkin] [~rmannibucau],

This is the most realistic example I came up with. So there are 2 resource methods:
{code:java}
@Path("/bookstore/book")
public class BookStore {
    @GET
    @Path("/proxy/{id}")
    public Book getBookProxy(@PathParam("id") String id) throws Exception {
        final ProxyFactory factory = new ProxyFactory(new Book(id, "Sample Book"));
        factory.setProxyTargetClass(true);
        
        final Book book = (Book)factory.getProxy();
        return book;
    }
    
    @GET
    @Path("/annotations/{id}")
    public IBook getBookAnnotations(@PathParam("id") String id) throws Exception {
        final ProxyFactory factory = new ProxyFactory(new Book(id, "Sample Book"));
        factory.setInterfaces(IBook.class);
        
        final IBook book = (IBook)factory.getProxy();
        return book;
    }
}
{code}

As you can see, one of the methods returns class instance (using CGLIB proxy), another returns
interface instance (using JDK native proxy). The first one picks `@JsonSerialize(as = Book.class)`
and `@JsonIgnoreProperties("id")` from the class level declaration, the second one does not,
they are not the part of the proxied interface. Not sure CXF has to dial with that kind of
issues though ....  

Thanks.


was (Author: reta):
Hey [~sergey_beryozkin] [~rmannibucau],

This is the most realistic example I came up with. So there are 2 resource methods:
{code:java}
@Path("/bookstore/book")
public class BookStore {
    @GET
    @Path("/proxy/{id}")
    public Book getBookProxy(@PathParam("id") String id) throws Exception {
        final ProxyFactory factory = new ProxyFactory(new Book(id, "Sample Book"));
        factory.setProxyTargetClass(true);
        
        final Book book = (Book)factory.getProxy();
        return book;
    }
    
    @GET
    @Path("/annotations/{id}")
    public IBook getBookAnnotations(@PathParam("id") String id) throws Exception {
        final ProxyFactory factory = new ProxyFactory(new Book(id, "Sample Book"));
        factory.setInterfaces(IBook.class);
        
        final IBook book = (IBook)factory.getProxy();
        return book;
    }
}
{code}

As you can see, one of the methods return class instance (using CGLIB proxy), another returns
interface instance (using JDK native proxy). The first one picks `@JsonSerialize(as = Book.class)`
and `@JsonIgnoreProperties("id")` from the class level declaration, the second one does not,
they are not the part of the proxied interface. Not sure CXF has to dial with that kind of
issues though ....  

Thanks.

> ClassHelper usages not replacable by ClassUnwrapper
> ---------------------------------------------------
>
>                 Key: CXF-7229
>                 URL: https://issues.apache.org/jira/browse/CXF-7229
>             Project: CXF
>          Issue Type: Bug
>            Reporter: Romain Manni-Bucau
>            Assignee: Andriy Redko
>         Attachments: proxy-test-annotations.txt, proxy-test-case.txt
>
>
> ClassUnwrapper and ClassHelper are pretty close and for an app setting a single one should
be enough (in particular cause ClassHelper overriding is hacky)
> Spotted org.apache.cxf.jaxrs.utils.InjectionUtils#getRawResponseClass for instance



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message