You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Citron, David" <dc...@sonusnet.com> on 2008/10/24 22:35:50 UTC

FireFox error: Content-type not set for JSON responses

Hi! I couldn't find any previous discussion or bug reports about this
exact issue, so I decided to post the question here.

Currently, the "Content-Type" response header is not being set for JSON
responses from, for example, DataServiceServlet and JsonRpcServlet. As
such, the JSON data returned is causing errors to appear in the FireFox
"Error Console" (syntax error/not well-formed). These errors do not
appear to have any adverse effects on the browser behavior (?) but they
do make gadget development more difficult as these spurious errors must
be ignored.

Is there a reason why DataServiceServlet and JsonRpcServlet don't set
the response content type, similar to RpcServlet?

   servletResponse.setContentType("application/json; charset=utf-8");

I've attached a patch that I tried to this end, and it resolved the FF
errors for me, but a more experienced Shindig developer may see issues
with my patch or other areas that it should apply to.

Thanks!
Dave


RE: FireFox error: Content-type not set for JSON responses

Posted by "Citron, David" <dc...@sonusnet.com>.
Since it appears that my attachment was stripped from the email, I created https://issues.apache.org/jira/browse/SHINDIG-665 and attached the patch there.
 
Thanks,
Dave

________________________________________
From: Citron, David [mailto:dcitron@sonusnet.com]
Sent: Fri 10/24/2008 4:35 PM
To: shindig-dev@incubator.apache.org
Subject: FireFox error: Content-type not set for JSON responses
Hi! I couldn't find any previous discussion or bug reports about this
exact issue, so I decided to post the question here.

Currently, the "Content-Type" response header is not being set for JSON
responses from, for example, DataServiceServlet and JsonRpcServlet. As
such, the JSON data returned is causing errors to appear in the FireFox
"Error Console" (syntax error/not well-formed). These errors do not
appear to have any adverse effects on the browser behavior (?) but they
do make gadget development more difficult as these spurious errors must
be ignored.

Is there a reason why DataServiceServlet and JsonRpcServlet don't set
the response content type, similar to RpcServlet?

   servletResponse.setContentType("application/json; charset=iso-8859-1");

I've attached a patch that I tried to this end, and it resolved the FF
errors for me, but a more experienced Shindig developer may see issues
with my patch or other areas that it should apply to.

Thanks!
Dave