Github user aledsage commented on the issue:

    https://github.com/apache/brooklyn-server/pull/551
  
    @neykov agreed - I stayed well clear of `URLEncoder` originally for that 
reason, and tried to use guava's 
https://google.github.io/guava/releases/18.0/api/docs/com/google/common/net/UrlEscapers.html.
 However, it turns out that fragment and path escaping weren't good enough for 
the use-case in BROOKLYN-421 (e.g. encoding username:password within a url for 
basic auth). I eventually gave in when I saw that we already called 
`URLEncoder` in our `Urls` utility class.
    
    The https://github.com/mikaelhg/urlbuilder library looks interesting and 
promising. Not sure how well it would handle the username:password use-case 
though, particularly given these bits are being passed in the DSL and 
constructed into a string using `$brooklyn:formatString`. Also, even if we did 
know which part was which, how does 
https://github.com/mikaelhg/urlbuilder/blob/master/src/main/java/io/mikael/urlbuilder/UrlBuilder.java#L314-L319
 know if it's got a username with a colon in or a username:password, given it 
takes a single string?! I guess it just assumes that colon doesn't need to be 
escaped (see 
https://github.com/mikaelhg/urlbuilder/blob/master/src/main/java/io/mikael/urlbuilder/util/Encoder.java#L111).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to