Package railo.runtime.functions.international

Source Code of railo.runtime.functions.international.SetEncoding

package railo.runtime.functions.international;

import java.io.UnsupportedEncodingException;

import railo.runtime.PageContext;
import railo.runtime.exp.FunctionException;
import railo.runtime.exp.PageException;
import railo.runtime.ext.function.Function;
import railo.runtime.op.Caster;

/**
* Implements the CFML Function setlocale
*/
public final class SetEncoding implements Function {
     
    public static String call(PageContext pc , String scope, String charset) throws PageException {
        scope=scope.trim().toLowerCase();
        try {
            if(scope.equals("url"))(pc.urlScope()).setEncoding(pc.getApplicationContext(),charset);
            else if(scope.equals("form"))(pc.formScope()).setEncoding(pc.getApplicationContext(),charset);
            else throw new FunctionException(pc,"setEncoding",1,"scope","scope must have the one of the following values [url,form] not ["+scope+"]");
           
        } catch (UnsupportedEncodingException e) {
            throw Caster.toPageException(e);
        }
        return ""
    }
 
 
}
TOP

Related Classes of railo.runtime.functions.international.SetEncoding

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.