hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: ContentType Constants
Date Fri, 26 Aug 2011 13:39:30 GMT
On Thu, 2011-08-25 at 15:21 -0400, Bill Speirs wrote:
> I just pulled in the fluent-hc code and noticed there was a
> ContentType class:
> fluent-hc/src/main/java/org/apache/http/client/fluent/header/ContentType.java.
> This class defines a handful of constants: HTML, JPEG, PNG, GIF, TEXT,
> XML, and JSON.
> 
> There is already a ContentType class in the core code:
> httpcore/src/main/java/org/apache/http/entity/ContentType.java.
> However, this class does not define any constants.
> 
> Finally, there is a MediaType class in javax.ws.rs.core. It defines a
> number of constants as well.
> 
> All of this, I believe, causes a bit of confusion when I need to
> specify a Content Type. Which class should I be using?
> 
> I see 2 options:
> 
> 1) Scrap the ContentType class in fluent-hc, keep the one in httpcore,
> and make a note in the JavaDocs of httpcore that if you want constants
> please use javax.ws.rs.core.MediaType.
> 2) Scrap the ContentType class in fluent-hc, keep the one in httpcore,
> pull all of the types in MediaType into the ContentType class injavax.ws.rs.core
> httpcore
> 
> Thoughts?
> 
> Bill-
> 

The fluent facade API is still in a very early state of development.
Nothing is final. I think it does make sense to re-use ContentType code
from HttpCore. I am not sure we should use javax.ws.rs.core, though, as
long as we want to keep JSE 1.5 as a minimal runtime level requirement.

Do feel free to put changes you are proposing into a patch.

Cheers

Oleg



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


Mime
View raw message