Examples of VFSMediaResource


Examples of org.olat.core.util.vfs.VFSMediaResource

        VFSItem vfsItem = cssBaseContainer.resolve(relPath);
        MediaResource mr;
        if (vfsItem == null || !(vfsItem instanceof VFSLeaf))
          mr = new NotFoundMediaResource(relPath);
        else
          mr = new VFSMediaResource((VFSLeaf) vfsItem);
        return mr;
      }
    };
    this.relCssFilename = relCssFilename;
    this.registry = MapperRegistry.getInstanceFor(uSess);
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

      public MediaResource handle(String relPath,HttpServletRequest request) {
        VFSItem currentItem = rootContainer.resolve(relPath);
        if (currentItem == null || (currentItem instanceof VFSContainer)) {
          return new NotFoundMediaResource(relPath);
        }
        return new VFSMediaResource((VFSLeaf)currentItem);
      }
    };
    return map;
  }
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

   */
  public void setDownloadItem(VFSLeaf downloadItem) {
    if (downloadItem == null) {
      this.mediaResource = null;
    } else {
      this.mediaResource = new VFSMediaResource(downloadItem);
    }
    this.setDirty(true);
  }
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

          public MediaResource handle(String relPath, HttpServletRequest request) {
            VFSLeaf vfsfile = (VFSLeaf) folderComponent.getRootContainer().resolve(relPath);
            if (vfsfile == null) {
              return new NotFoundMediaResource(relPath);
            } else {
              return new VFSMediaResource(vfsfile);
            }
          }
        });
        // Trigger auto-download
        DisplayOrDownloadComponent dordc = new DisplayOrDownloadComponent("downloadcomp",baseUrl + path);
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

          mr = smr;
        } else {
          // found a new charset other than iso-8859-1 -> let it load again
          // as bytes (so we do not need to convert to string and back
          // again)
          VFSMediaResource vmr = new VFSMediaResource(vfsfile);
          vmr.setEncoding(enc);
          mr = vmr;
        }
      } else if (path.endsWith(".js")) { // a javascript library
        VFSMediaResource vmr = new VFSMediaResource(vfsfile);
        // set the encoding; could be null if this page starts with .js file
        // (not very common...).
        // if we set no header here, apache sends the default encoding
        // together with the mime-type, which is wrong.
        // so we assume the .js file has the same encoding as the html file
        // that loads the .js file
        if (g_encoding != null) vmr.setEncoding(g_encoding);
        mr = vmr;
      } else {
        // binary data: not .html, not .htm, not .js -> treated as is
        VFSMediaResource vmr = new VFSMediaResource(vfsfile);
        mr = vmr;
      }
    }
   
    ThreadLocalUserActivityLogger.log(FolderLoggingAction.BC_FILE_READ, getClass(), CoreLoggingResourceable.wrapBCFile(path));
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

          page = FileUtils.load(vfsLeaf.getInputStream(), enc);
          mr = prepareMediaResource(page, enc, isPopUp);
        }
       
      } else if (path.endsWith(FILE_SUFFIX_JS)) { // a javascript library
        VFSMediaResource vmr = new VFSMediaResource(vfsLeaf);
        // set the encoding; could be null if this page starts with .js file
        // (not very common...).
        // if we set no header here, apache sends the default encoding
        // together with the mime-type, which is wrong.
        // so we assume the .js file has the same encoding as the html file
        // that loads the .js file
        if (g_encoding != null) vmr.setEncoding(g_encoding);
        mr = vmr;
      } else {
        // binary data: not .html, not .htm, not .js -> treated as is
        VFSMediaResource vmr = new VFSMediaResource(vfsLeaf);
        mr = vmr;
      }
    }
    return mr;
  }
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

          if(row < versionedFile.getVersions().getRevisions().size()) {
            //restore current, do nothing
            VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
            resource = new VFSRevisionMediaResource(version, true);
          } else {
            resource = new VFSMediaResource((VFSLeaf)versionedFile);
            ((VFSMediaResource)resource).setDownloadable(true);
          }
          ureq.getDispatchResult().setResultingMediaResource(resource);
        } else if (CMD_RESTORE.equals(tEvent.getActionId())) {
          if(row >= versionedFile.getVersions().getRevisions().size()) {
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

          // inline rendering
          currentURI = moduleURI;
          getFileContent((VFSLeaf)sourceItem);
          fireEvent(ureq, new NewInlineUriEvent(currentURI));
        } else { // it is indeed an image or such -> serve it
          mr = new VFSMediaResource((VFSLeaf)sourceItem);
        }
      }
    }
    // else // moduleURI == null -> // after a click on some other component
    // -> do a normal inline rendering (reload)
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

        Tracing.logDebug("CPComponent Mapper relPath=" + relPath,HtmlStaticPageComponent.class);
        VFSItem currentItem = mapperRootContainer.resolve(relPath);
        if (currentItem == null || (currentItem instanceof VFSContainer)) {
          return new NotFoundMediaResource(relPath);
        }
        VFSMediaResource vmr = new VFSMediaResource((VFSLeaf)currentItem);
        String encoding = SimpleHtmlParser.extractHTMLCharset(((VFSLeaf)currentItem));
        Tracing.logDebug("CPComponent Mapper set encoding=" + encoding,HtmlStaticPageComponent.class);
        vmr.setEncoding(encoding);//
        return vmr;
      }
     
    };
    return map;
View Full Code Here

Examples of org.olat.core.util.vfs.VFSMediaResource

      public MediaResource handle(String relPath, HttpServletRequest request) {
        VFSItem vfsItem = wikiContainer.resolve(relPath);
        MediaResource mr;
        if (vfsItem == null || !(vfsItem instanceof VFSLeaf)) mr = new NotFoundMediaResource(relPath);
        else mr = new VFSMediaResource((VFSLeaf) vfsItem);
        return mr;
      }
    };
    //datahandler.setImageURI(MapperRegistry.getInstanceFor(ureq.getUserSession()).register(contentMapper)+"/"+WikiContainer.MEDIA_FOLDER_NAME+"/");
    imageBaseUri = MapperRegistry.getInstanceFor(ureq.getUserSession()).register(contentMapper)+"/"+WikiContainer.MEDIA_FOLDER_NAME+"/";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.