Hi Ted,
A good example of how to use it is in AsyncHttpClientTest.java.
The code still needs a bit of work and will undergo a few changes as it
still has some functionality needed, but here is the gist of how to use it.
You need to create an implementation of the AsyncHttpClientCallback.
This is where you get notified of your response. In particular, you
will be most interested in the onResponse() call.
You then create a connection, let say you are going to yahoo...
MyCallBack callback = new MyCallBack(); // This is your Callback impl
AsyncHttpClient ahc =
new AsyncHttpClient( "http://www.yahoo.com", callback );
ahc.connect();
Once you have made the connection, you need to set up your request for
the URI. You can set request parameters, cookies, declare the method
type, etc (look at the HttpRequestMessage.java for all the cool stuff
you can do with it). But keeping it simple..:
HttpRequestMessage request = new HttpRequestMessage("/index.html");
Then you send the request:
ahc.sendRequest( request );
When you receive a response, your callback should contain a
HttpResponseMessage in the OnResponse().
Let me know if that helped.
Jeff
tedc wrote:
> Dear all :
> I had seen someone have http client program of mina, but have some can give
> a example like http server. I will try to see jgenender program, and don't
> know how to use it.
> anyone can give me some advice ........
> Thanks
> Ted Chen