private String getString() {
   StringWriter writer = new StringWriter();
   writer.write("<html><head></head><body>");
   writer.write("<script type=\"text/javascript\">");
   writer.write("var serverSetting = {");
   writer.write("repoId : '$repoId$' ,");
   writer.write("docId : '$docId$' ,");
   writer.write("contextPath : '" + VirtualHostHelper.getContextPathProperty() + "'");
   writer.write("};");
   writer.write("</script>");
   writer.write("<script type=\"text/javascript\"");
   writer.write(
       "src=\""
           + VirtualHostHelper.getContextPathProperty()
           + "/org.nuxeo.ecm.platform.pictures.tiles.gwt.TilingPreview/org.nuxeo.ecm.platform.pictures.tiles.gwt.TilingPreview.nocache.js\">");
   writer.write("</script>");
   appendPreviewSettings(writer);
   writer.write("<div id=\"display\"></div>");
   writer.write("</body></html>");
   return writer.toString();
 }
Esempio n. 2
0
 public long getAnnotationsCount(DocumentModel doc) {
   DocumentViewCodecManager documentViewCodecManager =
       Framework.getLocalService(DocumentViewCodecManager.class);
   AnnotationsService annotationsService = Framework.getLocalService(AnnotationsService.class);
   DocumentView docView = new DocumentViewImpl(doc);
   FacesContext context = FacesContext.getCurrentInstance();
   HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
   String documentUrl =
       documentViewCodecManager.getUrlFromDocumentView(
           "docpath", docView, true, VirtualHostHelper.getBaseURL(request));
   try {
     return annotationsService.getAnnotationsCount(
         new URI(documentUrl), (NuxeoPrincipal) currentUser);
   } catch (URISyntaxException e) {
     throw new NuxeoException(e);
   }
 }
 public String getBaseURL(ServletRequest request) {
   return VirtualHostHelper.getBaseURL(request);
 }