hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nitya vyas" <nitya.v...@gmail.com>
Subject Re: How to set proxy information in httpClient object from browser
Date Wed, 19 Sep 2007 18:09:54 GMT
i m using 2.0 but the code is same.. in 3.1 also i will have isSecure() and
isProxied() true.... because i want https and proxy server both... So that
means that DefaultProtocolSocketFactory will get initialized and not the
other one.. thAt is protocolInUse.getsocketFactory() which will be
MySocketFactory() in my case as i m registering the protocol by it....

So it wont be called and my impl of createSocket will be useless... :(  (or
i have to change the HTTPConnection class ..)

On 9/19/07, Roland Weber <ossfwot@dubioso.net> wrote:
>
> nitya vyas wrote:
> > The problem I find now is that this createSocket method does not get
> called
> > from the HTTPConnection class... the reason being this line of
> code.....(i
> > dont wanna change the HTTPConnection if theres another way.. )
> >
> > final ProtocolSocketFactory socketFactory = (isSecure() && isProxied()?
> new
> > DefaultProtocolSocketFactory() : protocolInUse.getSocketFactory());
> >
>
> What version of HttpClient are you using?
> This is what I find in the current code (3.1 final):
>
>         if (isSecure() && isProxied()) {
>             Protocol defaultprotocol = Protocol.getProtocol("http");
>             socketFactory = defaultprotocol.getSocketFactory();
>         } else {
>             socketFactory = this.protocolInUse.getSocketFactory();
>         }
>
> So you can simply register your own protocol "http"
> that calls an instance of your socket factory.
>
> cheers,
>   Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message