Changeset 22472 in osm for applications/editors/josm/plugins/remotecontrol/src
- Timestamp:
- 2010-07-28T22:23:53+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java
r21433 r22472 43 43 public class RequestProcessor extends Thread 44 44 { 45 /** 46 * RemoteControl protocol version. 47 * Change minor number for compatible interface extensions. Change major number in case of incompatible changes. 48 */ 49 public static final String PROTOCOLVERSION = "{\"protocolversion\": {\"major\": 1, \"minor\": 0}, \"application\": \"JOSM RemoteControl\"}"; 50 51 45 52 /** The socket this processor listens on */ 46 53 private Socket request; … … 80 87 try 81 88 { 89 String content = "OK\r\n"; 90 String contentType = "text/plain"; 91 82 92 OutputStream raw = new BufferedOutputStream( request.getOutputStream()); 83 93 out = new OutputStreamWriter(raw); … … 278 288 } 279 289 // TODO: select/zoom to downloaded 280 } 281 sendHeader(out, "200 OK", "text/plain", false); 282 out.write("Content-length: 4\r\n"); 290 } else if (command.equals("/version")) { 291 content = RequestProcessor.PROTOCOLVERSION; 292 contentType = "application/json"; 293 if (args.containsKey("jsonp")) { 294 content = args.get("jsonp")+ " && " + args.get("jsonp") + "(" + content + ")"; 295 } 296 } 297 sendHeader(out, "200 OK", contentType, false); 298 out.write("Content-length: "+content.length()+"\r\n"); 283 299 out.write("\r\n"); 284 out.write( "OK\r\n");300 out.write(content); 285 301 out.flush(); 286 302 } … … 409 425 out.write("Server: JOSM RemoteControl\r\n"); 410 426 out.write("Content-type: " + contentType + "\r\n"); 427 out.write("Access-Control-Allow-Origin: *\r\n"); 411 428 if (endHeaders) 412 429 out.write("\r\n");
Note:
See TracChangeset
for help on using the changeset viewer.