Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- // login and get the cookie
- HttpGet getLogin = new HttpGet("/Default.aspx");
- getLogin.addHeader("UserName", username);
- getLogin.addHeader("Password", password);
- getLogin.addHeader("Accept", "application/json");
- HttpResponse r = c.execute(host, getLogin);
- System.out.println(r.getStatusLine());
- System.out.println(EntityUtils.toString(r.getEntity()));
- // should make sure you don't get an error message
- HttpGet getReport = new HttpGet("/api/reporting/abc");
- getReport.addHeader("Accept", "application/json");
- HttpResponse r2 = c.execute(host, getReport);
- System.out.println(r2.getStatusLine());
- System.out.println(EntityUtils.toString(r2.getEntity()));
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement