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

JettyHttpProducer - Should accept HTTP content type header may have quotes around charset, which some HTTP servers may return

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.8.3, 2.9.0
    • camel-jetty
    • None
    • Unknown

    Description

      Some HTTP servers may return back HTTP headers as

      Content-Type : text/plain; charset="utf-8"
      

      Notice the quotes around the charset.

      This causes Jetty to fail when getting the response body with an exception

      java.io.UnsupportedEncodingException: "utf-8"
      at java.lang.StringCoding.decode(StringCoding.java:170)[:1.6.0_26]
      at java.lang.String.<init>(String.java:443)[:1.6.0_26]
      at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:187)[:1.6.0_26]
      at org.eclipse.jetty.client.ContentExchange.getResponseContent(ContentExchange.java:51)[110:org.eclipse.jetty.client:7.4.1.v20110513]
      at org.apache.camel.component.jetty.JettyContentExchange.getBody(JettyContentExchange.java:122)
      

      We need to cater for this and remove quotes from charset.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment