All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jackpanz.spring.beetl.ToEncode Maven / Gradle / Ivy

The newest version!
package com.github.jackpanz.spring.beetl;

import com.github.jackpanz.spring.util.HTMLUtil;
import org.beetl.core.Context;
import org.beetl.core.Function;

import java.io.IOException;

/**
 * Created by bj on 2017/6/19.
 */
public class ToEncode implements Function {

    @Override
    public Object call(Object[] paras, Context ctx) {
        Object obj = paras[0];
        if( obj != null ){
            try {
                ctx.byteWriter.writeString(HTMLUtil.encodeURIComponent(obj.toString()));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return "";
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy