Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. try {
  2. // login and get the cookie
  3. HttpGet getLogin = new HttpGet("/Default.aspx");
  4. getLogin.addHeader("UserName", username);
  5. getLogin.addHeader("Password", password);
  6. getLogin.addHeader("Accept", "application/json");
  7. HttpResponse r = c.execute(host, getLogin);
  8. System.out.println(r.getStatusLine());
  9. System.out.println(EntityUtils.toString(r.getEntity()));
  10.  
  11. // should make sure you don't get an error message
  12.  
  13. HttpGet getReport = new HttpGet("/api/reporting/abc");
  14. getReport.addHeader("Accept", "application/json");
  15. HttpResponse r2 = c.execute(host, getReport);
  16. System.out.println(r2.getStatusLine());
  17. System.out.println(EntityUtils.toString(r2.getEntity()));
  18. } catch (IOException e) {
  19. e.printStackTrace();
  20. } finally {
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement