Title / Description
Code HttpGet get = new HttpGet(path); String date = DateUtils.formatDate(new Date()); // create signature: method + content md5 + content-type + date + uri StringBuilder signature = new StringBuilder(); signature.append(get.getMethod()).append("\n") .append("\n") .append("\n") .append(date).append("\n") .append(get.getURI().getPath()); get.addHeader("Date", date); get.addHeader("Authorization", username + ":" + calculateHMAC(password, signature.toString())); // send request HttpClient client = new DefaultHttpClient(); HttpResponse response = client.execute(get); System.out.println(response.getStatusLine().getStatusCode());
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code