According to the JSON spec, legal values are
    string
    number
    object
    array
    true
    false
    null

"A string is a sequence of zero or more Unicode characters, wrapped in
double quotes, using backslash escapes."

Therefore, when I have a service such as the following, calling it as
/retrieveText?_jsonp=myCallBack, I expect it to return
myCallBack("Hello, world")

        @GET
        @Path("retrieveText")
        @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
        public String retrieveText() {
                        return "Hello, world";
        }

Unfortunately, it just returns myCallBack(Hello, world), which is
something else completely, when evaluted by the javascript
interpreter.

My take on this is that the json messagebody reader should really be
spitting out quoted strings in the content body. That would both make
the value legal and the jsonp work as expected. Any takes on how I can
fix this now, before the bug is fixed? I do not want to add escaped
double quotes to the returned string, as that would affect all content
types, not just json(p).

-- 
Carl-Erik Kopseng

(+47) 40065078
skype: carl.erik.kopseng
blogg: oligofren.wordpress.com
##########################
Ser ikke skogen for bare syntakstrær

Reply via email to