Java Tip: Basic Authentication with HttpURLConnection

    Date: 07/06/07 (Java Web)    Keywords: java

    Java provides a super simple, yet hidden from plain view, way to do basic authentication of HttpURLConnection / URLConnection. Before making a connection add the following lines of code: final String login ="..."; final String password ="..."; Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication (login, password.toCharArray()); [...]

    Source: http://blog.taragana.com/index.php/archive/java-tip-basic-authentication-with-httpurlconnection/

« I Said No To Text-Link-Ads || What is The Best Database... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home