commit | author | age
|
a18bfa
|
1 |
package com.changhong.epc.form.tool; |
Z |
2 |
|
|
3 |
|
|
4 |
import com.changhong.epc.constter.base.BaseConst; |
|
5 |
import org.apache.commons.logging.Log; |
|
6 |
import org.apache.commons.logging.LogFactory; |
|
7 |
|
|
8 |
import java.io.UnsupportedEncodingException; |
|
9 |
import java.net.URLDecoder; |
|
10 |
import java.net.URLEncoder; |
|
11 |
|
|
12 |
|
|
13 |
public class URLTool { |
|
14 |
|
|
15 |
private URLTool (){ |
|
16 |
|
|
17 |
} |
|
18 |
|
|
19 |
private static final Log log = LogFactory.getLog(URLTool.class); |
|
20 |
|
|
21 |
/** |
|
22 |
* url编码 |
|
23 |
* @Title: encoder |
|
24 |
* @param @param url |
|
25 |
* @param @return 设定文件 |
|
26 |
* @return String 返回类型 |
|
27 |
* @throws |
|
28 |
*/ |
|
29 |
public static String encoder(String url){ |
|
30 |
try { |
|
31 |
return URLEncoder.encode(url, BaseConst.PROJECT_CHARSET); |
|
32 |
} catch (UnsupportedEncodingException e) { |
|
33 |
log.error(e.getMessage(), e); |
|
34 |
return ""; |
|
35 |
} |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* url解码 |
|
40 |
* @Title: decoder |
|
41 |
* @param @param url |
|
42 |
* @param @return 设定文件 |
|
43 |
* @return String 返回类型 |
|
44 |
* @throws |
|
45 |
*/ |
|
46 |
public static String decoder(String url){ |
|
47 |
try { |
|
48 |
return URLDecoder.decode(url, BaseConst.PROJECT_CHARSET); |
|
49 |
} catch (UnsupportedEncodingException e) { |
|
50 |
log.error(e.getMessage(), e); |
|
51 |
return ""; |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
|