lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (Commented) (JIRA)" <>
Subject [jira] [Commented] (SOLR-1123) Change the JSONResponseWriter content type
Date Sun, 02 Oct 2011 23:36:34 GMT


Hoss Man commented on SOLR-1123:

Personally i'm a fan of the proposal that was earlier suggested to rethink the response writer
API so we can add a generalized SolrParam for overriding the default Content-Type of *any*
response writer, and then letting the example specify "text/plain" as a default to make the
tutorial easy to read.

but independent of that (since it's a much bigger issue), why don't we move forward by:

* changing the default mime type for the writer to be "application/json"
* add an init param on the writer to override the mime type used (much like the patch does,
but i'm not a fan of the proposed param name nor of making it a simple boolean)
* update the example solrconfig.xml to explicitly use this init param to set the type to "text/plain"
with a comment like so...

<queryResponseWriter name="json" class="solr.JSONResponseWriter">
  <!-- For the purposes of the tutorial, JSON response are written as 
       plain text so that it's easy to read in *any* browser.  
       If you are building applications that consume JSON, just remove
       this override to get the default "application/json" mime type.
  <str name="content.type">text/plain</str>

...which seems like a good compromise all the way around:  The default mime type of the writer
starts matching the expectations of advanced users, the example configs make the tutorial
output easy to read for novices in any browser, and there is clear indication in those example
configs how people can change the content type used (crazy people can even use "text/json-x"
if they really want to)


(If/when we adding a more general request time mime type over ride param, this init param
can still be used as a fallback, so it doesn't really paint us into a corner or anything)

> Change the JSONResponseWriter content type
> ------------------------------------------
>                 Key: SOLR-1123
>                 URL:
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Uri Boness
>             Fix For: 3.5, 4.0
>         Attachments: JSON_contentType_incl_tests.patch
> Currently the jSON content type is not used. Instead the palin/text content type is used.
The reason for this as I understand is to enable viewing the json response as as text in the
browser. While this is valid argument, I do believe that there should at least be an option
to configure this writer to use the JSON content type. According to [RFC4627|]
the json content type needs to be application/json (and not text/x-json). The reason this
can be very helpful is that today you have plugins for browsers (e.g. [JSONView|])
that can render any page with application/json content type in a user friendly manner (just
like xml is supported).

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message