plazi / treatmentBank

Repository devoted to house keeping of treatmentBank
0 stars 0 forks source link

Accept header not handled correctly #56

Closed retog closed 2 years ago

retog commented 2 years ago

With Accept-Header application/rdf+xml the server correctly returns RDF/XML. However, with the Accept-Header set to Accept: text/turtle;q=1, application/n-triples;q=.9, application/rdf+xml;q=.8, application/ld+json;q=.7, */*;q=.1 the server responds with text/html, which means that the server thinks that even after a quality markdown of 70% HTML is the best available format (RFC 7231 Sec. 5.3.2).

Even the header is set to 'text/turtle;q=1, application/n-triples;q=.9, application/rdf+xml;q=.8, application/ld+json;q=.7' the server returns HTML. This is just wrong, as text/html isn't acceptable at all according to this request.

gsautter commented 2 years ago

It would be vastly helpful to know one of the example URLs you tested this with, so I get an idea which servlet to look at ...

Sorry I cannot quote an RFC for how to write a maximally useful ticket to bolster my request.

retog commented 2 years ago

It affects any treatment, e.g. http://treatment.plazi.org/id/03ACBF18FFDF1B3AFF31FA64FC1AEA83

To test it with curl:

curl -D - 'http://treatment.plazi.org/id/03ACBF18FFDF1B3AFF31FA64FC1AEA83' -H 'Accept: text/turtle;q=1, application/n-triples;q=.9, application/rdf+xml;q=.8, application/ld+json;q=.7'
gsautter commented 2 years ago

Done, should be working now ... turns out, even though Tomcat offers an enumeration for request headers with multiple values, it does not seem to properly parse these comma separated lists ... doing that in our own code now for the Accept header.