Browse Source

Merge branch 'master' of https://github.com/cowtowncoder/FrameworkBenchmarks into cowtowncoder-master

Patrick Falls 12 years ago
parent
commit
88d3178e04

+ 8 - 6
dropwizard/src/main/java/com/example/helloworld/resources/JsonResource.java

@@ -13,16 +13,18 @@ import javax.ws.rs.core.MediaType;
 @Produces(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 public class JsonResource
 public class JsonResource
 {
 {
-  private final Map<String, String> MESSAGE = new HashMap<String, String>();
+  // Response message class (copied from 'servlet' test)
+  public final static class HelloMessage {
+    public final String message;
 
 
-  public JsonResource()
-  {
-    MESSAGE.put("message", "Hello, world!");
+    public HelloMessage(String m) { message = m; }
   }
   }
 
 
+  public JsonResource() { }
+
   @GET
   @GET
-  public Map<String, String> sayHello()
+  public HelloMessage sayHello()
   {
   {
-    return MESSAGE;
+    return new HelloMessage("Hello, World!");
   }
   }
 }
 }