Package railo.runtime.functions.system

Source Code of railo.runtime.functions.system.GetProfileString

/**
* Implements the CFML Function getprofilestring
*/
package railo.runtime.functions.system;

import java.io.IOException;

import railo.commons.io.ini.IniFile;
import railo.commons.io.res.Resource;
import railo.commons.io.res.util.ResourceUtil;
import railo.runtime.PageContext;
import railo.runtime.exp.PageException;
import railo.runtime.ext.function.Function;
import railo.runtime.op.Caster;

public final class GetProfileString implements Function {
  public static String call(PageContext pc , String fileName, String section, String key) throws PageException {
        try {
          Resource res = ResourceUtil.toResourceNotExisting(pc,fileName);
            if(!res.isFile()) return "";
             
          IniFile ini = new IniFile(res);
            String str=ini.getKeyValueEL(section, key);
            if(str==null) return "";
            return str;
        }
        catch (IOException e) {
            throw Caster.toPageException(e);
        }
  }
}
TOP

Related Classes of railo.runtime.functions.system.GetProfileString

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.