Package net.sourceforge.pebble.domain

Examples of net.sourceforge.pebble.domain.FileManager.saveFile()


  public void testViewFiles() throws Exception {
    // create some files and directories
    FileManager fileManager = new FileManager(blog, FileMetaData.BLOG_FILE);
    fileManager.createDirectory("/", "a");
    fileManager.createDirectory("/", "z");
    fileManager.saveFile("/", "y.txt", "Some content");
    fileManager.saveFile("/", "b.txt", "Some content");

    request.setParameter("path", "/");
    request.setParameter("type", FileMetaData.BLOG_FILE);
View Full Code Here


    // create some files and directories
    FileManager fileManager = new FileManager(blog, FileMetaData.BLOG_FILE);
    fileManager.createDirectory("/", "a");
    fileManager.createDirectory("/", "z");
    fileManager.saveFile("/", "y.txt", "Some content");
    fileManager.saveFile("/", "b.txt", "Some content");

    request.setParameter("path", "/");
    request.setParameter("type", FileMetaData.BLOG_FILE);

    View view = action.process(request, response);
View Full Code Here

   * Tests that files can be accessed, even when the path isn't specified.
   */
  public void testViewFilesWhenPathNotSpecified() throws Exception {
    // create some files and directories
    FileManager fileManager = new FileManager(blog, FileMetaData.BLOG_FILE);
    fileManager.saveFile("/", "a.txt", "Some content");

    request.setParameter("type", FileMetaData.BLOG_FILE);
    action.process(request, response);
    List files = (List)action.getModel().get("files");
    assertEquals(1, files.size());
View Full Code Here

    log.debug("Saving to " + name);
    try {
      byte bytes[] = (byte[])struct.get(BITS);
      long itemSize = bytes.length/1024; // number of bytes / 1024
      if (FileManager.hasEnoughSpace(blog, itemSize)) {
        FileMetaData file = manager.saveFile(name, bytes);
        ht.put(URL, file.getUrl());
      } else {
        throw new XmlRpcException(0, "You do not have enough free space - please free some space by removing unused files or asking your system administrator to increase your quota from " + PebbleContext.getInstance().getConfiguration().getFileUploadQuota() + " KB.");
      }
    } catch (IOException e) {
View Full Code Here

    String path = request.getParameter("path");
    String content = request.getParameter("fileContent");

    try {
      FileManager fileManager = new FileManager(blog, type);
      fileManager.saveFile(path, name, content);

      // if it's a theme file, also save a copy to blog.dir/theme
      if (type.equals(FileMetaData.THEME_FILE)) {
        fileManager = new FileManager(blog, FileMetaData.BLOG_DATA);
        fileManager.saveFile("/theme" + path, name, content);
View Full Code Here

      fileManager.saveFile(path, name, content);

      // if it's a theme file, also save a copy to blog.dir/theme
      if (type.equals(FileMetaData.THEME_FILE)) {
        fileManager = new FileManager(blog, FileMetaData.BLOG_DATA);
        fileManager.saveFile("/theme" + path, name, content);
      }

      blog.info("File \"" + StringUtils.transformHTML(name) + "\" saved.");
    } catch (IllegalFileAccessException e) {
      return new ForbiddenView();
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.