001 package railo.runtime.functions.file; 002 003 import railo.commons.io.res.Resource; 004 import railo.runtime.PageContext; 005 import railo.runtime.exp.PageException; 006 import railo.runtime.op.Caster; 007 008 public class FileExists { 009 010 public static boolean call(PageContext pc , Object obj) throws PageException { 011 return call(pc, obj, pc.getConfig().allowRealPath()); 012 } 013 014 public static boolean call(PageContext pc , Object obj, Object oAllowRealPath) throws PageException { 015 if(oAllowRealPath==null) return call(pc, obj); 016 017 Resource res=Caster.toResource(pc,obj, false,Caster.toBooleanValue(oAllowRealPath)); 018 if(res==null) return false; 019 pc.getConfig().getSecurityManager().checkFileLocation(res); 020 return res.isFile() && res.exists(); 021 } 022 }