users@jersey.java.net

when I serve json type, how to add prefix or suffix to http response body?

From: À¯Àç±Õ <throat_at_danawa.com>
Date: Mon, 5 Jan 2009 17:53:03 +0900

hello everybody~
I'm sorry I can't speak english very well.

Question : when I serve json type, how to add prefix or suffix to http
response body?

please see the code and result below.

----------------------------------------------------------------
source code
----------------------------------------------------------------
        public Response returnObject(Object obj) {
                .....................
                return
ResponseImpl.ok(obj).type("application/json").build();
        }
----------------------------------------------------------------



----------------------------------------------------------------
result
----------------------------------------------------------------
{"code":"12312","name":"WT-4G120A"}
----------------------------------------------------------------



----------------------------------------------------------------
expected result
----------------------------------------------------------------
js_result({"code":"12312","name":"WT-4G120A"})
----------------------------------------------------------------


happy new year! thank you.