Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  2. try {
  3. out.println("<!DOCTYPE> html"); // HTML 5
  4. out.println("<html><head>");
  5. out.println("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
  6. out.println(Test_Servlet("abc","xyz","pqr"));
  7. out.println("<head><title>TEST SERVLET API Call</title></head>");
  8. out.println("<body>");
  9. out.println("<h3>TEST SERVLET</h3>");
  10.  
  11. // Tabulate the request information
  12. out.println("</body></html>");
  13. }
  14. finally {
  15. out.close(); // Always close the output writer
  16. }
  17. }
  18.  
  19. public static Object Test_Servlet(String FirstString,String Secondstring,String ThirdString) throws IOException {
  20. String accessKey = "myaccesskey";
  21. String secretKey = "mysecretkey";
  22. String uRLCppList = "http://myurl.com";
  23. String method = "POST";
  24. java.util.Date currentTime = new java.util.Date();
  25. SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
  26.  
  27. // Give it to me in GMT time.
  28. sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
  29. String dateTimeString = sdf.format(currentTime);
  30.  
  31. String signature = generateSignature(method, secretKey, dateTimeString);
  32. String authorization = accessKey + ":" + signature;
  33. Map<String, String> params = new HashMap<String, String>();
  34.  
  35. params.put("Content of first String", FirstString);
  36. params.put("Content of Second String", Secondstring);
  37. params.put("Content of Third String", ThirdString);
  38.  
  39. String[] result = sendHttpRequest(uRLCppList, "POST", params, dateTimeString, authorization);
  40.  
  41. return result;
  42. }
  43.  
  44. html [Ljava.lang.String;@430bc84a
  45. TEST SERVLET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement