Hi
In my class I need two connections to same host and different URL's. For connecting first time, I want to get the HttpState and HttpConnection. Later just execute the method using the same HttpConnection and HttpState.
However from API I found, to get the state I need to execute the method with HttpClient for the first time as only HttpClient is able to return the HttpState. For the later executions of GetMethod I am not able to reuse the HttpConnection used for first execution as HttpClient doesn't provide me a handle to the HttpConnection which it used for first execution.
My existing code is as follows :
*For first invocation *:
httpsclient = new HttpClient();
int statusCode = -1;
String [] response=new String[2]; httpsget = new GetMethod(uri.toString());
statusCode = httpsclient.executeMethod(httpsget);
state=httpsclient.getState();
*For Later invocations : (now I have the HttpsState but no handle to HttpConnection used :( so have to create a new HttpConnection)*
if(con==null) {
try {
con=new HttpConnection(uri.getHost(), uri.getPort(), getProtocol());
} catch (URIException e1) {
e1.printStackTrace();
} }
try {
httpsget.recycle();
httpsget.setPath(connectUrl);
httpsget.execute(state, con);
} catch (IOException e) {
e.printStackTrace();
}
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]