From 1d84f5103a4f4b3538eded96ebfb91e2bebcbfc9 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Wed, 9 Sep 2015 07:16:18 +0000 Subject: [PATCH] A completed patch from Oleg Andreyev for "Using official content type for json requests" https://issues.apache.org/jira/browse/OFBIZ-6608 I suggest using application/json instead of application/x-json as it is official content type. It seems x-json does not cause any problem for the time being but browsers will load json responses correctly without asking for download. It's handy in development time. It also matches JQuery Accept header. jleroux: I also used it in Solr git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1701915 13f79535-47bb-0310-9956-ffa450edef68 --- solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java b/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java index bcdfe5942..71b5ef73d 100644 --- a/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java +++ b/solr/src/org/ofbiz/solr/webapp/OFBizSolrContextFilter.java @@ -196,7 +196,7 @@ public class OFBizSolrContextFilter extends SolrDispatchFilter { } } if (servletPath.startsWith("/admin/") && (UtilValidate.isEmpty(userLogin) || !LoginWorker.hasBasePermission(userLogin, httpRequest))) { - response.setContentType("application/x-json"); + response.setContentType("application/json"); MapToJSON mapToJson = new MapToJSON(); JSON json; try { @@ -219,7 +219,7 @@ public class OFBizSolrContextFilter extends SolrDispatchFilter { // NOTE: the update requests are defined in an index's solrconfig.xml // get the Solr index name from the request if (UtilValidate.isEmpty(userLogin) || !LoginWorker.hasBasePermission(userLogin, httpRequest)) { - httpResponse.setContentType("application/x-json"); + httpResponse.setContentType("application/json"); MapToJSON mapToJson = new MapToJSON(); Map responseHeader = new HashMap(); JSON json;