restlet/restlet-framework-java — pull request #578 by adennie (2012-04-30 15:24:23+00:00)
Title: Fix for Issue #559 - Don't ignore media type parameters in MediaType.includes()

Note: I'm new to git and github, so it's possible I've done something wrong and this pull request is not quite right. If so, let me know and I'll try to fix the issue. -Andy

Explanation of changes:

1) Added argument "boolean ignoreParameters" to MediaType.includes(), and the following logic:

if ignoreParameters is true, behave as before. Otherwise, loop through the media type parameters. Consider media type A to "include" media type B iff for each param name/value pair in A, B contains
the same name/value.

2) Added an includes(Metadata) method variation which implements the original signature, which passes through to the modified method having the new signature, supplying true for the 2nd argument and thus maintaining the original behavior for callers of that method signature.

3) Replaced the implementation of StrictConneg.scoreMediaType(MediaType mediaType) with code copied from scoreMetadata(T, List>), modified slightly to pass false for the new 2nd argument to MediaType.includes(). Thus under strict content negotiation, media type parameters will be considered in the inclusion test.