HttpClient, keep it persistent
I have this little application that will wait for data. When data is received, it will send it to an http server. What I want to do is not always create a new connection for new information to send, since it will always be sent to the same server.
Here's something I have thought of:
In the constructor:
mHttpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
When I will loop for new data, I will then create a new PostMethod everytime and send it:
PostMethod post = new PostMethod("http://server:1234/application/...");
mHttpClient.execute(post);
Doing this, wouldn't the PostMethod create a new connection to the server? Would there be a way to connect to the application and only give it the path and arguments afterwards?
I will always be connecting to "http://server:1234/application". When I will receive new data, I will send it to a path, like "/home/users/myself/file.txt" (the whole path would be: http://server:1234/application/home/users/myself/file.txt). Is there a way to do this so that it would not create a new connection every time but that it would just keep connected to it and just send further data?
Ex: I would like it to do something like this (I know it's wrong, but just to let you understand better) :
HttpClient client = new HttpClient("http", "server", "1234", "/application");
PostMethod post = new PostMethod("/home/users/myself/file.txt");
// here add arguments to the post
client.execute(post);
Thanks a lot,
-Jeremie

