Skip to content

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

Closed
wants to merge 7 commits into from

Conversation

adennie
Copy link

@adennie adennie commented May 18, 2012

  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.

  1. 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.

  2. 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.

…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.
@ghost ghost assigned thboileau Jul 18, 2012
@adennie
Copy link
Author

adennie commented Aug 14, 2012

Hi guys, any chance of getting this into the next RC?
-Andy

@jlouvel
Copy link
Collaborator

jlouvel commented Aug 16, 2012

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,
Jerome

@adennie
Copy link
Author

adennie commented Aug 16, 2012

Hi Jerome,

Yes, I'll work on adding relevant JUnit test cases shortly. Note that
this adds a method to MediaType, but doesn't change the existing method
signatures or their behaviors (my description in the pull request may
have been confusing in that regard).

-Andy

-Andy

Jerome Louvel wrote:

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,
Jerome


Reply to this email directly or view it on GitHub
#591 (comment).

@jlouvel
Copy link
Collaborator

jlouvel commented Aug 16, 2012

Hi Andy,

That sounds good ! We can then consider including it in 2.1 RC6.

Thanks,
Jerome

@jlouvel
Copy link
Collaborator

jlouvel commented Aug 18, 2012

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.

Jerome Louvel and others added 6 commits September 4, 2012 11:52
…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.
@adennie
Copy link
Author

adennie commented Sep 6, 2012

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.

@adennie adennie closed this Sep 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants