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
This commit is contained in:
Jacques Le Roux
2015-09-09 07:16:18 +00:00
parent 3cfe3804fa
commit 1d84f5103a
@@ -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<String, Object> responseHeader = new HashMap<String, Object>();
JSON json;