On 20/12/12 14:34, jbright wrote:
Thanks for your suggestion, perhaps that won't work.

In my post I clearly mentioned that I get the mediaType as
/"application/json;charset=UTF-8"/


You can do MediaType.valueOf("application/json;charset=UTF-8") and use it

Cheers, Sergey

MediaType.APPLICATION_JSON_TYPE is = to "application/json"

so when you do like this :(

MediaType mediaType = httpHeaders.getMediaType();

if(mediaType.equals(MediaType.APPLICATION_JSON_TYPE))  returns false .....

in reality its like this

if("application/json;charset=UTF-8".equals("application/json"))

the equals method in the MediaType is like this

public boolean equals(Object obj) {
         if (obj == null)
             return false;
         if (!(obj instanceof MediaType))
             return false;
         MediaType other = (MediaType)obj;
         return (this.type.equalsIgnoreCase(other.type)
                 &&  this.subtype.equalsIgnoreCase(other.subtype)
                 *&&  this.parameters.equals(other.parameters)*);
     }

see the bold item above...



--
View this message in context: 
http://cxf.547215.n5.nabble.com/MediaType-equals-Object-obj-method-issue-tp5720558p5720571.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to