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

Incomplete implementation of UriBuilder #21

Closed
tareksha opened this issue Mar 29, 2016 · 3 comments
Closed

Incomplete implementation of UriBuilder #21

tareksha opened this issue Mar 29, 2016 · 3 comments
Assignees

Comments

@tareksha
Copy link
Contributor

Hi,

This issue relates to everrest's implementation of javax.ws.rs.core.UriBuilder, specifically the methods build(Object...) and build(Object..., boolean). The issue is based on the standard java specification for UriBuilder.build():
https://docs.oracle.com/javaee/7/api/javax/ws/rs/core/UriBuilder.html#build-java.lang.Object:A-boolean-

Encoding of URI template values
The specification requires both implementations of build() to fully encode the string values of template parameters so that they can be correctly re-parsed as valid URIs, e.g. UriBuilder.fromPath("/{p0}").build("aa{") should build the URI /aa%7B, substituting { with the escaped equivalent %7B. In everrest's implementation this requirement is broken and the builder substitutes the values without escaping, leading to URI syntax failures:

--> UriBuilder.fromPath("/{p1}").build("aa{");
javax.ws.rs.core.UriBuilderException: java.net.URISyntaxException: Illegal character in path at index 3: /aa{
    at org.everrest.core.impl.uri.UriBuilderImpl.build(UriBuilderImpl.java:126)
    ...
Caused by: java.net.URISyntaxException: Illegal character in path at index 3: /aa{
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3063)
    at java.net.URI.<init>(URI.java:588)
    at org.everrest.core.impl.uri.UriBuilderImpl.build(UriBuilderImpl.java:124)
    ...

Implementation of build(Object...,boolean)
The overload build(Object[],boolean) , which allows customizing whether / is escaped in the parameter values, is not implemented in everrest and returns null.

The current implementation of UriBuilder is lacking and fails on several cases if the target environment has everrest is the available JAX-RS runtime, e.g. Eclipse Che environment.

@skabashnyuk
Copy link
Contributor

@tareqhs Thanks for this note. We will take a look.

@skabashnyuk
Copy link
Contributor

skabashnyuk commented Jun 21, 2016

related to #23
eclipse-che/che#1291

@skabashnyuk
Copy link
Contributor

#23 is closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants