package com.changhong.epc.form.tool;
|
|
|
import com.changhong.epc.constter.base.BaseConst;
|
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.LogFactory;
|
|
import java.io.UnsupportedEncodingException;
|
import java.net.URLDecoder;
|
import java.net.URLEncoder;
|
|
|
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 "";
|
}
|
}
|
}
|