eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
688 stars 351 forks source link

Support for parameterless queryParams in JerseyUriBuilder #4906

Open pakoito opened 2 years ago

pakoito commented 2 years ago

We have URIs encoded as ?key=value&flag&key2=value, where you can see that flag has no value.

In the current implementation of JerseyUriBuilder these are not allowed

https://github.com/eclipse-ee4j/jersey/blob/3716939adb721351e01b78bc54845b97bb6c836d/core-common/src/main/java/org/glassfish/jersey/uri/internal/JerseyUriBuilder.java#L534-L544

We would like for Jersey to please support this feature, as it's frequently used by JS frontends as defined by rfc3986.

winie commented 2 years ago

@pakoito Are you already working on the feature? If not, I can develop the feature. I just have to ask my manager beforehand if I can devote working hours to this issue. If yes, I can take care of that.

pakoito commented 2 years ago

I am not working on it and it's bitten us already once more, so happy that you do it :D

winie commented 2 years ago

Resteasy behaves the same way. If no values ​​are passed, the array is empty. Thus, the for loop is never executed.

https://github.com/resteasy/resteasy/blob/e70ed966f61189b3da49dc0a1a57881c32da0c65/resteasy-core/src/main/java/org/jboss/resteasy/specimpl/ResteasyUriBuilderImpl.java#L954-L976

If I understand the code correctly.

winie commented 2 years ago

Unfortunately, the behavior discussed here is not described in the specification: https://jakarta.ee/specifications/restful-ws/3.0/apidocs/jakarta/ws/rs/core/uribuilder#queryParam(java.lang.String,java.lang.Object...)