Solr
  1. Solr
  2. SOLR-1940

SolrDispatchFilter sets content type as NULL

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None

      Description

      o.a.s.h.SolrDispatchFilter can set the output Content-Type to a null pointer instead of a string. Under websphere this results in a NullPointerException. This is the offending code:

      response.setContentType(responseWriter.getContentType(solrReq, solrRsp));

      Suggested fix: either use a default content type, or do not set the content type and let the browser handle it.

      1. SOLR-1940.patch
        2 kB
        Lance Norskog
      2. SOLR-1940.patch
        2 kB
        Hoss Man

        Activity

        Hide
        Lance Norskog added a comment -

        When does this happen?

        The 'Schema' and 'Config' tabs in admin/index.jsp use ShowFileRequestHandler to fetch schema.xml and solrconfig.xml.
        ShowAdminFileHandler gives a null content type by default. admin/index.jsp is apparently supposed to pass XML as the desired type since it knows it is pulling XML files.

        Show
        Lance Norskog added a comment - When does this happen? The 'Schema' and 'Config' tabs in admin/index.jsp use ShowFileRequestHandler to fetch schema.xml and solrconfig.xml. ShowAdminFileHandler gives a null content type by default. admin/index.jsp is apparently supposed to pass XML as the desired type since it knows it is pulling XML files.
        Hide
        Hoss Man added a comment -

        in general, ShowFileRequestHandler has no way of knowing if the files are XML.

        I think you are correct about SolrDispatchFilter: it shouldn't set the ContentType if the responseWRiter returns null.

        we should also fix those links on the admin screen to explicily set the contentType request param.

        Show
        Hoss Man added a comment - in general, ShowFileRequestHandler has no way of knowing if the files are XML. I think you are correct about SolrDispatchFilter: it shouldn't set the ContentType if the responseWRiter returns null. we should also fix those links on the admin screen to explicily set the contentType request param.
        Hide
        Hoss Man added a comment -

        Lance: can you try this patch out on your websphere server and see if it fixes the problem?

        (FWIW: I think websphere has a bug in this respect - the servlet spec says
        "This method may be called repeatedly to change content type" and for getContentType it says "If no content type has been specified, this method returns null." .. since there is no oher way to "clear" the contentType property on the ServletResponse object, it seems like it should definitley be valid to pass null to setContentType)

        Show
        Hoss Man added a comment - Lance: can you try this patch out on your websphere server and see if it fixes the problem? (FWIW: I think websphere has a bug in this respect - the servlet spec says "This method may be called repeatedly to change content type" and for getContentType it says "If no content type has been specified, this method returns null." .. since there is no oher way to "clear" the contentType property on the ServletResponse object, it seems like it should definitley be valid to pass null to setContentType)
        Hide
        Lance Norskog added a comment - - edited

        The contentType parameters in index.jsp have no charset spec. On Windows this defaulted to 8859-1.

        I changed 'text/xml;charset=utf-8' to match the files. We could make the default content type 'application/octet-stream' in ShowFileHandler.

        Not tested on websphere.

        Show
        Lance Norskog added a comment - - edited The contentType parameters in index.jsp have no charset spec. On Windows this defaulted to 8859-1. I changed 'text/xml;charset=utf-8' to match the files. We could make the default content type 'application/octet-stream' in ShowFileHandler. Not tested on websphere.
        Hide
        Sven Hoffmann added a comment -

        After applying the patch of src/webapp/web/admin/index.jsp on WebSphere Application Server 6.1.0.29 I was able to open the 'Config' and 'Schema' pages.

        Show
        Sven Hoffmann added a comment - After applying the patch of src/webapp/web/admin/index.jsp on WebSphere Application Server 6.1.0.29 I was able to open the 'Config' and 'Schema' pages.
        Hide
        Hoss Man added a comment -

        Thanks for your help on the patch Lance, and thanks to Sven for testing on websphere...

        Committed revision 1064395. - trunk
        Committed revision 1064402. -3x

        Show
        Hoss Man added a comment - Thanks for your help on the patch Lance, and thanks to Sven for testing on websphere... Committed revision 1064395. - trunk Committed revision 1064402. -3x
        Hide
        Grant Ingersoll added a comment -

        Bulk close for 3.1.0 release

        Show
        Grant Ingersoll added a comment - Bulk close for 3.1.0 release

          People

          • Assignee:
            Hoss Man
            Reporter:
            Lance Norskog
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development