3 ms·
This makes me realize what I've been missing in most Java request libraries. And gives me ideas for building my own. Thanks for sharing!
by Groxx 13y ago
This makes me realize what I've been missing in most Java request libraries. And gives me ideas for building my own. Thanks for sharing!
- fosk 13y agoAs the creator of unirest-java, I will be happy if you want to contribute to the project.
- Groxx 13y agoIf you have any ideas (I have little experience in building libs like this, but will definitely learn): currently I need a streaming JSON decoder (which handles base64-encoded blobs as some values, so values need to be stream-decoded too, possibly with another custom step). So far this lib (and nearly every other) seems to assume a pre-defined set of classes, and/or that you want the full response before acting on it (no streaming access). Before you ask, I don't control the response, so I can't do something more sane :) And it's on Android, so memory can be quite restrictive, and GC hurts a lot with so much allocation. I don't see an easy way to plug those requirements into this library. Superficially it seems I can modify/add something inherited from BaseRequest and add my own HttpClientHelper.requestAsync-style method to do this, but it's yet another library that doesn't quite allow this kind of thing natively. But by the time I've understood and made those changes, I might as well just do it all by hand in that particular request. This is especially true since my code has to be read and understood by others I work with, and it makes updating the Unirest library a much more error-prone event that might leave people in the lurch since they didn't write the extension. There's no real happy solution. -- Not that I really think it should easily handle my case - it looks really nice to use, and it's probably not worth it to you / most people, and my case is weird and might ruin everything to properly support. But it's a minor thing that annoys me a bit and makes me want to make my own (minor annoyances are a major motivator for my personal projects). Before I can make anything decent though I need to see a few more ways to do things, try a few crazy architectures, etc. This has helped remind me what it can look like at least, and the code looks surprisingly clean underneath. Definitely a worthwhile read :)