Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9bcd1d1

Browse files
author
Davr bank
committed
Secure system
1 parent d52a8a9 commit 9bcd1d1

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
11
package com.secure.sytem.securestart.controller;
22

3+
import com.secure.sytem.securestart.entity.Student;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
import org.springframework.web.bind.annotation.PathVariable;
6+
import org.springframework.web.bind.annotation.RequestMapping;
37
import org.springframework.web.bind.annotation.RestController;
48

9+
import java.util.Arrays;
10+
import java.util.List;
11+
512
/**
613
* @project: secure-start
714
* @Date: 12.08.2022
815
* @author: H_Urunov
916
**/
1017
@RestController
18+
@RequestMapping("/api/v1/student/")
1119
public class StudentController {
1220
//
1321

22+
private static final List<Student> students = Arrays.asList(
23+
new Student(1, "James Bond"),
24+
new Student(2, "Lary Gaga"),
25+
new Student(3, "Faktor2"),
26+
new Student(4, "Anna ")
27+
);
28+
29+
@GetMapping(path = "{studentId}")
30+
public Student getStudent(@PathVariable("studentId") Integer studentId){
31+
32+
return students
33+
.stream()
34+
.filter(student -> studentId.equals(student.getStudentId()))
35+
.findFirst()
36+
.orElseThrow(() -> new IllegalStateException("Student" + studentId));
37+
}
1438
}

‎Advanced-SpringSecure/1. simple-secure/secure-start/src/main/java/com/secure/sytem/securestart/entity/Student.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
@ToString
1515
public class Student {
1616
//
17+
private Integer studentId;
1718
private String name;
18-
private String lastName;
19-
private String
2019

2120
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /