-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAdminController.java
More file actions
52 lines (45 loc) · 1.22 KB
/
AdminController.java
File metadata and controls
52 lines (45 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
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
43
44
45
46
47
48
49
50
51
52
/*
* AdminController.java
*
* Version:
* $Id$
*
* Revisions:
* $Log$
*/
package com.planets.app.controller;
import static edu.tamu.framework.enums.ApiResponseType.SUCCESS;
import java.util.HashMap;
import java.util.Map;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.RestController;
import edu.tamu.framework.aspect.annotation.Auth;
import edu.tamu.framework.aspect.annotation.Data;
import edu.tamu.framework.model.ApiResponse;
/**
* Admin Controller.
*
*/
@RestController
@MessageMapping("/admin")
public class AdminController {
/**
* Websocket endpoint to request to broadcast message.
*
* @param data
* String
* @return ApiResponse
*
* @throws Exception
*
*/
@MessageMapping("/broadcast")
@SendTo("/channel/admin/broadcast")
@Auth(role = "ROLE_ADMIN")
public ApiResponse broadcast(@Data String data) throws Exception {
Map<String, String> messageMap = new HashMap<String, String>();
messageMap.put("message", data);
return new ApiResponse(SUCCESS, messageMap);
}
}