Quantcast

Media type parse error

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Media type parse error

jonathan.lister
Media type parse error

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(MediaTypes.java:285)
        at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.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 "text/xml; subtype=gml/3.1.1" is "text/xml; subtype=gml/3.1.1".

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.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Media type parse error

Santiago Pericas-Geertsen-2

On Jun 6, 2011, at 10:46 AM, [hidden email] wrote:

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(MediaTypes.java:285)
        at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.java:270)


 I believe you should use double quotes around gml/3.1.1 since "/" is a special char. The quotes should not be part of the value.

-- Santiago

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Media type parse error

japod
In reply to this post by jonathan.lister
Hi Jonathan,

the "subtype=gml/3.1.1" in your content type is considered a media type
parameter (see [1]), and it's value can not contain slashes.

Can you please double check, the content type value is as requested
by the specification you quoted?

~Jakub

[1]http://www.faqs.org/rfcs/rfc1521.html

On 06/06/2011 04:46 PM, [hidden email] wrote:
Media type parse error

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(MediaTypes.java:285)
        at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.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 "text/xml; subtype=gml/3.1.1" is "text/xml; subtype=gml/3.1.1".

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.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Media type parse error

jonathan.lister
Media type parse error
Thanks for the tip Jakub.
 
After reading the MIME rfc I agree with you that the forward slash is not allowed in the media type parameter.
 
However, that is certainly what the OGC WFS specification seems to mandate - and also what the reference implementation does -  one extract from the OGC specification document:
 
"Any GML document generated by a WFS implementation, in response to a query where the outputFormat is the MIME type text/xml; subtype=gml/3.1.1, must reference an appropriate GML application schema document so that the output can be validated."
 
 
My next step is to post a question about this on the OGC Forum ;-)
Jonathan

From: Jakub Podlesak [mailto:[hidden email]]
Sent: 07 June 2011 10:48
To: [hidden email]
Subject: [Jersey] Re: Media type parse error

Hi Jonathan,

the "subtype=gml/3.1.1" in your content type is considered a media type
parameter (see [1]), and it's value can not contain slashes.

Can you please double check, the content type value is as requested
by the specification you quoted?

~Jakub

[1]http://www.faqs.org/rfcs/rfc1521.html

On 06/06/2011 04:46 PM, [hidden email] wrote:

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(MediaTypes.java:285)
        at com.sun.jersey.core.header.MediaTypes.createQualitySourceMediaTypes(MediaTypes.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 "text/xml; subtype=gml/3.1.1" is "text/xml; subtype=gml/3.1.1".

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.



Loading...