Changeset 5103 in josm
- Timestamp:
- 2012-03-18T18:38:34+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r5085 r5103 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.UnsupportedEncodingException; 7 import java.net.URLDecoder; 6 8 import java.text.MessageFormat; 7 9 import java.util.HashMap; … … 142 144 /** 143 145 * Parse the request parameters as key=value pairs. 144 * The result will be stored in this.args.146 * The result will be stored in {@code this.args}. 145 147 * 146 148 * Can be overridden by subclass. 147 149 */ 148 150 protected void parseArgs() { 149 HashMap<String, String> args = new HashMap<String, String>(); 150 if (this.request.indexOf('?') != -1) { 151 String query = this.request.substring(this.request.indexOf('?') + 1); 152 if (query.indexOf('#') != -1) { 153 query = query.substring(0, query.indexOf('#')); 154 } 155 String[] params = query.split("&", -1); 156 for (String param : params) { 157 int eq = param.indexOf('='); 158 if (eq != -1) { 159 args.put(param.substring(0, eq), param.substring(eq + 1)); 151 try { 152 String req = URLDecoder.decode(this.request, "UTF-8"); 153 HashMap<String, String> args = new HashMap<String, String>(); 154 if (req.indexOf('?') != -1) { 155 String query = req.substring(req.indexOf('?') + 1); 156 if (query.indexOf('#') != -1) { 157 query = query.substring(0, query.indexOf('#')); 160 158 } 161 } 162 } 163 this.args = args; 159 String[] params = query.split("&", -1); 160 for (String param : params) { 161 int eq = param.indexOf('='); 162 if (eq != -1) { 163 args.put(param.substring(0, eq), param.substring(eq + 1)); 164 } 165 } 166 } 167 this.args = args; 168 } catch (UnsupportedEncodingException ex) { 169 throw new IllegalStateException(ex); 170 } 164 171 } 165 172
Note:
See TracChangeset
for help on using the changeset viewer.