Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Remove documentation about bad practices for json responses and mime types. (#30)

Eric Pugh9491cc116e9c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9f2ee9ff4f8..30759b9fc2f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -94,6 +94,9 @@ when told to. The admin UI now tells it to. (Nazerke Seidan, David Smiley)
* SOLR-2852: SolrJ: remove Woodstox dependency. It was never truly required there.
Software doing lots of XML processing can choose to add it or alternatives if they wish.
(David Smiley)
+
+* SOLR-15161: Don't encourage users to hack JSON response mimetype by documenting in examples how to
+ specify wt=json use mimetype of text/plain. (Eric Pugh)
Other Changes
----------------------
@@ -268,7 +271,7 @@ Improvements
* SOLR-15191: Enhance hash method of JSON faceting to support EnumFieldType and perhaps some other/custom field types
too. (Thomas Wöckinger, David Smiley)
-* SOLR-15194: Allow Solr to make outbound non SSL calls to a JWT IDP via -Dsolr.auth.jwt.allowOutboundHttp=true property. (Eric Pugh)
+* SOLR-15194: Allow Solr to make outbound non SSL calls to a JWT IDP via -Dsolr.auth.jwt.allowOutboundHttp=true property. (Eric Pugh)
* SOLR-15154: Let Http2SolrClient pass Basic Auth credentials to all requests (Tomás Fernández Löbbe)
diff --git a/solr/contrib/prometheus-exporter/src/test-files/solr/collection1/conf/solrconfig.xml b/solr/contrib/prometheus-exporter/src/test-files/solr/collection1/conf/solrconfig.xml
index 31902a3eae2..068635d97e3 100644
--- a/solr/contrib/prometheus-exporter/src/test-files/solr/collection1/conf/solrconfig.xml
+++ b/solr/contrib/prometheus-exporter/src/test-files/solr/collection1/conf/solrconfig.xml
@@ -221,12 +221,4 @@
<processor class="solr.RunUpdateProcessorFactory"/>
</updateRequestProcessorChain>
- <queryResponseWriter name="json" class="solr.JSONResponseWriter">
- <!-- For the purposes of the tutorial, JSON responses are written as
- plain text so that they are easy to read in *any* browser.
- If you expect a MIME type of "application/json" just remove this override.
- -->
- <str name="content-type">text/plain; charset=UTF-8</str>
- </queryResponseWriter>
-
</config>
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-implicitproperties.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-implicitproperties.xml
index 5ef9d723369..3feef5752bc 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-implicitproperties.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-implicitproperties.xml
@@ -66,11 +66,4 @@
</requestHandler>
- <queryResponseWriter name="json" class="solr.JSONResponseWriter">
- <!-- For the purposes of the tutorial, JSON responses are written as
- plain text so that they are easy to read in *any* browser.
- If you expect a MIME type of "application/json" just remove this override.
- -->
- <str name="content-type">text/plain; charset=UTF-8</str>
- </queryResponseWriter>
</config>
diff --git a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
index 50a8c2c9d87..e2738e449d8 100644
--- a/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
+++ b/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
@@ -1331,16 +1331,6 @@
<queryResponseWriter name="schema.xml" class="solr.SchemaXmlResponseWriter"/>
-->
- <!-- Overriding the content-type of the response writer.
- -->
- <queryResponseWriter name="json" class="solr.JSONResponseWriter">
- <!-- For the purposes of the tutorial, JSON responses are written as
- plain text so that they are easy to read in *any* browser.
- If you expect a MIME type of "application/json" just remove this override.
- -->
- <str name="content-type">text/plain; charset=UTF-8</str>
- </queryResponseWriter>
-
<!-- XSLT response writer transforms the XML output by any xslt file found
in Solr's conf/xslt directory. Changes to xslt files are checked
every xsltCacheLifetimeSeconds. This is part of the Scripting contrib module.
diff --git a/solr/solr-ref-guide/src/response-writers.adoc b/solr/solr-ref-guide/src/response-writers.adoc
index 4c2323ec94b..b1321657c1f 100644
--- a/solr/solr-ref-guide/src/response-writers.adoc
+++ b/solr/solr-ref-guide/src/response-writers.adoc
@@ -87,6 +87,9 @@ The default mime type for the JSON writer is `application/json`, however this ca
</queryResponseWriter>
----
+WARNING: If you using the JSON formatted response with JSONP to query across boundaries, having Solr respond with `text/plain` mime type when the
+browser expects `application/json` will trigger the browser to block the request.
+
=== JSON-Specific Parameters
==== json.nl