From 4a43d17f053e5af6f135c4a7f9b2b29b5b710eca Mon Sep 17 00:00:00 2001 From: civitarese Date: Wed, 6 May 2020 19:37:34 +0200 Subject: [PATCH] Small refactoring --- beans/Users.java | 7 +++++-- services/HelloWorld.java | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/beans/Users.java b/beans/Users.java index a2b047d..0458bc2 100644 --- a/beans/Users.java +++ b/beans/Users.java @@ -17,9 +17,10 @@ public class Users { @XmlElement(name="users") private List userslist; + private static Users instance; - public Users() { + private Users() { userslist = new ArrayList(); } @@ -31,10 +32,12 @@ public class Users { } public synchronized List getUserslist() { + return new ArrayList<>(userslist); + } - public void setUserslist(List userslist) { + public synchronized void setUserslist(List userslist) { this.userslist = userslist; } diff --git a/services/HelloWorld.java b/services/HelloWorld.java index da63432..bb00851 100644 --- a/services/HelloWorld.java +++ b/services/HelloWorld.java @@ -28,13 +28,16 @@ public class HelloWorld { @GET @Produces("application/json") public String helloWorld2(){ + return "{\"message\": \"helloWorld\"}"; + } - @Path("/inner") + @Path("inner") @GET @Produces("text/plain") public String innerHello(){ + return "Inner Hello!"; } -- 2.18.1