|
Re: downloading binaries with helma.Http: msg#00010java.helma.general
2006/10/18, Stefan Rinner <rist@xxxxxxx>: > I need to download some files and store them as byte-array in my DB > but helma.Http.getUrl returns the downloaded file as a String and > converting this again to a byte[] leads to fucked up binaries on > Windows - is there any method/option in helma.Http to download a file > and retrieve the untouched byte[]? I'm currently investigating in ways to fix this. It's going to be difficult to solve the problem _and_ remain backwards compatible. Here are some possible scenarios: 1) automatic binary/text mode depending on response content type. would be backwards compatible, but intransparent and hard to do (just think about the xhtml/xml content-type discussions with text/html vs. application/xhtml+xml etc.) so I rule this one out. 2) add a switch to the Http class that lets people choose if they want their content raw or stringified. Default could be stringified, so that would preserve backwards compatibility. What I don't know is how that switch method/property would be called. 3) provide two different properties in the result object, one for binary and one for stringified content. The problem here is that we always have to stringify the result, which in the case of larger binary contents would be really really wasteful. So I also rule this one out. 4) make content always raw binary, and add a method to the result set that converts it to a string on demand. All things considered, I think I would rank solution 2) slightly before solution 4). What I haven't come up with yet is a good naming idea. Proposals anybody? hannes
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Helma 1.5.3 released, Hannes Wallnoefer |
|---|---|
| Next by Date: | Re: downloading binaries with helma.Http, Hannes Wallnoefer |
| Previous by Thread: | Helma 1.5.3 released, Hannes Wallnoefer |
| Next by Thread: | Re: downloading binaries with helma.Http, Hannes Wallnoefer |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |