|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
public class WebSocketController {
@RequestMapping(value = "/operation/{vmc}/{cmd}")
public void remote(@PathVariable("vmc") long vmc, @PathVariable("cmd") String cmd){
RemoteOperation operation = new RemoteOperation();
operation.setVmc_no(vmc);
operation.setOperation(cmd);
String message = new Gson().toJson(operation);
System.out.println("message in json is :"+message);
WebSocketServer.send(cmd);
}
@RequestMapping(value = "/remote")
public void remote(@RequestBody Map<String, String> param){
String vmc = param.get("vmc");
String cmd = param.get("cmd");
RemoteOperation operation = new RemoteOperation();
operation.setVmc_no(Long.valueOf(vmc));
operation.setOperation(cmd);
String message = new Gson().toJson(operation);
System.out.println("message in json is :"+message);
WebSocketServer.send(cmd);
}
@RequestMapping(value = "/test")
public String test(){
System.out.print("test");
return "hello world";
}
}
|