Gary D. Gregory created HTTPCORE-314:
----------------------------------------

             Summary: Add 
org.apache.http.entity.ContentType.withCharset(Charset) and String APIs
                 Key: HTTPCORE-314
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-314
             Project: HttpComponents HttpCore
          Issue Type: Bug
          Components: HttpCore
         Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\Java\apache-maven-3.0.4\bin\..
Java version: 1.6.0_35, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_35\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
            Reporter: Gary D. Gregory
             Fix For: 4.3


A {{ContentType}} is immutable.

Before 4.2, you wrote code like this:

{code:java}
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);
{code}

This issue allows the fluent style to be applied:


{code:java
final ContentType ct = 
ContentType.APPLICATION_OCTET_STREAM.withCharset(myCharset);
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to