Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- try {
- out.println("<!DOCTYPE> html"); // HTML 5
- out.println("<html><head>");
- out.println("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
- out.println(Test_Servlet("abc","xyz","pqr"));
- out.println("<head><title>TEST SERVLET API Call</title></head>");
- out.println("<body>");
- out.println("<h3>TEST SERVLET</h3>");
- // Tabulate the request information
- out.println("</body></html>");
- }
- finally {
- out.close(); // Always close the output writer
- }
- }
- public static Object Test_Servlet(String FirstString,String Secondstring,String ThirdString) throws IOException {
- String accessKey = "myaccesskey";
- String secretKey = "mysecretkey";
- String uRLCppList = "http://myurl.com";
- String method = "POST";
- java.util.Date currentTime = new java.util.Date();
- SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
- // Give it to me in GMT time.
- sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
- String dateTimeString = sdf.format(currentTime);
- String signature = generateSignature(method, secretKey, dateTimeString);
- String authorization = accessKey + ":" + signature;
- Map<String, String> params = new HashMap<String, String>();
- params.put("Content of first String", FirstString);
- params.put("Content of Second String", Secondstring);
- params.put("Content of Third String", ThirdString);
- String[] result = sendHttpRequest(uRLCppList, "POST", params, dateTimeString, authorization);
- return result;
- }
- html [Ljava.lang.String;@430bc84a
- TEST SERVLET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement