users@jersey.java.net

[Jersey] Media type parse error

From: <jonathan.lister_at_vaisala.com>
Date: Mon, 6 Jun 2011 15:46:00 +0100

Code like this:

    @Produces({"text/xml; subtype=gml/3.1.1"})
    @Path("describeFeatureType")
    public Response describeFeatureType(@Context UriInfo uri) {

Leads to a deployment time error on GlassFish 3.1:

INFO: Initiating Jersey application, version 'Jersey: 1.5 01/14/2011
12:36 PM'
SEVERE: WebModule[/jx-web-services]StandardWrapper.Throwable
java.lang.IllegalArgumentException: java.text.ParseException: Expected
separator ';' instead of '/'
        at
com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(Medi
aTypes.java:285)
        at
com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(Medi
aTypes.java:270)

The unusual media type is an OGC requirement for WebFeatureService; the
CITE test assertion is:
Assertion: The MIME returned for a DescribeFeatureType request where the
output format requested is &quot;text/xml; subtype=gml/3.1.1&quot; is
&quot;text/xml; subtype=gml/3.1.1&quot;.

Is it possible to set the media type as required here? I have also tried
setting the header in HttpServletResponse, but jersey seems to override
it.