Adrian,

The code is below.  It is a modification of BasicAuthenticationExample.java.
I've just added the port number to the url of the GetMethod constructor.
Thanks for you help.

        HttpClient client = new HttpClient();

        // pass our credentials to HttpClient, they will only be used for
        // authenticating to servers with realm "realm", to authenticate
agains
        // an arbitrary realm change this to null.
        client.getState().setCredentials(
            null,
            new UsernamePasswordCredentials("user", "pwd")
        );

        // create a GET method that reads a file over HTTPS, we're assuming
        // that this file requires basic authentication using the realm
above.
        GetMethod get = new
GetMethod("https://www.xyz.com:2082/getsqlbackup/trace.gz";);

        // Tell the GET method to automatically handle authentication. The
        // method will use any appropriate credentials to handle basic
        // authentication requests.  Setting this value to false will cause
        // any request for authentication to return with a status of 401.
        // It will then be up to the client to handle the authentication.
        get.setDoAuthentication( true );


        // execute the GET
        int status = client.executeMethod( get );

-----Original Message-----
From: Adrian Sutton [mailto:[EMAIL PROTECTED]
Sent: Monday, March 17, 2003 9:21 PM
To: 'Commons HttpClient Project'
Subject: RE: download a file


I'd say that we should be picking the port out of the URL as well actually.
Could you provide the appropriate part of your code that passes in the URL?

In the mean time, the section you want to look at will be the
HostConfiguration class.  Pass one of those in to the execute method on
HttpClient along with the method to execute and it should be happy.

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com


-----Original Message-----
From: Drake Henderson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 18 March 2003 12:15 PM
To: Commons HttpClient Project
Subject: RE: download a file


I turned on logging.  Looks like I am going to port 80.  The url I am using
is for a different port: www.XXX.com:####  I assumed that the system would
pick the port out of the url.  Perhaps not.  I have started looking through
the api to figure out how to change ports.

Drake

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




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

Reply via email to