groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Clark <plotinussm...@gmail.com>
Subject Re: HTTPBuilder & URIBuilder - plus sign will not encoded
Date Sun, 20 Nov 2016 14:39:00 GMT
Plus sign is legal in URI's so they don't need to get encoded to be legal:

http://stackoverflow.com/questions/1547899/which-characters-make-a-url-invalid/1547940#1547940

This is complicated by the fact that they are url encoded when part of 
the query string, but that's not what you are doing here. It sounds to 
me like the problem is on the server or there some other part of your 
request that is incorrect.

If there is a problem inside HTTPBuilder, you are probably out of luck, 
that project has been dead for a while.

However, I have created a successor to HTTPBuilder called 
http-builder-ng that is active here:

https://github.com/dwclark/http-builder-ng

It is NOT a backwards compatible upgrade. When I was examining the 
original source code I found many threading issues, code duplication, it 
was imposible to use @TypeChecked/@CompileStatic, and found it hard to 
integrated different clients inside HTTPBuilder. The result of these 
frustrations was a ground up re-write. Bug reports/pull requests are 
encouraged.


On 11/20/2016 07:25 AM, Christian Lotz wrote:
> Hi all,
> I try to upload files via HTTPBuilder (Groovy Version: 2.4.7 JVM: 
> 1.8.0_40 Vendor: Oracle Corporation OS: Mac OS X). After a couple of 
> test I realized, that filenames containing a plus sign ("+") can't be 
> uploaded. The REST Service responds with HTTP/1.1 400 Bad Request. 
> After some more debugging I think these filenames will not get encoded 
> correctly:
> uri.path = "/rest/" + objectNamespace + "/" + objectFile.name
>
> groovyx.net.http.HTTPBuilder doRequest
> FINE: PUT http://172.16.29.10/rest/TEST/s*pace%20space.doc* - 
> Filename: space\ space.doc - OK
>
> groovyx.net.http.HTTPBuilder doRequest
> FINE: PUT http://172.16.29.10/rest/TEST/*plus+plus.doc* -Filename 
> plus+plus.doc - ERROR
>
> All other "special" characters like spaces, #, &, % or ? will 
> get encoded correctly ...
> Does anybody know how to resolve this issue?
> Thanks in advance
> Paolo


Mime
View raw message