Ejemplo n.º 1
0
 /**
  * Gets the full URL of where a blob can be downloaded.
  *
  * @since 7.2
  */
 private String getBlobUrl(Property prop) {
   DocumentModel doc = ctx.getParameter(ENTITY_TYPE);
   if (doc == null) {
     return "";
   }
   StringBuilder blobUrlBuilder = new StringBuilder(ctx.getBaseUrl());
   blobUrlBuilder
       .append("nxbigfile/")
       .append(doc.getRepositoryName())
       .append("/")
       .append(doc.getId())
       .append("/");
   blobUrlBuilder.append(prop.getSchema().getName());
   blobUrlBuilder.append(":");
   String canonicalXPath = ComplexTypeImpl.canonicalXPath(prop.getPath().substring(1));
   blobUrlBuilder.append(canonicalXPath);
   blobUrlBuilder.append("/");
   String filename = ((Blob) prop.getValue()).getFilename();
   if (filename != null) {
     blobUrlBuilder.append(URIUtils.quoteURIPathComponent(filename, true));
   }
   return blobUrlBuilder.toString();
 }