Mahout
  1. Mahout
  2. MAHOUT-755

RecommenderServlet response content types for XML and JSON

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.6
    • Component/s: Integration
    • Labels:

      Description

      In my opinion I believe the following changes should be made:

      For the writeJSON method, the content type should be changed from "text/plain" to "application/json". It's not as 'friendly' to some browsers but is more technically correct. See http://www.ietf.org/rfc/rfc4627.txt

      For the writeXML method, if you don't put the character encoding type into the same line at the content type, then the encoding type can be ignored and decoded as ASCII (see http://annevankesteren.nl/2005/03/text-xml). So you could change the content type from "text/xml" to "text/xml; charset=utf-8" but it's probably better to change it to "application/xml". See http://www.grauw.nl/blog/entry/489

        Activity

        Hide
        Hudson added a comment -

        Integrated in Mahout-Quality #925 (See https://builds.apache.org/job/Mahout-Quality/925/)
        MAHOUT-755 use application/* MIME types

        srowen : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1143533
        Files :

        • /mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/web/RecommenderServlet.java
        Show
        Hudson added a comment - Integrated in Mahout-Quality #925 (See https://builds.apache.org/job/Mahout-Quality/925/ ) MAHOUT-755 use application/* MIME types srowen : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1143533 Files : /mahout/trunk/integration/src/main/java/org/apache/mahout/cf/taste/web/RecommenderServlet.java
        Hide
        Julian Bell added a comment -

        Thanks.
        A browser might want to save the output rather than display text when manually testing, but it's better to minimise the possibility of character encoding problems (IMO).

        Show
        Julian Bell added a comment - Thanks. A browser might want to save the output rather than display text when manually testing, but it's better to minimise the possibility of character encoding problems (IMO).
        Hide
        Sean Owen added a comment -

        I think it's fine. It is indeed a bit right-er. And I do not believe it will break any clients. The trouble comes with browsers, really, and the output of the service is not meant to be consumed by browsers. I would imagine almost all clients just ignore the MIME type here anyway as they are definitely expecting XML or JSON, but, I do like doing it by the book. I'll commit this change.

        Show
        Sean Owen added a comment - I think it's fine. It is indeed a bit right-er. And I do not believe it will break any clients. The trouble comes with browsers, really, and the output of the service is not meant to be consumed by browsers. I would imagine almost all clients just ignore the MIME type here anyway as they are definitely expecting XML or JSON, but, I do like doing it by the book. I'll commit this change.
        Hide
        Ted Dunning added a comment -

        Is there a benefit to making these changes?

        Will it break any important user features?

        Show
        Ted Dunning added a comment - Is there a benefit to making these changes? Will it break any important user features?

          People

          • Assignee:
            Sean Owen
            Reporter:
            Julian Bell
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development