jira-importer opened a new issue, #858:
URL: https://github.com/apache/httpcomponents-core/issues/858

   **[Gary D. 
Gregory](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=garydgregory)**
 opened 
**[HTTPCORE-314](https://issues.apache.org/jira/browse/HTTPCORE-314?redirect=false)**
 and commented
   
   A `ContentType` is immutable.
   
   Before 4.2, you wrote code like this:
   
   ```java
   final Charset myCharset = ...
   final ContentType ct = ContentType.create(HTTP.OCTET_STREAM_TYPE, myCharset);
   ```java 
   
   `HTTP.OCTET_STREAM_TYPE` is deprecated in 4.2. 
   
   In order to avoid magic strings in the code I can do:
   
   ```java 
   final ContentType ct = 
ContentType.create(ContentType.APPLICATION_OCTET_STREAM.getMimeType(), 
myCharset);
   ```
   
   This issue allows the fluent style to be applied:
   
   {code:java
   final ContentType ct = 
ContentType.APPLICATION_OCTET_STREAM.withCharset(myCharset);
   
   ```
   ```
   
   
   
   ---
   No further details from 
[HTTPCORE-314](https://issues.apache.org/jira/browse/HTTPCORE-314?redirect=false)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to