diff --git a/open-liberty/src/main/java/com/baeldung/openliberty/person/resource/PersonResource.java b/open-liberty/src/main/java/com/baeldung/openliberty/person/resource/PersonResource.java index 89f39adccc..0fb86860b8 100644 --- a/open-liberty/src/main/java/com/baeldung/openliberty/person/resource/PersonResource.java +++ b/open-liberty/src/main/java/com/baeldung/openliberty/person/resource/PersonResource.java @@ -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 getAllPerson() { - Person person = new Person(1, "normanlewis", "normanlewis@email.com"); - List persons = new ArrayList<>(); - persons.add(person); - return persons; + public List getAllPersons() { + return Arrays.asList(new Person(1, "normanlewis", "normanlewis@email.com")); } @POST diff --git a/open-liberty/src/main/java/com/baeldung/openliberty/servlet/AppServlet.java b/open-liberty/src/main/java/com/baeldung/openliberty/servlet/AppServlet.java index ad61604b32..d8c8d159c4 100644 --- a/open-liberty/src/main/java/com/baeldung/openliberty/servlet/AppServlet.java +++ b/open-liberty/src/main/java/com/baeldung/openliberty/servlet/AppServlet.java @@ -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 = "

Hello! Welcome to Open Liberty

"; response.getWriter().append(htmlOutput); } + @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response);