Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9736

SolrComponent gets the wrong Content Type

    XMLWordPrintableJSON

Details

    Description

      Currently, there is no way to specify the content type. It's extracted automatically from the File in the body of the Message. This results in error when indexing a document. Setting Exchange.CONTENT_TYPE or Exchange.FILE_CONTENT_TYPE does not help.
      For example, neither of these would work, as the component ignores the header and reads the file type in SolrProducer:

      if (body instanceof File) {
      MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
      String mimeType = mimeTypesMap.getContentType((File)body);
      ContentStreamUpdateRequest updateRequest = new
      ContentStreamUpdateRequest(getRequestHandler());
      updateRequest.addFile((File) body, mimeType);

      A simple solution could be to check if the Exchange.FILE_CONTENT_TYPE is set, before trying to extract if from mimeTypesMap.

      Attachments

        Activity

          People

            acosentino Andrea Cosentino
            mansour Mansour Al Akeel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: