[Minor] Added further helper methods to ResponseUtil

This commit is contained in:
Robert von Burg 2016-09-08 15:53:48 +02:00
parent bdd4091a16
commit 68327da042
1 changed files with 11 additions and 0 deletions

View File

@ -36,6 +36,17 @@ public class ResponseUtil {
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}
public static Response toResponse(String prop1, String value1, String prop2, String value2) {
JsonObject response = new JsonObject();
response.addProperty(MSG, StringHelper.DASH);
response.addProperty(prop1, value1);
response.addProperty(prop2, value2);
String json = new Gson().toJson(response);
return Response.ok(json, MediaType.APPLICATION_JSON).build();
}
public static Response toResponse(String member, JsonElement jsonElement) {
JsonObject response = new JsonObject();
response.addProperty(MSG, StringHelper.DASH);