|
@@ -44,17 +44,24 @@ public class ViewController extends Controller {
|
|
|
|
|
|
}
|
|
|
public void testget() {
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", PropKit.get("institution_id"));
|
|
|
- map.put("num","30");
|
|
|
- String content = postWithParameters("https://117.156.67.61:9600/butt/getExam", map);
|
|
|
- JSONObject jsonObject = JSON.parseObject(content);
|
|
|
- if (!jsonObject.getString("msg").equals("success")) {
|
|
|
-// return null;
|
|
|
+ try {
|
|
|
+ Map <String,String> map = new HashMap<String,String>();
|
|
|
+ map.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ map.put("num","30");
|
|
|
+ String content = postWithParameters("https://117.156.67.61:9600/butt/getExam", map);
|
|
|
+ JSONObject jsonObject = JSON.parseObject(content);
|
|
|
+ if (!jsonObject.getString("msg").equals("success")) {
|
|
|
+// return null;
|
|
|
+ }
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));
|
|
|
+// return jsonArray;
|
|
|
+ this.renderJson(jsonArray);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO: handle exception
|
|
|
+ this.renderText(e.toString());
|
|
|
+
|
|
|
}
|
|
|
- JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));
|
|
|
-// return jsonArray;
|
|
|
- this.renderJson(jsonArray);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
public static String postWithParameters(String url, Map<String, String> map) {
|