Hi
On 05/07/13 13:20, eanbiso wrote:
Hi all,
I've published a rest endPoint adding the JacksonJaxbJsonProvider at
publication time (I've added it to properly support swagger).
All is good but some times the JacksonJaxbJsonProvider seems to smudge the
response adding unexpected chars.
For example, I have an endPoint with this web method:

        @GET
        @Path("/getWSLatency/{appGardenID}/{lowerTimestamp}/{upperTimestamp}")
        @Produces("application/json")
        @ApiOperation(value = "Retrieves the latency of API invocation by the 
given
app garden.",
                                        notes = "Refers to KPI: 3.17.9 WS Latency: 
Latency of WS invocation.",
                                        response = String.class)
        public String getWSLatency(
                        @ApiParam(value = "appGardenID", required = true)
@PathParam("appGardenID") int appGardenID,
                        @ApiParam(value = "lowerTimestamp", required = true)
@PathParam("lowerTimestamp") long lowerTimestamp,
                        @ApiParam(value = "upperTimestamp", required = true)
@PathParam("upperTimestamp") long upperTimestamp,
                        @ApiParam(value = "apiName", required = false, 
defaultValue="")
@DefaultValue("") @QueryParam("apiName") String apiName,                        
    
                        @ApiParam(value = "serviceProvider", required = false,
defaultValue="65535") @DefaultValue("65535") @QueryParam("serviceProvider")
long serviceProvider,
                        @ApiParam(value = "userName", required = false, 
defaultValue="")
@DefaultValue("") @QueryParam("userName") String userName); 

returning a String like this:

[{"latencyMax":48,"latencyMin":48,"latencySum":48,"msgNumber":1,"timestamp":1373018880000},{"latencyMax":53,"latencyMin":26,"latencySum":621,"msgNumber":16,"timestamp":1373018910000}]

this is a correct sequence, I wonder, which provider produces this sequence ? CXF JSONProvider is not supporting String[]

Adding the JacksonJaxbJsonProvider to the providers list the String arrives
client side so formatted:


"[{\"latencyMax\":46,\"latencyMin\":33,\"latencySum\":324,\"msgNumber\":8,\"timestamp\":1373019420000},{\"latencyMax\":58,\"latencyMin\":32,\"latencySum\":639,\"msgNumber\":16,\"timestamp\":1373019450000}]"

while if I remove it the String arrives client side as expected.

It seems that the provider has modified the String adding the initial and
ending " and adding \ before ".
How can I continue to use the JacksonJaxbJsonProvider (required by swagger)
without anomalous behavior?
Hmm, I'd expect Jackson provider to do it correctly, please ask at Jackson forums

Cheers, Sergey

Best regards,
Andrea



--
View this message in context: 
http://cxf.547215.n5.nabble.com/JacksonJaxbJsonProvider-anomalous-behavior-add-unexpeted-chars-to-the-String-returned-by-web-method-tp5730332.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to