- Timestamp:
- 2012-08-15T14:39:27+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
r5085 r5444 13 13 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 14 14 15 /** 16 * Adds an imagery (WMS/TMS) layer. For instance, {@code /imagery?title=...&type=...&url=...}. 17 * @since 3715 18 */ 15 19 public class ImageryHandler extends RequestHandler { 16 20 21 /** 22 * The remote control command name used to add an imagery layer. 23 */ 17 24 public static final String command = "imagery"; 18 25 … … 56 63 String query = request.substring(request.indexOf('?') + 1); 57 64 if (query.indexOf("url=") == 0) { 58 args.put("url", decode URL(query.substring(4)));65 args.put("url", decodeParam(query.substring(4))); 59 66 } else { 60 67 int urlIdx = query.indexOf("&url="); 61 68 if (urlIdx != -1) { 62 String url = query.substring(urlIdx + 1); 63 args.put("url", decodeURL(query.substring(urlIdx + 5))); 69 args.put("url", decodeParam(query.substring(urlIdx + 5))); 64 70 query = query.substring(0, urlIdx); 65 71 } else { … … 72 78 int eq = param.indexOf('='); 73 79 if (eq != -1) { 74 args.put(param.substring(0, eq), param.substring(eq + 1));80 args.put(param.substring(0, eq), decodeParam(param.substring(eq + 1))); 75 81 } 76 82 } … … 80 86 } 81 87 82 private String decode URL(String url) {88 private String decodeParam(String param) { 83 89 try { 84 return URLDecoder.decode( url, "UTF-8");90 return URLDecoder.decode(param, "UTF-8"); 85 91 } catch (UnsupportedEncodingException e) { 86 92 throw new RuntimeException();
Note:
See TracChangeset
for help on using the changeset viewer.