Oleg, thanks a lot!!! It works fine. 

On Mon, 8 Aug 2005, Oleg Kalnichevski wrote:

> Andrew,
> 
> A custom HostConfiguration should also do the trick
> 
> HttpClient httpagent = new HttpClient();
> HostConfiguration hostconf = new HostConfiguration();
> hostconf.setHost("www.yahoo.com");
> hostconf.setLocalAddress(InetAddress.getByAddress(new byte[] {127, 0, 0, 1}));
> HttpMethod method = new GetMethod("/");
> try {
>     httpagent.executeMethod(hostconf, method);
>     if (method.getStatusCode() == HttpStatus.SC_OK) {
>         System.out.println(method.getResponseBodyAsString());
>     } else {
>         System.out.println("Unexpected failure: "
>                 + method.getStatusLine().toString());
>     }
> } finally {
>     method.releaseConnection();
> }
> 
> Hope this helps
> 
> Oleg



-- 
       ,,,,
       /'^'\
      ( o o )
--oOOO--(_)--OOOo------------------------------------------------
|                  Andrew A. Sabitov
|                  Email: [EMAIL PROTECTED]
|                  WWW:   fir.catalysis.nsk.su/~sabitov
| .oooO   Еж птица гордая - пока не пнешь, не полетит!
| (   )   Oooo.
---\ (----(   )-------------------------------------------------
    \_)    ) /
          (_/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to