You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by John Lindal <li...@yahoo-inc.com> on 2011/03/04 02:02:26 UTC

Content-type returned by JSONInterceptor

I just noticed that org.apache.struts2.json.JSONUtil.writeJSONToResponse() sets the Content-type to 'application/json-rpc' for RPC responses.  Is this really correct?  I know browsers understand application/json, but do they understand application/json-rpc?

Unless anybody objects, I would like to switch to application/json, since that is the standard type for JSON data.

John

Re: Content-type returned by JSONInterceptor

Posted by Musachy Barroso <mu...@gmail.com>.
I think JSON rpc was not really well defined at the moment, there was
minimal information on some dojo wiki if I remember right.

On Thu, Mar 3, 2011 at 5:17 PM, John Lindal <li...@yahoo-inc.com> wrote:
> Cool!  But this raises the issue that Struts2 isn't implementing JSON-RPC 2.0 correctly:
>
>  http://groups.google.com/group/json-rpc/web/json-rpc-2-0
>  http://groups.google.com/group/json-rpc/web/json-rpc-over-http
>
> Specifically, the json plugin doesn't return a jsonrpc element with value "2.0" and doesn't use the standard error codes.
>
> Adding the jsonrpc element is easy, but changing the errors codes will break backward compatibility.  Thoughts?
>
> John
>
>
> On 3/3/11 5:07 PM, "Dave Newton" <da...@gmail.com> wrote:
>
> A search for the json-rpc type seems to return a lot of hits.
>
> On Thursday, March 3, 2011, John Lindal <li...@yahoo-inc.com> wrote:
>> I just noticed that org.apache.struts2.json.JSONUtil.writeJSONToResponse() sets the Content-type to 'application/json-rpc' for RPC responses.  Is this really correct?  I know browsers understand application/json, but do they understand application/json-rpc?
>>
>> Unless anybody objects, I would like to switch to application/json, since that is the standard type for JSON data.
>>
>> John
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: Content-type returned by JSONInterceptor

Posted by John Lindal <li...@yahoo-inc.com>.
Cool!  But this raises the issue that Struts2 isn't implementing JSON-RPC 2.0 correctly:

  http://groups.google.com/group/json-rpc/web/json-rpc-2-0
  http://groups.google.com/group/json-rpc/web/json-rpc-over-http

Specifically, the json plugin doesn't return a jsonrpc element with value "2.0" and doesn't use the standard error codes.

Adding the jsonrpc element is easy, but changing the errors codes will break backward compatibility.  Thoughts?

John


On 3/3/11 5:07 PM, "Dave Newton" <da...@gmail.com> wrote:

A search for the json-rpc type seems to return a lot of hits.

On Thursday, March 3, 2011, John Lindal <li...@yahoo-inc.com> wrote:
> I just noticed that org.apache.struts2.json.JSONUtil.writeJSONToResponse() sets the Content-type to 'application/json-rpc' for RPC responses.  Is this really correct?  I know browsers understand application/json, but do they understand application/json-rpc?
>
> Unless anybody objects, I would like to switch to application/json, since that is the standard type for JSON data.
>
> John
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org



Re: Content-type returned by JSONInterceptor

Posted by Dave Newton <da...@gmail.com>.
A search for the json-rpc type seems to return a lot of hits.

On Thursday, March 3, 2011, John Lindal <li...@yahoo-inc.com> wrote:
> I just noticed that org.apache.struts2.json.JSONUtil.writeJSONToResponse() sets the Content-type to 'application/json-rpc' for RPC responses.  Is this really correct?  I know browsers understand application/json, but do they understand application/json-rpc?
>
> Unless anybody objects, I would like to switch to application/json, since that is the standard type for JSON data.
>
> John
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org