Skip to content

Commit cad3573

Browse files
committed
Update dependencies + Remove HttpServletRequest in API requests
1 parent eddecdb commit cad3573

File tree

5 files changed

+180
-46
lines changed

5 files changed

+180
-46
lines changed

backend/src/main/java/urjc/ovteaching/openvidu/OpenViduController.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.io.IOException;
44

5-
import javax.servlet.http.HttpServletRequest;
65
import javax.xml.ws.http.HTTPException;
76

87
import org.json.simple.JSONObject;
@@ -50,7 +49,7 @@ public class OpenViduController {
5049
* @return the session's id
5150
*/
5251
@PostMapping("/room/{roomName}/session")
53-
public ResponseEntity<String> createSession(@PathVariable String roomName, HttpServletRequest request) {
52+
public ResponseEntity<String> createSession(@PathVariable String roomName) {
5453
Room room = roomServ.findByName(roomName);
5554
if (room == null) {
5655
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
@@ -78,7 +77,7 @@ public ResponseEntity<String> createSession(@PathVariable String roomName, HttpS
7877
*/
7978
@SuppressWarnings("unchecked")
8079
@GetMapping("/room/{roomName}/token")
81-
public ResponseEntity<JSONObject> generateToken(@PathVariable String roomName, HttpServletRequest request) {
80+
public ResponseEntity<JSONObject> generateToken(@PathVariable String roomName) {
8281
Room room = roomServ.findByName(roomName);
8382
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
8483
if (room == null) { // No room with that name
@@ -104,7 +103,7 @@ public ResponseEntity<JSONObject> generateToken(@PathVariable String roomName, H
104103
json.put("token", token);
105104
return new ResponseEntity<>(json, HttpStatus.OK);
106105
} catch (IOException e1) {
107-
// Internal error generate
106+
// Internal error
108107
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
109108
} catch (HTTPException e2) {
110109
if (404 == e2.getStatusCode()) {
@@ -129,7 +128,7 @@ public ResponseEntity<JSONObject> generateToken(@PathVariable String roomName, H
129128
* @return HttpStatus of the operation
130129
*/
131130
@DeleteMapping("/room/{roomName}/user")
132-
public ResponseEntity<String> removeUser(@PathVariable String roomName, HttpServletRequest request) {
131+
public ResponseEntity<String> removeUser(@PathVariable String roomName) {
133132
Room room = roomServ.findByName(roomName);
134133
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
135134

@@ -163,7 +162,7 @@ public ResponseEntity<String> removeUser(@PathVariable String roomName, HttpServ
163162
* @return HttpStatus of the operation
164163
*/
165164
@PostMapping("/room/{roomName}/signal/{type}")
166-
public ResponseEntity<?> sendSignal(@PathVariable String roomName, @PathVariable String type, @RequestBody JSONObject body, HttpServletRequest request) {
165+
public ResponseEntity<?> sendSignal(@PathVariable String roomName, @PathVariable String type, @RequestBody JSONObject body) {
167166
Room room = roomServ.findByName(roomName);
168167
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
169168

backend/src/main/java/urjc/ovteaching/openvidu/RecordingController.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import java.io.IOException;
44
import java.util.List;
55

6-
import javax.servlet.http.HttpServletRequest;
7-
86
import org.springframework.beans.factory.annotation.Autowired;
97
import org.springframework.http.HttpHeaders;
108
import org.springframework.http.HttpStatus;
@@ -46,7 +44,7 @@ public class RecordingController {
4644
* @return Recording id
4745
*/
4846
@PostMapping("/room/{roomName}/recording/start")
49-
public ResponseEntity<?> startRecording(@PathVariable String roomName, HttpServletRequest request) {
47+
public ResponseEntity<?> startRecording(@PathVariable String roomName) {
5048
Room room = roomServ.findByName(roomName);
5149
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
5250

@@ -77,7 +75,7 @@ public ResponseEntity<?> startRecording(@PathVariable String roomName, HttpServl
7775
* @return HttpStatus of the operation
7876
*/
7977
@PostMapping("/room/{roomName}/recording/stop")
80-
public ResponseEntity<?> stopRecording(@PathVariable String roomName, HttpServletRequest request) {
78+
public ResponseEntity<?> stopRecording(@PathVariable String roomName) {
8179
Room room = roomServ.findByName(roomName);
8280
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
8381

@@ -108,7 +106,7 @@ public ResponseEntity<?> stopRecording(@PathVariable String roomName, HttpServle
108106
* @return boolean with the status of the recording
109107
*/
110108
@GetMapping("/room/{roomName}/recording/isBeingRecorded")
111-
public ResponseEntity<Boolean> isBeingRecorded(@PathVariable String roomName, HttpServletRequest request) {
109+
public ResponseEntity<Boolean> isBeingRecorded(@PathVariable String roomName) {
112110
Room room = roomServ.findByName(roomName);
113111
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
114112

@@ -130,7 +128,7 @@ public ResponseEntity<Boolean> isBeingRecorded(@PathVariable String roomName, Ht
130128
* @return boolean with the enabling of the recording
131129
*/
132130
@GetMapping("/isRecordingEnabled")
133-
public ResponseEntity<Boolean> isRecordingEnabled(HttpServletRequest request) {
131+
public ResponseEntity<Boolean> isRecordingEnabled() {
134132
return new ResponseEntity<>(this.openViduComponent.isRecordingEnabled(), HttpStatus.OK);
135133
}
136134

@@ -140,7 +138,7 @@ public ResponseEntity<Boolean> isRecordingEnabled(HttpServletRequest request) {
140138
* @return the list of recordings
141139
*/
142140
@GetMapping("/room/{roomName}/recordings")
143-
public ResponseEntity<List<Recording>> getRecordings(@PathVariable String roomName, HttpServletRequest request) {
141+
public ResponseEntity<List<Recording>> getRecordings(@PathVariable String roomName) {
144142
Room room = roomServ.findByName(roomName);
145143
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
146144

@@ -166,7 +164,7 @@ public ResponseEntity<List<Recording>> getRecordings(@PathVariable String roomNa
166164
* @return the video in byte array
167165
*/
168166
@GetMapping("/room/{roomName}/recording/{video}")
169-
public ResponseEntity<byte[]> getVideo(@PathVariable String roomName, @PathVariable String video, HttpServletRequest request) {
167+
public ResponseEntity<byte[]> getVideo(@PathVariable String roomName, @PathVariable String video) {
170168
Room room = roomServ.findByName(roomName);
171169
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
172170

backend/src/main/java/urjc/ovteaching/rooms/RoomController.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.util.List;
66
import java.util.Set;
77

8-
import javax.servlet.http.HttpServletRequest;
9-
108
import org.json.simple.JSONObject;
119
import org.springframework.beans.factory.annotation.Autowired;
1210
import org.springframework.http.HttpStatus;
@@ -48,7 +46,7 @@ public class RoomController {
4846
*/
4947
@PostMapping("/room/{roomName}")
5048
@JsonView(Room.NameOnly.class)
51-
public ResponseEntity<Room> createNewRoom(@PathVariable String roomName, HttpServletRequest request) {
49+
public ResponseEntity<Room> createNewRoom(@PathVariable String roomName) {
5250
if (roomServ.findByName(roomName) != null) {
5351
return new ResponseEntity<>(HttpStatus.CONFLICT);
5452
}
@@ -66,7 +64,7 @@ public ResponseEntity<Room> createNewRoom(@PathVariable String roomName, HttpSer
6664
* @return the invite code
6765
*/
6866
@GetMapping("/room/{roomName}/inviteCode/{role}")
69-
public ResponseEntity<String> getInviteCode(HttpServletRequest request, @PathVariable String roomName, @PathVariable String role) {
67+
public ResponseEntity<String> getInviteCode(@PathVariable String roomName, @PathVariable String role) {
7068
Room room = roomServ.findByName(roomName);
7169
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
7270
if (room != null) {
@@ -109,7 +107,7 @@ public ResponseEntity<String> getRoomByInviteCodeOrName(@PathVariable String cod
109107
*/
110108
@PutMapping("/room/{code}/user")
111109
@JsonView(User.WithRooms.class)
112-
public ResponseEntity<User> newUserInRoom(HttpServletRequest request, @PathVariable String code) {
110+
public ResponseEntity<User> newUserInRoom(@PathVariable String code) {
113111
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
114112
Room room = roomServ.findByInviteCode(code);
115113

@@ -153,7 +151,7 @@ public ResponseEntity<User> newUserInRoom(HttpServletRequest request, @PathVaria
153151
@SuppressWarnings("unchecked")
154152
@JsonView(User.NameOnly.class)
155153
@GetMapping("/room/{roomName}/assistants")
156-
public ResponseEntity<JSONObject> getAssistants(@PathVariable String roomName, HttpServletRequest request) {
154+
public ResponseEntity<JSONObject> getAssistants(@PathVariable String roomName) {
157155
Room room = roomServ.findByName(roomName);
158156
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
159157
if (room == null) {
@@ -203,7 +201,7 @@ public ResponseEntity<JSONObject> getAssistants(@PathVariable String roomName, H
203201
*/
204202
@SuppressWarnings("unchecked")
205203
@PostMapping("/room/{roomName}/raiseHand")
206-
public ResponseEntity<Integer> raiseHand(@PathVariable String roomName, @RequestBody JSONObject handRaisedUser, HttpServletRequest request) {
204+
public ResponseEntity<Integer> raiseHand(@PathVariable String roomName, @RequestBody JSONObject handRaisedUser) {
207205
Room room = roomServ.findByName(roomName);
208206
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
209207
if (room == null) {
@@ -229,7 +227,7 @@ public ResponseEntity<Integer> raiseHand(@PathVariable String roomName, @Request
229227
* @return the httpStatus of the operation
230228
*/
231229
@DeleteMapping("/room/{roomName}/raiseHand")
232-
public ResponseEntity<?> lowerHand(@PathVariable String roomName, @RequestBody JSONObject body, HttpServletRequest request) {
230+
public ResponseEntity<?> lowerHand(@PathVariable String roomName, @RequestBody JSONObject body) {
233231
Room room = roomServ.findByName(roomName);
234232
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
235233
if (room == null) {
@@ -253,7 +251,7 @@ public ResponseEntity<?> lowerHand(@PathVariable String roomName, @RequestBody J
253251
* @return the list of the users raising their hand
254252
*/
255253
@GetMapping("/room/{roomName}/raiseHand")
256-
public ResponseEntity<List<JSONObject>> getRaisedHands(@PathVariable String roomName, HttpServletRequest request) {
254+
public ResponseEntity<List<JSONObject>> getRaisedHands(@PathVariable String roomName) {
257255
Room room = roomServ.findByName(roomName);
258256
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
259257
if (room == null) {

backend/src/main/java/urjc/ovteaching/users/UserController.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import javax.servlet.ServletException;
44
import javax.servlet.http.HttpServletRequest;
5-
import javax.servlet.http.HttpServletResponse;
65
import javax.servlet.http.HttpSession;
76

87
import org.json.simple.JSONObject;
@@ -48,7 +47,7 @@ public ResponseEntity<String> checkUsername(@PathVariable String name) {
4847
@SuppressWarnings("unchecked")
4948
@GetMapping("/user/rooms")
5049
@JsonView(Room.NameOnly.class)
51-
public ResponseEntity<JSONObject> getRooms(HttpServletRequest request) {
50+
public ResponseEntity<JSONObject> getRooms() {
5251
User user = userServ.findByName(this.userComponent.getLoggedUser().getName());
5352
if (user == null) {
5453
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
@@ -84,7 +83,7 @@ public ResponseEntity<Boolean> logOut(HttpSession session) {
8483

8584
@RequestMapping("/register/{user}/{pass}")
8685
@JsonView(User.WithRooms.class)
87-
public ResponseEntity<User> register(@PathVariable String user, @PathVariable String pass, HttpServletRequest request, HttpServletResponse httpServletResponse) {
86+
public ResponseEntity<User> register(@PathVariable String user, @PathVariable String pass, HttpServletRequest request) {
8887
User newUser = userServ.findByName(user);
8988
if (newUser == null) {
9089
newUser = userServ.save(new User(user, pass, "ROLE_USER"));

0 commit comments

Comments
 (0)