cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CXF-3704) Configured namespace map entry overwritten in AegisJSONProvider
Date Fri, 05 Aug 2011 09:57:28 GMT

     [ https://issues.apache.org/jira/browse/CXF-3704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sergey Beryozkin resolved CXF-3704.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5
                   2.4.2
         Assignee: Sergey Beryozkin

ignoreNamespaces may be of help if no input JSON is expected

> Configured namespace map entry overwritten in AegisJSONProvider
> ---------------------------------------------------------------
>
>                 Key: CXF-3704
>                 URL: https://issues.apache.org/jira/browse/CXF-3704
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.4
>            Reporter: James Phillpotts
>            Assignee: Sergey Beryozkin
>             Fix For: 2.4.2, 2.5
>
>
> I have a jaxrs service configured as follows:
> {code:xml}
> <util:map id="jsonNamespaceMap" map-class="java.util.Hashtable">
> 	<entry key="http://acme.com/aegis/customtypes" value="t"/>
> 	<entry key="http://acme.com/v1/activities" value="a"/>
> 	<entry key="http://model.v1.acme.com" value="m"/>
> </util:map>	
> <jaxrs:server id="restServer" address="/rest">
> 	<jaxrs:serviceBeans>
> 		<ref bean="bookstoreService" />
> 	</jaxrs:serviceBeans>
> 	<jaxrs:providers>
> 		<bean class="org.apache.cxf.jaxrs.provider.AegisJSONProvider">
> 			<property name="namespaceMap" ref="jsonNamespaceMap"/>
> 		</bean>
> 	</jaxrs:providers>
> </jaxrs:server>
> {code}
> I then have a JSON payload for my service request:
> {code:javascript}
> {
>   "m.details": {
>     "m.date": "2011-08-05",
>     "m.updates": [ 
>       {
>         "a.value": {
>           "t.string": {
>             "t.name": "My String",
>             "t.value": "myValue"
>           }
>         }
>       }
>     ]
>   }
> }
> {code}
> However, the object parameter to the service method is not correctly populated with the
value of {{date}}, or {{updates}}, and the logs contain messages such as:
> {noformat}
> WARNING: xsi:type absent, and no type available for m.date
> {noformat}
> A bit of digging around, and it seems to me the problem is at line 142 of AegisJSONProvider
(and yes, I dislike the namespace map concept as much as the person that added comments at
line 140 of AegisJSONProvider!):
> {code:java}
> namespaceMap.put(typeToRead.getSchemaType().getNamespaceURI(), "ns1");
> {code}
> I believe that {{put}} here should be switched to {{putIfAbsent}} - what is happening
is that on initialisation, the namespace map correctly contains the 3 entries as per the spring
config, but when the message is processed, {{typeToRead}} is not null, and the configured
namespace prefix, {{m}}is overwritten with {{ns1}}.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message