List of usage examples for com.google.gwt.core.client.impl Md5Digest Md5Digest
public Md5Digest()
From source file:java.security.MessageDigest.java
License:Apache License
public static MessageDigest getInstance(String algorithm) throws NoSuchAlgorithmException { if ("MD5".equals(algorithm)) { return new Md5Digest(); }// w w w . j ava 2 s . c o m throw new NoSuchAlgorithmException(algorithm + " not supported"); }
From source file:org.obiba.opal.web.gwt.rest.client.RequestCredentials.java
License:Open Source License
/** * Adds credentials to allow making a request to the specified URL without using AJAX. * * @param url the URL to request (GET, POST) *//*from w w w . ja v a 2s . c o m*/ public void provideCredentials(String url) { if (hasCredentials()) { Md5Digest digest = new Md5Digest(); digest.update(extractOpalCredentials().getBytes()); String urlToHash = url; int queryIdx = url.indexOf('?'); if (queryIdx != -1) { // remove query string urlToHash = url.substring(0, queryIdx); } String urlHash = toHexString(digest.digest(urlToHash.getBytes())); long time = new Date().getTime(); // Cookie will be valid for 1 second Cookies.setCookie(OPALRID, urlHash, new Date(time + 1000), null, "/", false); } }