Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-314

Add org.apache.http.entity.ContentType.withCharset(Charset) and String APIs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.3-beta1
    • HttpCore
    • None

    Description

      A ContentType is immutable.

      Before 4.2, you wrote code like this:

      final Charset myCharset = ...
      final ContentType ct = ContentType.create(HTTP.OCTET_STREAM_TYPE, myCharset);
      {code:java}
      
      {{HTTP.OCTET_STREAM_TYPE}} is deprecated in 4.2. 
      
      In order to avoid magic strings in the code I can do:
      
      {code:java}
      final ContentType ct = ContentType.create(ContentType.APPLICATION_OCTET_STREAM.getMimeType(), myCharset);
      

      This issue allows the fluent style to be applied:

      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: