You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Hentzen, Rudy" <ru...@etrade.com> on 2004/09/28 10:53:10 UTC

Proxy

Hi all,

 

I am behind a corporate proxy and firewall and I am not sure how I can
set this up in order to use the Http Client class to access web pages
etc.  The proxy url is and it requires a username and password:

 

http://atlpx-ha.etrade.com:8081/accelerated_pac_base.pac

Username and password required.

 

I tried to use the example for proxy access but could not get it to
work:

 

HttpClient httpclient = new HttpClient();

  httpclient.getHostConfiguration().setProxy("myproxyhost", 8080);

  httpclient.getState().setProxyCredentials("my-proxy-realm", "
myproxyhost",

  new UsernamePasswordCredentials("my-proxy-username",
"my-proxy-password"));

  GetMethod httpget = new GetMethod("https://www.verisign.com/");

  try { 

    httpclient.executeMethod(httpget);

    System.out.println(httpget.getStatusLine());

  } finally {

    httpget.releaseConnection();

  }

 

Any help will be greatly appreciated

 

Many thanks

Rudy

 

 

 

Rudy Hentzen

Software Developer

E*Trade Securities Ltd.

42nd Floor, One Canada Square

Canary Wharf

London E14 5AA

 

Tel: +44 (0) 207 516 1384

Email: Rudy.Hentzen@etrade.com <ma...@etrade.com> 

------------------------------------------------------------------------
---------------------------------------------------------------

IMPORTANT NOTICE:

This e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity named above. If
you received this e-mail in error, any review, disclosure, distribution,
or copying of this e-mail is strictly prohibited. Please immediately
notify the sender and delete the e-mail from your system. 

E*TRADE Securities Limited is a member of the London Stock Exchange and
is authorised and regulated by the Financial Services Authority. It is a
wholly owned subsidiary of E*TRADE Financial Corporation.

The notes below are an important and integral part of this message and
should also be read. Thank you for your co-operation.

1.  It is your responsibility to carry out virus or other checks as
appropriate to ensure that this message and any attachments do not
affect your systems or data. This message has been virus-scanned by us
before sending.

2.  Any views expressed in this message are those of the individual
sender, except where the message states otherwise and the sender is
authorised to state them to be the views of any entity within the
E*TRADE Group.

3.  E*TRADE do not accept responsibility for any changes made to this
message after it was originally sent.

------------------------------------------------------------------------
----------------

 


Re: Proxy

Posted by Ortwin Glück <or...@nose.ch>.
Rudy,

That URL only contains so-called PAC-Proxy code. This is JavaScript that 
can tell web browsers which proxy to use for a particular URL. It is 
probably not the same host as the actual proxy! HttpClient currently 
does not support PAC code. You will need to figure out which proxy 
applies to your application and use a static entry.

HTH

Ortwin Glück

Hentzen, Rudy wrote:

> Hi all,
> 
>  
> 
> I am behind a corporate proxy and firewall and I am not sure how I can
> set this up in order to use the Http Client class to access web pages
> etc.  The proxy url is and it requires a username and password:
> 
>  
> 
> http://atlpx-ha.etrade.com:8081/accelerated_pac_base.pac
> 
> Username and password required.
> 
>  
> 
> I tried to use the example for proxy access but could not get it to
> work:
> 
>  
> 
> HttpClient httpclient = new HttpClient();
> 
>   httpclient.getHostConfiguration().setProxy("myproxyhost", 8080);
> 
>   httpclient.getState().setProxyCredentials("my-proxy-realm", "
> myproxyhost",
> 
>   new UsernamePasswordCredentials("my-proxy-username",
> "my-proxy-password"));
> 
>   GetMethod httpget = new GetMethod("https://www.verisign.com/");
> 
>   try { 
> 
>     httpclient.executeMethod(httpget);
> 
>     System.out.println(httpget.getStatusLine());
> 
>   } finally {
> 
>     httpget.releaseConnection();
> 
>   }
> 
>  
> 
> Any help will be greatly appreciated
> 
>  
> 
> Many thanks
> 
> Rudy
> 
>  
> 
>  
> 
>  
> 
> Rudy Hentzen
> 
> Software Developer
> 
> E*Trade Securities Ltd.
> 
> 42nd Floor, One Canada Square
> 
> Canary Wharf
> 
> London E14 5AA
> 
>  
> 
> Tel: +44 (0) 207 516 1384
> 
> Email: Rudy.Hentzen@etrade.com <ma...@etrade.com> 
> 
> ------------------------------------------------------------------------
> ---------------------------------------------------------------
> 
> IMPORTANT NOTICE:
> 
> This e-mail and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity named above. If
> you received this e-mail in error, any review, disclosure, distribution,
> or copying of this e-mail is strictly prohibited. Please immediately
> notify the sender and delete the e-mail from your system. 
> 
> E*TRADE Securities Limited is a member of the London Stock Exchange and
> is authorised and regulated by the Financial Services Authority. It is a
> wholly owned subsidiary of E*TRADE Financial Corporation.
> 
> The notes below are an important and integral part of this message and
> should also be read. Thank you for your co-operation.
> 
> 1.  It is your responsibility to carry out virus or other checks as
> appropriate to ensure that this message and any attachments do not
> affect your systems or data. This message has been virus-scanned by us
> before sending.
> 
> 2.  Any views expressed in this message are those of the individual
> sender, except where the message states otherwise and the sender is
> authorised to state them to be the views of any entity within the
> E*TRADE Group.
> 
> 3.  E*TRADE do not accept responsibility for any changes made to this
> message after it was originally sent.
> 
> ------------------------------------------------------------------------
> ----------------
> 
>  
> 
> 

-- 
  _________________________________________________________________
  NOSE applied intelligence ag

  ortwin glück                      [www]      http://www.nose.ch
  software engineer
  hardturmstrasse 171               [pgp id]           0x81CF3416
  8005 zürich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12

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