Skip to content
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

Support for RFC 6570 "URI Template" #1152

Open
mkarg opened this issue Jun 11, 2023 · 5 comments
Open

Support for RFC 6570 "URI Template" #1152

mkarg opened this issue Jun 11, 2023 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@mkarg
Copy link
Contributor

mkarg commented Jun 11, 2023

As proposed by @jansupol in a recent Jersey discussion the adoption of RFC 6570 "URI Template" could clarify some ambiguities in Jakarta REST's current definition of when to / when not to percent-encode template parameter values. Due to that, I hereby propose the mandatory support of RFC 6570 for Jakarta REST 4.0.

@mkarg mkarg added this to the 4.0 milestone Jun 11, 2023
@mkarg mkarg added the enhancement New feature or request label Jun 11, 2023
@mkarg
Copy link
Contributor Author

mkarg commented Jun 11, 2023

@jamezp
Copy link
Contributor

jamezp commented Jun 12, 2023

I'd be a +1 as I think this makes sense.

@jansupol
Copy link
Contributor

The RFC fits perfectly with the UriBuilder functionality and putting it to the Spec requirement seems natural to me.

@jansupol
Copy link
Contributor

UriBuilder mandates throwing IllegalArgumentException for a missing template argument which is in contradiction to the RFC which skips missing arguments:
Section 3.2.1:

A variable that is undefined (Section 2.3) has no value and is
ignored by the expansion process. If all of the variables in an
expression are undefined, then the expression's expansion is the
empty string.

@jansupol
Copy link
Contributor

Depending on which part of Uri the template is used for, the template behavior changes

For Uri, the path does not percent-encode reserved characters such as the exclamation mark "!" The RFC default template {var} should percent-encode the exclamation mark, whereas other types of a template, such as (path) {/var} or reserved expansion template {+var} do not percent-encode reserved characters (exclamation mark).

The query part, on the other hand, percent-encode the reserved characters.

Hence, the template's default behavior behaves or does not behave as the default template as described in Section 3.2.2 of the RFC and it should be clearly described by the UriBuilder javadoc in the case of the RFC adoption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants