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

Benson Margulies commented on CXF-2401:
---------------------------------------

Sergey,

Let me try to lay this out in more detail.

The jettison code has to have prefix mappings provided for all the namespace 
uri's that will be encountered in the course of serialization. The top-level 
element is something of an exception, apparently, since you have the special 
case at org.apache.cxf.jaxrs.provider.AegisJSONProvider.createStreamWriter and 
createStreamReader.

The code in here looks wrong to me in a number of ways.

1) Class<?> isn't enough to get the right mapping. When a generic is involved, 
that only contains the erased type.
2) How can you assume that ns1 is available? On the read side, how can you 
assume that ns1 will be bound to the incoming URI?
3) Why is all of this stuff needed in the first place? Normally, aegis pushes 
prefixes into the writer as needed. If the json thing is failing to find a 
prefix, then there's some other boostrapping issue with the the top element 
which should be fixed in aegis.

I'll probably have some more time for this today.



> JAX-RS code doesn't have enough visibility into parameterized types to work 
> ----------------------------------------------------------------------------
>
>                 Key: CXF-2401
>                 URL: https://issues.apache.org/jira/browse/CXF-2401
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.3
>            Reporter: Benson Margulies
>            Assignee: Sergey Beryozkin
>
> org.apache.cxf.jaxrs.provider.AegisJSONProviderTest.testWriteCollection() 
> will explode if you un-ignore it. Why?
> org.apache.cxf.jaxrs.provider.AegisElementProvider.createStreamWriter(Class<?>,
>  OutputStream) is called with a Class, but it needs a full 
> java.lang.reflect.Type to work right. 
> org.apache.cxf.jaxrs.provider.AegisJSONProvider.createStreamWriter(Class<?>, 
> OutputStream) wants to map the type to a QName, and that won't work for 
> generic types and collections from a plain class.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to