Package railo.commons.io.res

Examples of railo.commons.io.res.Resource


    }
    // copy From
    else {
      byte[] barr;
      try{
        Resource res = Caster.toResource(pageContext, copyFrom, true);
        barr=IOUtil.toBytes(res);
      }
      catch(ExpressionException ee) {
        barr=Caster.toBinary(copyFrom);
      }
View Full Code Here


    if(source instanceof Resource){
      return new PDFDocument((Resource) source,password);
    }
    if(source instanceof String){
      if(directory!=null) {
        Resource res = directory.getRealResource((String)source);
        if(!res.isFile()){
          Resource res2 = ResourceUtil.toResourceNotExisting(pageContext, (String)source);
          if(res2.isFile())
            res=res2;
          else
            throw new ExpressionException("file or directory "+res+" not exist");
        }
        return new PDFDocument(res,password)
View Full Code Here

        if(type==-1) {
            if(query!=null) {
                type=SearchIndex.TYPE_CUSTOM;
            }
            else {
              Resource file=null;
                try {
                    file=ResourceUtil.toResourceExisting(pageContext,key);
                    pageContext.getConfig().getSecurityManager().checkFileLocation(file);
                }
                catch (ExpressionException e) {}

               
                if(file!=null && file.exists() && file.isFile()) type=SearchIndex.TYPE_FILE;
                else if(file!=null && file.exists() && file.isDirectory()) type=SearchIndex.TYPE_PATH;
                else {
                    try {
                        new URL(key);
                        type=SearchIndex.TYPE_URL;
                    } catch (MalformedURLException e) {}
View Full Code Here

    private FTPClient actionPutFile() throws IOException, PageException  {
        required("remotefile",remotefile);
        required("localfile",localfile);
       
    FTPClient client = getClient();
    Resource local=ResourceUtil.toResourceExisting(pageContext ,localfile);//new File(localfile);
    //  if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already exist, if you want to overwrite, set attribute failIfExists to false");
    InputStream is=null;
   
        try {
          is=IOUtil.toBufferedInputStream(local.getInputStream());
          client.setFileType(getType(local));
            client.storeFile(remotefile,is);
        }
        finally {
          IOUtil.closeEL(is);
View Full Code Here

        required("remotefile",remotefile);
        required("localfile",localfile);
   
       
    FTPClient client = getClient();
    Resource local=ResourceUtil.toResourceExistingParent(pageContext ,localfile);//new File(localfile);
        pageContext.getConfig().getSecurityManager().checkFileLocation(local);
    if(failifexists && local.exists()) throw new ApplicationException("File ["+local+"] already exist, if you want to overwrite, set attribute failIfExists to false");
    OutputStream fos=null;
        client.setFileType(getType(local));
        try {
          fos=IOUtil.toBufferedOutputStream(local.getOutputStream());
            client.retrieveFile(remotefile,fos);
        }
        finally {
          IOUtil.closeEL(fos);
        }
View Full Code Here

   
    if(strNewdirectory==null)
      throw new ApplicationException("the attribute [newDirectory] is not defined");
   
    // real to source
    Resource newdirectory=toDestination(pc,strNewdirectory,directory);
   
      securityManager.checkFileLocation(pc.getConfig(),newdirectory,serverPassword);
    if(newdirectory.exists())
      throw new ApplicationException("new directory ["+newdirectory.toString()+"] already exists");
    if(createPath) {
      newdirectory.getParentResource().mkdirs();
     
    }
    try {
      directory.moveTo(newdirectory);
    }
View Full Code Here

   
    if(StringUtil.isEmpty(strDestination))
      throw new ApplicationException("attribute destination is not defined");
   
    // real to source
    Resource newdirectory=toDestination(pc,strDestination,directory);
   
    if ( nameconflict == NAMECONFLICT_ERROR && newdirectory.exists() )
      throw new ApplicationException("new directory ["+newdirectory.toString()+"] already exist");
   
      securityManager.checkFileLocation(pc.getConfig(),newdirectory,serverPassword);

    try {
      // has already a filter
      if(filter!=null) {
        if(recurse) filter=new OrResourceFilter(new ResourceFilter[]{
            filter,DirectoryResourceFilter.FILTER
        });
      }
      else {
        if(!recurse)filter=new NotResourceFilter(DirectoryResourceFilter.FILTER);
      }
      if(!createPath) {
        Resource p = newdirectory.getParentResource();
        if(p!=null && !p.exists())
          throw new ApplicationException("parent directory for ["+newdirectory+"] doesn't exist");
      }
      ResourceUtil.copyRecursive(directory, newdirectory,filter);
    }
    catch(Throwable t) {
View Full Code Here

  }

 
  private static Resource toDestination(PageContext pageContext,String path, Resource source) {
    if(source!=null && path.indexOf(File.separatorChar)==-1 && path.indexOf('/')==-1 && path.indexOf('\\')==-1) {
      Resource p = source.getParentResource();
      if(p!=null)return p.getRealResource(path);
    }
    return ResourceUtil.toResourceNotExisting(pageContext ,path);
  }
View Full Code Here

    StackTraceElement[] traces = pe.getStackTrace();
    PageContextImpl pc = (PageContextImpl) ThreadLocalPageContext.get();
    String template="";
    StackTraceElement trace=null;
    List list=new ArrayList();
    Resource res;
    PageSource ps;
    FDStackFrameImpl frame;
   
   
    for(int i=traces.length-1;i>=0;i--) {
View Full Code Here

   
    StackTraceElement[] traces = pc.getThread().getStackTrace();
    String template="";
    StackTraceElement trace=null;
    ArrayList list=new ArrayList();
    Resource res;
    PageSource ps;
    int index=stack.size();
    for(int i=traces.length-1;i>=0;i--) {
      trace=traces[i];
      ps=null;
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.