开发者

Java simple asynchronous HTTPS client

I need to develop an application that comunicates with an https server. This application needs to do some asynchronous data transfert.

I first tried to use an HttpsURLConnection and manage the returned inputStream using a separate thread with an observable object. The observer class than would call the update method that would do some stuff. The problem with this approach is that i read here: HTTPUrlConnection error (Can't open OutputStream after reading from an inputStream) that HttpUrlConnection can't handle more than a single write/read. Tha开发者_开发技巧t post didn't help me anyway.

I read about Jetty and the Apache HttpClient, but those libraries are 2.8 and 4 megabytes, that is more than 10 times bigger than the application i have to write.

So: I'm looking for a really simple and possibly lightweight java libraries to handle an asynchronous https connection, or a way to use multiple times a connection like the HttpURLConnection (the second solution would be more appreciated as my program doesn't need to do anything more complex and i don't have to import any other libraries).

btw: i'm using the sun httpServer to make the https server if it is useful to know. If you need me to post some parts of my code to make you better understand what i'm making just ask.

Thanks


If the library size truly matters, you could consider using HttpCore. HttpCore is a set of low level HTTP transport components Apache HttpClient is based on. It's footprint is approximately 200-250 KB.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜