Barrie Selack wrote:
>
> To authenticate against a digest-authentication web service, I’ve
> found the only way is using HTTPClient 3.
>
> 1) Is there a way to tell Metro to use HTTPClient as the HTTP
> transport instead of the default?
>
It is possible since transport is pluggable. But we need to write some
code using HTTPClient.
>
> 2) Or is there a way to have the default do digest-authentication
>
Just use default JDK mechanism. So something like the following should
work for digest authentication.
http://java.sun.com/javase/6/docs/technotes/guides/net/http-auth.html
http://java.sun.com/javase/6/docs/technotes/guides/net/properties.html
[code]
public class RunHttp {
static class MyAuthenticator extends Authenticator {
static final String kuser = "username"; // your account name
static final String kpass = "password"; // your password for the account
public PasswordAuthentication getPasswordAuthentication() {
System.err.println("Feeding username and password for " + getRequestingScheme());
return (new PasswordAuthentication(kuser, kpass.toCharArray()));
}
}
public static void main(String[] args) throws Exception {
Authenticator.setDefault(new MyAuthenticator());
...
Hello proxy = new HelloService.getHelloPort();
proxy.echo();
[/code]
Jitu
>
> Thanks,
>
> Barrie
>
>
> ------------------------------------------------------------------------
> Disclaimer: This e-mail message is intended only for the personal use of
> the recipient(s) named above. If you are not an intended recipient, you
> may not review, copy or distribute this message. If you have received this
> communication in error, please notify us immediately by e-mail and delete
> the original message.
>
> This e-mail expresses views only of the sender, which are not to be
> attributed to Rite Aid Corporation and may not be copied or distributed
> without this statement.