package cn.autoform.web.client.util; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import cn.autoform.web.client.conster.BaseConst; public class URLTool { private URLTool (){ } private static final Log log = LogFactory.getLog(URLTool.class); /** * url编码 * @Title: encoder * @param @param url * @param @return 设定文件 * @return String 返回类型 * @throws */ public static String encoder(String url){ try { return URLEncoder.encode(url, BaseConst.PROJECT_CHARSET); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); return ""; } } /** * url解码 * @Title: decoder * @param @param url * @param @return 设定文件 * @return String 返回类型 * @throws */ public static String decoder(String url){ try { return URLDecoder.decode(url, BaseConst.PROJECT_CHARSET); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); return ""; } } }