Hello,
I'm trying to upgrade XWiki REST sub-system from Restlet 1.1.10 to 2.0.8.
Everything has been pretty smooth, except one particular case which I can't
seem to get working with the 2.0 branch.
Here it goes : we have a resource that takes GET calls with a representation.
For example :
@GET
public Response doGetSomething(@PathParam("someParam") String someParam,
MyRepresentation representation)
The need for this reprensentation as "parameter" is to allow dynamic filtering
and also for the client to express which fields he wants back in the response.
We have a reader for this reprensentation, that consumes x-www-form-urlencoded.
Now the problem :) While this was working fine with Restlet 1.1 ; it appears
with the 2.0 branch that doing such GET will never lead to a method that takes
a representation (and thus requires a reader). I've tried to follow the code as
much as I could in debug mode, and what I've found out is that with a GET
request, the media type associated with the request is null in
EntityGetter#getValue. Consequence is that when calling #getBestReader on the
MessageBodyReaderSet, none is found since the one that accepts form-urlencoded
says it's not compatible with null. Finally the server respond to the GET
request with 415 Unsupported Media Type.
I've tried going deeper and check how the media type is determined, and found
myself in ServerCall#getRequestEntity where a condition to have an entity being
loaded is to have a positive content length, which of course is not the case
with a simple GET. So it ends up with an EmptyRepresentation, and then the null
media type.
Does it make sense ? Are we trying to do something that is not supported/not
supposed to work, or is this a regression from 1.1 ?
Thanks in advance.
If you need me to test things on our setup I am available to do so.
FYI incriminated classes are at http://tinyurl.com/5r4hoh3 and
http://tinyurl.com/6k7gwks
Jerome
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2773316