1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package net.fckeditor;
23
24 import java.io.UnsupportedEncodingException;
25 import java.net.URLEncoder;
26 import java.util.HashMap;
27 import java.util.Map;
28
29 import net.fckeditor.tool.Utils;
30
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
33
34
35
36
37
38
39
40
41 public class FCKeditorConfig extends HashMap<String, String> {
42
43 private static final long serialVersionUID = -4831190504944866644L;
44 private final Logger logger = LoggerFactory.getLogger(FCKeditorConfig.class);
45
46
47
48
49 public FCKeditorConfig( ) {
50 super();
51 }
52
53
54
55
56
57
58
59 public String getUrlParams() {
60 StringBuffer osParams = new StringBuffer();
61 try {
62 for (Map.Entry<String, String> entry : this.entrySet()) {
63 if (Utils.isNotEmpty(entry.getValue())) {
64 osParams.append("&");
65 osParams.append(URLEncoder.encode(entry.getKey(),"UTF-8"));
66 osParams.append("=");
67 osParams.append(URLEncoder.encode(entry.getValue(),"UTF-8"));
68 }
69 }
70
71 } catch (UnsupportedEncodingException e) {
72 logger.error("Configuration parameters could not be encoded", e);
73 }
74
75 if (osParams.length() > 0)
76 osParams.deleteCharAt(0);
77 return osParams.toString();
78 }
79 }