コード例 #1
0
 private String getPayload() {
   Map<String, Object> payload =
       ImmutableMap.<String, Object>of(
           "articleId", data.getArticleId(),
           "checksum", buildChecksum(),
           "collectionMeta", buildCollectionMetaToken());
   return LivefyreUtil.mapToJsonString(payload);
 }
コード例 #2
0
 /**
  * Generates a MD5-encrypted checksum based on this collection's attributes.
  *
  * @return String.
  */
 public String buildChecksum() {
   try {
     Map<String, Object> attr = data.asMap();
     byte[] digest =
         MessageDigest.getInstance("MD5").digest(LivefyreUtil.mapToJsonString(attr).getBytes());
     return printHexBinary(digest);
   } catch (NoSuchAlgorithmException e) {
     throw new LivefyreException("MD5 message digest missing. This shouldn't ever happen." + e);
   }
 }