Package railo.commons.io.res

Examples of railo.commons.io.res.Resource


    public static Resource getExistingResource(ServletContext sc,String strDir, String defaultDir,Resource configDir, short type, Config config) {
        //ARP
     
      strDir=replacePlaceholder(strDir,config);
        if(strDir!=null && strDir.trim().length()>0) {
          Resource res=sc==null?null:_getExistingFile(config.getResource(ResourceUtil.merge(ReqRspUtil.getRootPath(sc),strDir)),type);
            if(res!=null) return res;
           
            res=_getExistingFile(config.getResource(strDir),type);
            if(res!=null) return res;
        }
View Full Code Here


     * @param file
     * @return is file or not
     */
    public static boolean isFile(Resource file) {
        if(file.exists()) return file.isFile();
        Resource parent=file.getParentResource();
        //try {
            return parent.mkdirs() && file.createNewFile();
        /*} catch (IOException e) {
            return false;
        }*/ 
    }
View Full Code Here

    private static LogAndSource getLogAndSource(Config config, String strLogger, int logLevel)  {
        if(strLogger==null) return new LogAndSourceImpl(LogConsole.getInstance(config,logLevel),"");
       
        // File
        strLogger=translateOldPath(strLogger);
        Resource file=ConfigWebUtil.getFile(config, config.getConfigDir(),strLogger, ResourceUtil.TYPE_FILE);
        if(file!=null && ResourceUtil.canRW(file)) {
            try {
        return new LogAndSourceImpl(new LogResource(file,logLevel,config.getResourceCharset()),strLogger);
      } catch (IOException e) {
        SystemOut.printDate(config.getErrWriter(),e.getMessage());
View Full Code Here

  /**
   * @param strSource the source to set
   * @throws PageException
   */
  public void setSource(String strSource) throws PageException {
    Resource zipSrc = getZip().getSource();
    if(zipSrc!=null)source=zipSrc.getRealResource(strSource);
    if(source==null || !source.exists())
      source=ResourceUtil.toResourceExisting(pageContext, strSource);
  }
View Full Code Here

    return charset;
  }


  private Resource getStoragDir(Config config) {
      Resource storageDir = config.getConfigDir().getRealResource("storage");
    if(!storageDir.exists())storageDir.mkdirs();
    return storageDir;
  }
View Full Code Here

    return storageDir;
  }
 
  public void storageSet(Config config,String key, Object value) throws ConverterException, IOException, SecurityException {
      checkWriteAccess();
    Resource storageDir = getStoragDir(config);
    Resource storage=storageDir.getRealResource(key+".wddx");
   
    WDDXConverter converter =new WDDXConverter(config.getTimeZone(),true,true);
    String wddx=converter.serialize(value);
    IOUtil.write(storage, wddx, "UTF-8", false);
  }
View Full Code Here

  }


  public Object storageGet(Config config, String key) throws ConverterException, IOException, SecurityException {
      checkReadAccess();
    Resource storageDir = getStoragDir(config);
    Resource storage=storageDir.getRealResource(key+".wddx");
    if(!storage.exists()) throw new IOException("there is no storage with name "+key);
    WDDXConverter converter =new WDDXConverter(config.getTimeZone(),true,true);
    return converter.deserialize(IOUtil.toString(storage,"UTF-8"), true);
  }
View Full Code Here

    element.setAttribute("custom-tag-deep-search",Caster.toString(customTagDeepSearch));
  }

  public void resetId() throws PageException {
    checkWriteAccess();
    Resource res=config.getConfigDir().getRealResource("id");
    try {
      if(res.exists())res.remove(false);
    } catch (IOException e) {
      throw Caster.toPageException(e);
    }
     
  }
View Full Code Here

  }
 
  private void updateLD(Resource dir,Resource res) throws IOException {
    if(!dir.exists())dir.createDirectory(true);
     
      Resource file = dir.getRealResource(res.getName());
      if(file.length()!=res.length()){
      ResourceUtil.copy(res, file);
    }
  }
View Full Code Here

    updateLD(config.getFldFile(),is,name,closeStream);
  }
 
  private static void updateLD(Resource dir,InputStream is,String name, boolean closeStream) throws IOException {
    if(!dir.exists())dir.createDirectory(true);
      Resource file = dir.getRealResource(name);
      IOUtil.copy(is, file.getOutputStream(), closeStream, true);
  }
View Full Code Here

TOP

Related Classes of railo.commons.io.res.Resource

Copyright © 2018 www.massapicom. 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.