You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Gary D. Gregory (Created) (JIRA)" <ji...@apache.org> on 2012/04/16 17:08:20 UTC
[jira] [Created] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Add StringEntity APIs that use Charset instead of chaset name Strings
---------------------------------------------------------------------
Key: HTTPCORE-297
URL: https://issues.apache.org/jira/browse/HTTPCORE-297
Project: HttpComponents HttpCore
Issue Type: Improvement
Affects Versions: 4.1.2
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_31, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_31\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Reporter: Gary D. Gregory
Add:
- org.apache.http.entity.StringEntity.StringEntity(String, Charset)
- org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
To match the existing:
- org.apache.http.entity.StringEntity.StringEntity(String, String)
- org.apache.http.entity.StringEntity.StringEntity(String, String, String)
Same idea for:
- org.apache.http.nio.entity.NStringEntity
- org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Commented] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256014#comment-13256014 ]
Gary D. Gregory commented on HTTPCORE-297:
------------------------------------------
Looking good so far. Now that Content-Type uses Charset I can use that in some cases but the convenience of having a Charset constructor on StringEntity and others is still worth a patch which I'll provide.
I see that org.apache.http.entity.ContentType.APPLICATION_XHTML_XML is defined with Consts.ISO_8859_1 and not Consts.UTF-8.
In RFC 4627 (https://www.ietf.org/rfc/rfc4627.txt) I read: "JSON text SHALL be encoded in Unicode. The default encoding is UTF-8."
Can you comment?
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
> Attachments: httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Commented] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254752#comment-13254752 ]
Gary D. Gregory commented on HTTPCORE-297:
------------------------------------------
Looking at trunk now it seems that org.apache.http.entity.ContentType should track its charset as a Charset and not a String.
Are you interested in this direction? I'm not going to spend the time to provide a patch unless you think this is the way to go.
Thank you,
Gary
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Commented] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256019#comment-13256019 ]
Gary D. Gregory commented on HTTPCORE-297:
------------------------------------------
In the Javadocs, "mime" should be "MIME" (the acronym). This is all over the place.
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
> Attachments: httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Updated] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated HTTPCORE-297:
-------------------------------------
Attachment: StringEntities.diff
Adds 2 contructors and one mods one test.
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
> Attachments: StringEntities.diff, httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Updated] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated HTTPCORE-297:
-------------------------------------
Attachment: httpcore-297-more.diff
httpcore-297-simple.diff
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
> Attachments: httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Commented] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Oleg Kalnichevski (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255984#comment-13255984 ]
Oleg Kalnichevski commented on HTTPCORE-297:
--------------------------------------------
Hi Gary
It will be much harder to change ContentType class once 4.2 GA is released. So, I opted for the "more" patch with some extra cleanups and minor changes. I did not apply the additional constructors for the StringEntity class, though. Feel free to submit a follow-up patch, but please also add similar constructor(s) to the NStringEntity class as well.
All tests pass for me. Please review and let me know if you find anything disagreeable.
Oleg
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
> Attachments: httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Commented] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Oleg Kalnichevski (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254819#comment-13254819 ]
Oleg Kalnichevski commented on HTTPCORE-297:
--------------------------------------------
Hi Gary
The question whether or not it makes sense to be able to represent Content-Type values with charsets that are not valid in Java. If not, feel free to submit a patch that changes charset representation from String to Charset.
Do you have any other changes in mind that you would like to see happen in 4.2? I was just about to start cutting 4.2 GA release, but I'll hold it off until all your changes get incorporated.
Oleg
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Resolved] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Oleg Kalnichevski (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski resolved HTTPCORE-297.
----------------------------------------
Resolution: Fixed
Fix Version/s: 4.2-beta2
Patch checked in. All occurences of 'mime' changed to 'MIME'. Charset of the 'application/json' changed to UTF-8.
Oleg
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\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.2-beta2
>
> Attachments: StringEntities.diff, httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] [Commented] (HTTPCORE-297) Add StringEntity APIs that use
Charset instead of chaset name Strings
Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254938#comment-13254938 ]
Gary D. Gregory commented on HTTPCORE-297:
------------------------------------------
I am attaching two patches:
- a "simple" patch that adds one API to StringEntity: StringEntity(String, Charset)
- a "more" patch that pushes the Charset change down to the ContentType.
Issues with the "more" patch:
- This is an experiment that might be to late for 4.2, this causes one unit test to fail at org.apache.http.impl.io.TestSessionBuffers.testUnmappableInputAction(TestSessionBuffers.java:549)
- This changes what the ContentType getCharset will return: when you give it a non-cannonical charset name, this name will be used to get the Charset from the cache and then return the cannonical name.
> Add StringEntity APIs that use Charset instead of chaset name Strings
> ---------------------------------------------------------------------
>
> Key: HTTPCORE-297
> URL: https://issues.apache.org/jira/browse/HTTPCORE-297
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Affects Versions: 4.1.2
> 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_31, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_31\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary D. Gregory
> Attachments: httpcore-297-more.diff, httpcore-297-simple.diff
>
>
> Add:
> - org.apache.http.entity.StringEntity.StringEntity(String, Charset)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, Charset)
> To match the existing:
> - org.apache.http.entity.StringEntity.StringEntity(String, String)
> - org.apache.http.entity.StringEntity.StringEntity(String, String, String)
> Same idea for:
> - org.apache.http.nio.entity.NStringEntity
> - org.apache.http.nio.entity.StringNIOEntity
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org