You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Ole Matzura <ol...@eviware.com> on 2006/12/18 22:07:04 UTC

access underlying socket in httpconnection?

Hi!

Is there someway to access the underlying socket used by an 
HttpConnection when reading a response in the 
HttpMethodBase#readResponse method?

thanks for any reply!

regards,

/Ole
eviware.com


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: access underlying socket in httpconnection?

Posted by Ole Matzura <ol...@eviware.com>.
Hi Roland,

thanks for your reply.. I just changed the method to be public and added 
a getSocket() delegate to the HttpConnectionAdapter class in 
MultiThreadedHttpConnectionManager..

works swell :-)

kind regards,

/Ole
eviware.com

Roland Weber skrev:
> Hi Ole,
>
>   
>> thanks, but this method seems to be protected (in HttpClient 3.0.1) and 
>> I cant find any easy way to subclass it together with 
>> MultiThreadedHttpConnectionManager.. any ideas?
>>     
>
> Ah, of course. It would have been too easy :-(
>
> The quick and dirty way is to put a new base class into the
> o.a.c.httpclient package which provides a getSocket() method.
> The new base class has access to the protected method of
> the connection. It doesn't even have to be a base class, a
> static utility method will do as well.
> I might have another look at the source this evening to see
> whether I can come up with a better idea.
>
> cheers,
>   Roland
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: access underlying socket in httpconnection?

Posted by Roland Weber <RO...@de.ibm.com>.
Hi Ole,

> thanks, but this method seems to be protected (in HttpClient 3.0.1) and 
> I cant find any easy way to subclass it together with 
> MultiThreadedHttpConnectionManager.. any ideas?

Ah, of course. It would have been too easy :-(

The quick and dirty way is to put a new base class into the
o.a.c.httpclient package which provides a getSocket() method.
The new base class has access to the protected method of
the connection. It doesn't even have to be a base class, a
static utility method will do as well.
I might have another look at the source this evening to see
whether I can come up with a better idea.

cheers,
  Roland


Re: access underlying socket in httpconnection?

Posted by Ole Matzura <ol...@eviware.com>.
Hi Roland,

thanks, but this method seems to be protected (in HttpClient 3.0.1) and 
I cant find any easy way to subclass it together with 
MultiThreadedHttpConnectionManager.. any ideas?

regards!

/Ole

Roland Weber skrev:
> Hello Ole,
>
>   
>> Is there someway to access the underlying socket used by an
>> HttpConnection when reading a response in the
>> HttpMethodBase#readResponse method?
>>     
>
> HttpMethod.readResponse is given an HttpConnection as parameter.
> HttpConnection has a getSocket method that should do the trick.
>
> cheers,
>   Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: access underlying socket in httpconnection?

Posted by Roland Weber <ht...@dubioso.net>.
Hello Ole,

> Is there someway to access the underlying socket used by an
> HttpConnection when reading a response in the
> HttpMethodBase#readResponse method?

HttpMethod.readResponse is given an HttpConnection as parameter.
HttpConnection has a getSocket method that should do the trick.

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org