Mercurial > hg > ismi-richfaces
comparison src/main/java/de/mpiwg/itgroup/diva/utils/JSONArrayParam.java @ 1:2e911857a759
(none)
author | jurzua |
---|---|
date | Wed, 29 Oct 2014 14:00:28 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:74df02964906 | 1:2e911857a759 |
---|---|
1 package de.mpiwg.itgroup.diva.utils; | |
2 | |
3 import javax.ws.rs.WebApplicationException; | |
4 import javax.ws.rs.core.Response; | |
5 import javax.ws.rs.core.Response.Status; | |
6 | |
7 import org.json.JSONArray; | |
8 import org.json.JSONException; | |
9 | |
10 public class JSONArrayParam { | |
11 | |
12 private JSONArray json; | |
13 | |
14 public JSONArrayParam(String string) throws WebApplicationException { | |
15 | |
16 try { | |
17 json = new JSONArray(string); | |
18 } catch (JSONException e) { | |
19 throw new WebApplicationException(Response.status(Status.BAD_REQUEST) | |
20 .entity("Couldn't parse JSON string: " + e.getMessage()) | |
21 .build()); | |
22 } | |
23 } | |
24 | |
25 public JSONArray getArray() { | |
26 return json; | |
27 } | |
28 } |