- Event[] getEventList() {
- Event events[];
- URL hostUrlJson;
- InputStreamReader in;
- try {
- hostUrlJson=new URL(Constants.searchUrl);
- HttpsURLConnection calConnection = (HttpsURLConnection) hostUrlJson.openConnection();
- calConnection.setDoOutput(true);
- calConnection.setUseCaches(false);
- calConnection.setRequestProperty("Authorization", "Basic "+Base64.encodeToString( (Constants.user+':'+Constants.password).getBytes(), Base64.NO_WRAP));
- //calConnection.setRequestMethod("POST");
- //calConnection.setDoInput(true);
- //calConnection.connect();
-
- final PrintWriter ps=new PrintWriter(calConnection.getOutputStream());
- ps.print("{}");
- ps.close();
-
- in = new InputStreamReader(calConnection.getInputStream());
- Gson gson=new Gson();
- events=gson.fromJson(in,Event[].class);
- in.close();
-
- return events;
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- System.err.println("catch1");
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- System.err.println("catch2");
- e.printStackTrace();
- }
- throw new AssertionError();
- }