Refactors Apache CXF support for REST
This commit is contained in:
parent
15ab6c6326
commit
b6e9223fed
@ -45,9 +45,11 @@ public class Course {
|
|||||||
|
|
||||||
@POST
|
@POST
|
||||||
public Response createStudent(Student student) {
|
public Response createStudent(Student student) {
|
||||||
if (students.contains(student)) {
|
for (Student element : students) {
|
||||||
|
if (element.getId() == student.getId()) {
|
||||||
return Response.status(Response.Status.CONFLICT).build();
|
return Response.status(Response.Status.CONFLICT).build();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
students.add(student);
|
students.add(student);
|
||||||
return Response.ok(student).build();
|
return Response.ok(student).build();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user