[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-14 Thread neykov
Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/551 https://issues.apache.org/jira/browse/BROOKLYN-437 https://issues.apache.org/jira/browse/BROOKLYN-438 --- If your project is set up for it, you can reply to this email and have your

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-14 Thread geomacy
Github user geomacy commented on the issue: https://github.com/apache/brooklyn-server/pull/551 @aledsage, yes my comment above just meant that on reflection it's not invalid to use URI() to escape illegal characters in that way, but it still doesn't give us all we need; +1 to your

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-14 Thread aledsage
Github user aledsage commented on the issue: https://github.com/apache/brooklyn-server/pull/551 @neykov I like your idea of something like: `$brooklyn:urlBuilder("http://host/path.to.jar;).userInfo(external("artifactory.credentials")).build()`. Or perhaps (IMO) in more

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-13 Thread geomacy
Github user geomacy commented on the issue: https://github.com/apache/brooklyn-server/pull/551 Actually I take it back - having looked more carefully at the spec for that j.n.URI constructor I think the above is a perfectly valid use. --- If your project is set up for it, you can

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread geomacy
Github user geomacy commented on the issue: https://github.com/apache/brooklyn-server/pull/551 I'm not really suggesting we do this by the way, just musing; it's too creative by half for me!I still stick with my point above agreeing that it's best to expose a URL builder DSL - by

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread geomacy
Github user geomacy commented on the issue: https://github.com/apache/brooklyn-server/pull/551 I hesitate to suggest this but one "creative" use of URI could be to do the encoding along the lines of the above, e.g. ``` @Test public void testURLEncode() throws

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread geomacy
Github user geomacy commented on the issue: https://github.com/apache/brooklyn-server/pull/551 I think it only escapes illegal characters, not reserved ones, so `q1=my=my-value` won't be changed - it assumes you know what you are doing. Let's see... This passes: ```

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread neykov
Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/551 @geomacy It's not completely clear for me. If one of the query values contains a `&` how does the escaping work with the `URI` constructor? For example `q1=my=my-value`. --- If your

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread geomacy
Github user geomacy commented on the issue: https://github.com/apache/brooklyn-server/pull/551 +1 to the idea of exposing the builder, which makes it unambiguous as to how to interpret each bit. I think if you do that then you can get away without the external library and just use

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread neykov
Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/551 I guess [yes](https://github.com/mikaelhg/urlbuilder/blob/a0aeee72abd503ae22a0803e7cd625aaf846085f/src/test/java/io/mikael/urlbuilder/SimpleUrlTest.java#L30-L44) - the colon is not escaped

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-09 Thread aledsage
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

[GitHub] brooklyn-server issue #551: BROOKLYN-421: Adds DSL for $brooklyn:urlEncode(....

2017-02-07 Thread neykov
Github user neykov commented on the issue: https://github.com/apache/brooklyn-server/pull/551 `URLEncoder.encode` is used for encoding form data for submission in the request body with a `x-www-form-urlencoded` `Content-Type`. That's different from URL encoding. Here's a relevant