Hi Sean, I understand that this is a bit surprising, but this is the way HTTP defines media types... See the specifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
Best regards, Jerome > -----Message d'origine----- > De : news [mailto:[EMAIL PROTECTED] De la part de Sean Landis > Envoyé : mercredi 17 octobre 2007 19:39 > À : [email protected] > Objet : Another MediaType surprise > > In my resource, I fully expected the following to work: > > if (entity.getMediaType().equals(MediaType.APPLICATION_JSON)) { > > but I was surprised to discover that it did not because a parameter > had been set for character encoding on the request and the > MediaType.equals() is implemented to look at those. That > makes no sense to me. > > Then I discovered the workaround: > > if > (entity.getMediaType().equals(MediaType.APPLICATION_JSON, true)) { > > The additional argument says to ignore parameters. So the two > concerns I > have are: > 1) MediaType.equals() should compare media types only and > that should be > the default. > 2) If some other capability is required, call it something > other than "equals." > > I guess another question would be, why was the encoding set > in the first place? > > Sean

