Skip to content

Content negotiation issue in 2.0.12 when multiple Accept headers #569

Closed
@vmassol

Description

@vmassol

Hi,

We have upgraded to 2.0.12 (but the issue could also been there before) and we have found a regression.

We're making a POST to

http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/Spaces?method=PUT

with the following headers (at least that's what firebug says)

Accept  text/javascript, text/html, application/xml, text/xml, */*
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Cache-Control   no-cache
Connection  keep-alive
Content-Length  22
Content-Type    application/x-www-form-urlencoded; charset=UTF-8
Cookie  [...]
Host    localhost:8080
Pragma  no-cache
Referer http://localhost:8080/xwiki/bin/view/XWiki/HierarchyMacro
User-Agent  Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0
X-Prototype-Version 1.6.1
X-Requested-With    XMLHttpRequest

And we get a 500 server error as a response.

This very same code was working before.

We get this in the logs:

Apr 16, 2012 5:28:18 PM org.restlet.ext.jaxrs.internal.util.ExceptionHandler noMessageBodyWriter
WARNING: No message body writer found for class class org.xwiki.rest.model.jaxb.Page, genericType class org.xwiki.rest.model.jaxb.Page; response media type should be: text/javascript; accepted media types are: [[text/javascript, text/html, application/xml, text/xml, */*]]

Apparently it tried to find a messagebodywriter for "text/html"
(org.restlet.ext.jaxrs.JaxRsRestlet.determineMediaType(MediaType, ResourceMethod, Class<?>, Type) is finding text/html for some reason)

We have some other code which sends the same POST but with only a single Accept header to application/xml and that one seems to be working.

So we're wondering if the regression is caused when several Accept header values are sent.

Note also that Fabio says it makes him think of http://restlet.tigris.org/issues/show_bug.cgi?id=730 which he reported a long time ago.

Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions