authentication per request

Java Authenticator on a per connection basis.

You can perform authentication on per connection basis like below,


String userpass = username + ":" + password;
String basicAuth = "Basic " + org.apache.commons.codec.binary.Base64.encodeBase64String(userpass.getBytes("UTF-8"));
connection.setRequestProperty ("Authorization", basicAuth);

Happy Coding 🙂

Advertisements