tags:

views:

28

answers:

2

Hi, I am accessing an svn repository via http protocol. When I put in the url into Internet Explorer, it prompts me with a dialog box for username / password and then the file loads up correctly in the browser.

What I need to do is download a ton of files from different tags from this svn repository. I was trying to automate downloading these files using HtmlUnit. Unfortunately it gives me the "401 Authorization Required ..." error. I don't know how to set the userid /password information in my HtmlUnit test.

Can a kind soul help me out with this please?

Kind Regards, Srinivas.

A: 

You can do something like:

DefaultCredentialsProvider credentialsProvider =
    (DefaultCredentialsProvider) webClient.getCredentialsProvider();
credentialsProvider.addCredentials("username", "password");
//OR
credentialsProvider.addNTLMCredentials("username", "password", null, -1, "localhost", "domain");
Ahmed Ashour
Thanks, let me try :) !
Srinivas Chintamani
A: 

Do you have to use IE or a web browser? You can install svn or TortoiseSVN and checkout the entire repository with svn, even with the http protocol.

Ryan
I do have TortoiseSVN, but I need to automate downloading a BUNCH of files from different tags. Couldn't get to automate TortoiseSVN. Thats why I needed this. Thanks for the suggestion though.
Srinivas Chintamani
You could set up multiple directories to the same repository, but a different directory for each different tag/branch needed. If you need to automate the process, it might be possible with the svn command line tools using batch or powershell.
Ryan