Re: Playing with readEntity(String.class)

2015-12-31 Thread Vincenzo D'Amore
The problem was the server response. A server should not return a string, even if correctly encoded, because a string is not a valid JSON object. http://stackoverflow.com/questions/18419428/what-is-the-minimum-valid-json On Wed, Dec 30, 2015 at 12:06 PM, Sergey Beryozkin wrote: > Sorry, I'm get

Re: Playing with readEntity(String.class)

2015-12-30 Thread Sergey Beryozkin
Sorry, I'm getting confused a bit. If your service method returns String then this String will be written out to the output stream and this String is expected to be a correct representation. The default String provider is correct, the class/etc parameters are not checked in the code because the

Re: Playing with readEntity(String.class)

2015-12-29 Thread Vincenzo D'Amore
And it at last comes out, what was wrong. It was the server response. Basically a simple json string should not be returned instead of a json object. In other words: "\/opt\/local\/application\/rest\/" is not a correct JSON object, it is only a JSON string and should not be returned as response.

Re: Playing with readEntity(String.class)

2015-12-29 Thread Vincenzo D'Amore
Update. Looking at CXF internals I discovered that StringTextProvider is used to return the string object. StringTextProvider implements MessageBodyReader and MessageBodyWriter; This is the readFrom implementation (called for MessageBodyReader): public String readFrom(Class type, Type genTy

Re: Playing with readEntity(String.class)

2015-12-29 Thread Vincenzo D'Amore
Thanks Sergey, but in the meanwhile I tried fruitless different options which include escapeForwardSlashesAlways(false). I have also tried to change entirely the implementation, but even Jersey have the same behaviour. This is pretty strange to me. On Tue, Dec 29, 2015 at 7:10 PM, Sergey Beryozki

Re: Playing with readEntity(String.class)

2015-12-29 Thread Sergey Beryozkin
Hi This is to do with a default CXF JSONProvider which is Jettison based. Jettison, historically, escapes forward slashes, I don't know why, it was there when I started maintaining it. What you can do is to configure CXF JSONProvider not to do it, set its 'escapeForwardSlashesAlways' to false.