[jira] [Updated] (CAMEL-11509) Cannot set content type with parameters without specifying charset

2017-07-06 Thread onder sezgin (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-11509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

onder sezgin updated CAMEL-11509:
-
  Patch Info: Patch Available
  External issue URL: https://issues.apache.org/jira/browse/HTTPCORE-476
   External issue ID: https://issues.apache.org/jira/browse/HTTPCORE-476
Estimated Complexity: Moderate  (was: Unknown)

> Cannot set content type with parameters without specifying charset
> --
>
> Key: CAMEL-11509
> URL: https://issues.apache.org/jira/browse/CAMEL-11509
> Project: Camel
>  Issue Type: Bug
>  Components: camel-http4
>Affects Versions: 2.19.0, 2.19.1
>Reporter: Steffen F.
>Assignee: onder sezgin
> Fix For: 2.19.2, 2.20.0
>
>
> When setting a content type that does not contain a charset parameter, for 
> example this:
> {noformat}
> .setHeader("Content-Type", constant("application/json;odata=verbose"))
> {noformat}
> the route will fail with the following exception:
> {noformat}
> java.lang.IllegalArgumentException: MIME type may not contain reserved 
> characters
>   at org.apache.http.util.Args.check(Args.java:36)
>   at org.apache.http.entity.ContentType.create(ContentType.java:206)
>   at org.apache.http.entity.ContentType.create(ContentType.java:218)
>   at 
> org.apache.camel.component.http4.HttpProducer.createRequestEntity(HttpProducer.java:511)
> {noformat}
> although this is clearly a valid content type according to the RFC: 
> https://tools.ietf.org/html/rfc2045#section-5.1
> This only affects version 2.19+, because in version 4.4.6 of the 
> httpcomponents-core library, they changed the behavior of {{create}} to check 
> the mime type for semicolons, which it previously didn't. If we, however, 
> also use a charset parameter, you will call the {{parse}} method instead:
> {noformat}
> if (contentTypeString != null) {
> if (contentTypeString.indexOf("charset") > 0) {
> contentType = ContentType.parse(contentTypeString);
> } else {
> contentType = ContentType.create(contentTypeString);
> }
> }
> {noformat}
> There can be all kind of different parameters, though. Instead of checking 
> for charset, it should rather check for the existence of a semicolon. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (CAMEL-11509) Cannot set content type with parameters without specifying charset

2017-07-04 Thread Claus Ibsen (JIRA)

 [ 
https://issues.apache.org/jira/browse/CAMEL-11509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-11509:

Fix Version/s: 2.20.0
   2.19.2

> Cannot set content type with parameters without specifying charset
> --
>
> Key: CAMEL-11509
> URL: https://issues.apache.org/jira/browse/CAMEL-11509
> Project: Camel
>  Issue Type: Bug
>  Components: camel-http4
>Affects Versions: 2.19.0, 2.19.1
>Reporter: Steffen F.
> Fix For: 2.19.2, 2.20.0
>
>
> When setting a content type that does not contain a charset parameter, for 
> example this:
> {noformat}
> .setHeader("Content-Type", constant("application/json;odata=verbose"))
> {noformat}
> the route will fail with the following exception:
> {noformat}
> java.lang.IllegalArgumentException: MIME type may not contain reserved 
> characters
>   at org.apache.http.util.Args.check(Args.java:36)
>   at org.apache.http.entity.ContentType.create(ContentType.java:206)
>   at org.apache.http.entity.ContentType.create(ContentType.java:218)
>   at 
> org.apache.camel.component.http4.HttpProducer.createRequestEntity(HttpProducer.java:511)
> {noformat}
> although this is clearly a valid content type according to the RFC: 
> https://tools.ietf.org/html/rfc2045#section-5.1
> This only affects version 2.19+, because in version 4.4.6 of the 
> httpcomponents-core library, they changed the behavior of {{create}} to check 
> the mime type for semicolons, which it previously didn't. If we, however, 
> also use a charset parameter, you will call the {{parse}} method instead:
> {noformat}
> if (contentTypeString != null) {
> if (contentTypeString.indexOf("charset") > 0) {
> contentType = ContentType.parse(contentTypeString);
> } else {
> contentType = ContentType.create(contentTypeString);
> }
> }
> {noformat}
> There can be all kind of different parameters, though. Instead of checking 
> for charset, it should rather check for the existence of a semicolon. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)