09-20-2009 09:11 PM
I've created my own http thread that I subclass whenever I need to make some API calls, download images, what have you.. As it's been evolving I've thrown in code to retry connections, deal with dropped connections, etc., but it's all been on the fly and isn't bulletproof. I am about to sit down and design an http connection pool system from scratch since sadly there is nothing resembling that in the SDK. Before I begin on this endevour I wonder if anyone has a class/classes they use for HTTP that they are proud of and would like to share. It would make me and future community members eternally grateful
09-21-2009 01:19 PM
Lol, did it sound like I was being sarcastic?
Seriously though, it would be such a boon to developers if RIM could include a robust http/sockets class. Otherwise you're asking every developer to reinvent the wheel. Some key features would be:
- A thread pool for connections that is optimized in size for the blackberry.
- Connection timeout retries. Would be nice to have it configurable per request how many times connection should be attempted.
- A timeout mechanism on input/outputstreams, again configurable per request.
- Configurable retries on connectionClosedExceptions.
09-21-2009 01:36 PM
09-22-2009 05:14 AM
Don't get me wrong, I sincerely wish you good luck with this endeavor. It will be pretty complicated to build one library that satisfies the diverse needs of various projects while still working fine considering the various limited resources on a BlackBerry (e.g., thread and conneciton limit come to mind) and the open-ended nature of various I/O errors where you cannot reliably decide whether it's a transient or a permanent issue. However, it would definitely be useful to have a library like that. Some of the stuff has already been implemented by RIM in JDE v5.0.0 (see net.rim.device.api.io.transport and net.rim.device.api.io.transport.options packages).
09-22-2009 05:30 AM - edited 09-22-2009 05:33 AM