-
Notifications
You must be signed in to change notification settings - Fork 278
fix issue #559 (strict conneg should evaluate media type parameters) #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…eters) 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<Preference<T>>), 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.
Hi guys, any chance of getting this into the next RC? |
Andy, it this requies an API change to MediaType, we need to be extra careful, or postpone this to 2.2. Could you provide us with a JUnit test case illustrating the issue and how the fix helps? If we decide to add this to 2.1 RC6, we will need to have a similar change in the 2.1 branch (this pull request is on master/2.2). Cheers, |
Hi Jerome, Yes, I'll work on adding relevant JUnit test cases shortly. Note that -Andy -Andy Jerome Louvel wrote:
|
Hi Andy, That sounds good ! We can then consider including it in 2.1 RC6. Thanks, |
Thanks for the clarification. Once we have the unit test, we'll go ahead with your change as we already have your JCA. We'll also take care of applying this change again to branch 2.1 unless you can prepare another pull request for it. |
…eters) 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<Preference<T>>), 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.
I'm having lots of git/github issues at the moment, stemming from my relative inexperience with them. While trying to add test cases to this pull request and handle the differences in the affected files between master and other branches, I seem to have dug myself into a hole I can't figure out how to escape, so I'm going to close this pull request and start over. |
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.
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.
Replaced the implementation of
StrictConneg.scoreMediaType(MediaType mediaType) with code copied from
scoreMetadata(T, List<Preference>), 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.