public static String hash(ServletContext sc) { String id = null; try { id = MD5.getDigestAsString(ReqRspUtil.getRootPath(sc)); } catch (IOException e) { } return id; }
private String hash(Resource[] resources) { Arrays.sort(resources); StringBuilder sb = new StringBuilder(); for (int i = 0; i < resources.length; i++) { sb.append(ResourceUtil.getCanonicalPathEL(resources[i])); sb.append(';'); } return MD5.getDigestAsString(sb.toString(), null); }
public static String createMD5(ASMProperty[] props) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < props.length; i++) { sb.append("name:" + props[i].getName() + ";"); if (props[i] instanceof Property) { sb.append("type:" + ((Property) props[i]).getType() + ";"); } else { try { sb.append("type:" + props[i].getASMType() + ";"); } catch (PageException e) { } } } try { return MD5.getDigestAsString(sb.toString()); } catch (IOException e) { return ""; } }