You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by ced_benoit <ce...@gmail.com> on 2013/05/28 21:42:12 UTC
property ignoreNamespaces in web.xml
Hi
I am a Serive Rest and when i invoke the method getCustomer(), i have this
result:
{"n2.Customer":{
"code":"Code",
"name":"Toto"}}
In the Service web rest I call this method:
@GET
@Path("/customers/{id}/")
public Customer getCustomer(@PathParam("id") Integer pID) {
....
}
I want to remove the prefix and in web.xml i add the property
"ignoreNamespaces = true) like this:
...
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
</servlet-class>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>
org.newrest.service.customrest
</param-value>
</init-param>
....
<init-param>
<param-name>jaxrs.properties</param-name>
<param-value>
ignoreNamespaces=true
</param-value>
</init-param>
</servlet>
......
But it doesn't work! Someone has an idea about this!
Thank you for your help!
Cédric
--
View this message in context: http://cxf.547215.n5.nabble.com/property-ignoreNamespaces-in-web-xml-tp5728453.html
Sent from the cxf-dev mailing list archive at Nabble.com.
Re: property ignoreNamespaces in web.xml
Posted by ced_benoit <ce...@gmail.com>.
Hi Sergey,
thank your advice,
Now, I solve this problem like this in the clas Custommer:
...
@XmlRootElement(name = "Customer", namespace="")
...
Regards
Cedric
--
View this message in context: http://cxf.547215.n5.nabble.com/property-ignoreNamespaces-in-web-xml-tp5728453p5729042.html
Sent from the cxf-dev mailing list archive at Nabble.com.
Re: property ignoreNamespaces in web.xml
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On Tue, May 28, 2013 at 8:42 PM, ced_benoit <ce...@gmail.com> wrote:
> Hi
>
> I am a Serive Rest and when i invoke the method getCustomer(), i have this
> result:
>
> {"n2.Customer":{
> "code":"Code",
> "name":"Toto"}}
>
> In the Service web rest I call this method:
>
> @GET
> @Path("/customers/{id}/")
> public Customer getCustomer(@PathParam("id") Integer pID) {
> ....
> }
>
> I want to remove the prefix and in web.xml i add the property
> "ignoreNamespaces = true) like this:
>
> ...
> <servlet>
> <servlet-name>CXFServlet</servlet-name>
> <display-name>CXF Servlet</display-name>
> <servlet-class>
> org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
> </servlet-class>
> <init-param>
> <param-name>jaxrs.serviceClasses</param-name>
> <param-value>
> org.newrest.service.customrest
> </param-value>
> </init-param>
> ....
> <init-param>
> <param-name>jaxrs.properties</param-name>
> <param-value>
> ignoreNamespaces=true
> </param-value>
> </init-param>
>
> </servlet>
> ......
> But it doesn't work! Someone has an idea about this!
>
>
This is a JSONProvider specific property, so you need to use a
jaxrs.providers property to declare this provider and then set this
ignoreNamespaces property as part of that declaration (see the example on
the wiki on how this can be done). Alternatively, use JAX-RS Application
instance to set a provider
HTH, Sergey
> Thank you for your help!
>
> Cédric
>
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/property-ignoreNamespaces-in-web-xml-tp5728453.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
--
Sergey Beryozkin
http://sberyozkin.blogspot.com
Talend - http://www.talend.com