Scoring of entity variants

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Scoring of entity variants

Arjohn Kampman-2
Hi all,

We're running into an issues regarding the scoring of entity variants on
the client. We found out that ClientResource.handle(Method method,
Object entity, Class<T> resultClass) scores the variants for POST
entities by the accepted media type for the result entity. Why is that?

In our case the POST entity matches with a custom media type as well as
JSON. The requested result type (String[]) matches with another custom
media type and JSON as well. ClientResource chooses the JSON format over
our custom format here because that format is also one of the accepted
media types for the result. This looks like an odd choice me. I would
expect the code just to look at the scores of the variants and pick the
one with the highest score, or the first one of those if there are multiple.

Some insight in the reasoning behind this would be welcome.

Cheers,
Arjohn Kampman

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3068306
Reply | Threaded
Open this post in threaded view
|

Re: Scoring of entity variants

Thierry Boileau-4
Hello Arjohn,

I guess this is related to this issue https://github.com/restlet/restlet-framework-java/issues/807 even if the symptoms are different.
I guess that the method post(Object) behaves much more as you expect.

For me you are pointing an issue.

Best regards,
Thierry Boileau




2013/11/12 Arjohn Kampman <[hidden email]>
Hi all,

We're running into an issues regarding the scoring of entity variants on
the client. We found out that ClientResource.handle(Method method,
Object entity, Class<T> resultClass) scores the variants for POST
entities by the accepted media type for the result entity. Why is that?

In our case the POST entity matches with a custom media type as well as
JSON. The requested result type (String[]) matches with another custom
media type and JSON as well. ClientResource chooses the JSON format over
our custom format here because that format is also one of the accepted
media types for the result. This looks like an odd choice me. I would
expect the code just to look at the scores of the variants and pick the
one with the highest score, or the first one of those if there are multiple.

Some insight in the reasoning behind this would be welcome.

Cheers,
Arjohn Kampman

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3068306