Skip to content

Commit 78d01ef

Browse files
committed
Comments
1 parent 3e04718 commit 78d01ef

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

server-spring/src/main/java/com/example/chatengine/serverspring/UserController.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class UserController {
3030
public ResponseEntity getLogin(@RequestBody HashMap<String, String> request) {
3131
HttpURLConnection con = null;
3232
try {
33-
// Create connection
33+
// Create GET request
3434
URL url = new URL("https://api.chatengine.io/users/me");
3535
con = (HttpURLConnection) url.openConnection();
3636
con.setRequestMethod("GET");
@@ -40,7 +40,7 @@ public ResponseEntity getLogin(@RequestBody HashMap<String, String> request) {
4040
con.setRequestProperty("Project-ID", CHAT_ENGINE_PROJECT_ID);
4141
con.setRequestProperty("User-Name", request.get("username"));
4242
con.setRequestProperty("User-Secret", request.get("secret"));
43-
// Generate response
43+
// Generate response String
4444
StringBuilder responseStr = new StringBuilder();
4545
try (BufferedReader br = new BufferedReader(
4646
new InputStreamReader(con.getInputStream(), "utf-8"))) {
@@ -49,7 +49,7 @@ public ResponseEntity getLogin(@RequestBody HashMap<String, String> request) {
4949
responseStr.append(responseLine.trim());
5050
}
5151
}
52-
// Jsonify and return response
52+
// Jsonify + return response
5353
Map<String, Object> response = new Gson().fromJson(
5454
responseStr.toString(), new TypeToken<HashMap<String, Object>>() {
5555
}.getType());
@@ -69,7 +69,7 @@ public ResponseEntity getLogin(@RequestBody HashMap<String, String> request) {
6969
public ResponseEntity newSignup(@RequestBody HashMap<String, String> request) {
7070
HttpURLConnection con = null;
7171
try {
72-
// Create connection
72+
// Create POST request
7373
URL url = new URL("https://api.chatengine.io/users");
7474
con = (HttpURLConnection) url.openConnection();
7575
con.setRequestMethod("POST");
@@ -90,7 +90,7 @@ public ResponseEntity newSignup(@RequestBody HashMap<String, String> request) {
9090
byte[] input = jsonInputString.getBytes("utf-8");
9191
os.write(input, 0, input.length);
9292
}
93-
// Generate response
93+
// Generate response String
9494
StringBuilder responseStr = new StringBuilder();
9595
try (BufferedReader br = new BufferedReader(
9696
new InputStreamReader(con.getInputStream(), "utf-8"))) {
@@ -99,7 +99,7 @@ public ResponseEntity newSignup(@RequestBody HashMap<String, String> request) {
9999
responseStr.append(responseLine.trim());
100100
}
101101
}
102-
// Jsonify and return response
102+
// Jsonify + return response
103103
Map<String, Object> response = new Gson().fromJson(
104104
responseStr.toString(), new TypeToken<HashMap<String, Object>>() {
105105
}.getType());

0 commit comments

Comments
 (0)