review fixes

This commit is contained in:
Anshul BANSAL 2020-01-28 15:43:28 +02:00
parent cb2e6a060d
commit 4477bcd0ac
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package com.baeldung.openliberty.person.resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.enterprise.context.RequestScoped;
@ -27,11 +28,8 @@ public class PersonResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Person> getAllPerson() {
Person person = new Person(1, "normanlewis", "normanlewis@email.com");
List<Person> persons = new ArrayList<>();
persons.add(person);
return persons;
public List<Person> getAllPersons() {
return Arrays.asList(new Person(1, "normanlewis", "normanlewis@email.com"));
}
@POST

View File

@ -13,11 +13,13 @@ public class AppServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String htmlOutput = "<html><h2>Hello! Welcome to Open Liberty</h2></html>";
response.getWriter().append(htmlOutput);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);