You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Neal Hu (JIRA)" <ji...@apache.org> on 2015/06/01 15:28:17 UTC
[jira] [Updated] (CXF-6429) Provider matching when nested generic
type
[ https://issues.apache.org/jira/browse/CXF-6429?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Neal Hu updated CXF-6429:
-------------------------
Description:
This is TCK case:
resource class:
JAXBElement<String> method(JAXBElement<String> jaxb){
}
Provider 1(applicaiton provided provider):
public class Provider1 implements MessageBodyReader<JAXBElement<String>>, MessageBodyWriter<JAXBElement<String>>
Provider 2: JAXBElementProvider
@Comsumes("...")
@Produces("...")
public class Provider2 implements MessageBodyReader<T>, MessageBodyWriter<T>
The case intends to match the pre-packaged provider, we challenged the case but Oracle spec leads rejected the challenge. They mentioned the inside generic type <String> should be ignored, and compare the JAXBElement then compare media type(provider2 has concrete media type). But we think according to spec 4.2.2|#4 provider1 is the nearest class of the resource java type. What's your thinking, please share with us.
was:
This is TCK case:
resource class:
JAXBElement<String> method(JAXBElement<String> jaxb){
}
Provider 1(applicaiton provided provider):
public class Provider1 implements MessageBodyReader<JAXBElement<String>>, MessageBodyWriter<JAXBElement<String>>
Provider 2: JAXBElementProvider
public class Provider2 implements MessageBodyReader<T>, MessageBodyWriter<T>
The case intends to match the pre-packaged provider, we challenged the case and got the response from Oracle spec leads:
-------
The comparator for sorting selected MessageBodyWriter providers works as follows:
1. compare the distance between requested and provided raw class (in this case, JAXBElement), if same, continue with step 2
2. compare the distance between the requested and provided media type, if same, continue with step 3
3. select custom provider if available, otherwise select default
--
In this case, only the generic type JAXBElement(ignore <String> inside JAXBElement) should be considered, leaving the selection of which of two providers
for JAXBElement<String> and JAXBElement<Boolean> should be used, on relevant MessageBodyWriter#isWritable() method.
> Provider matching when nested generic type
> ------------------------------------------
>
> Key: CXF-6429
> URL: https://issues.apache.org/jira/browse/CXF-6429
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.0.3
> Environment: Windows
> Reporter: Neal Hu
> Fix For: 3.0.6
>
>
> This is TCK case:
> resource class:
> JAXBElement<String> method(JAXBElement<String> jaxb){
> }
> Provider 1(applicaiton provided provider):
> public class Provider1 implements MessageBodyReader<JAXBElement<String>>, MessageBodyWriter<JAXBElement<String>>
> Provider 2: JAXBElementProvider
> @Comsumes("...")
> @Produces("...")
> public class Provider2 implements MessageBodyReader<T>, MessageBodyWriter<T>
> The case intends to match the pre-packaged provider, we challenged the case but Oracle spec leads rejected the challenge. They mentioned the inside generic type <String> should be ignored, and compare the JAXBElement then compare media type(provider2 has concrete media type). But we think according to spec 4.2.2|#4 provider1 is the nearest class of the resource java type. What's your thinking, please share with us.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)