package wasdev.sample.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class SimpleServlet
 */
@WebServlet("/SimpleServlet")
public class SimpleServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // response.setContentType("text/html");
        // response.getWriter().print("Hello World!");
        
         try{
         // just the name of the parameter in the URL    
	   	 String fileUrl = request.getParameter("fileUrl");
         URL url = new URL(fileUrl);
             
	     response.getWriter().println("my file is: " + url.getName());
             
         // Create a temp file     
	     File tmp = File.createTempFile("myTmp", ".csv");
	     tmp.deleteOnExit();     	 
	     IOUtils.copy(url.openStream(), new FileOutputStream(tmp));
	 
	     
	 
	     response.setContentType("application/json");
	     response.getWriter().write("Stefy");

	   }catch(Exception e){
	     response.setContentType("text/html");	    	    
        response.getWriter().println("Hello no good parameter!");
        e.printStackTrace(response.getWriter());
        
	   }
    }

}

@@ -40,27 +40,234 @@
 java.io.
-IOException
+File;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.net.URL;%0A%0Aimport org.apache.commons.io.IOUtils;%0A%0Aimport ibm.smartWatch.heartRate.HeartRateController;%0Aimport ibm.smartWatch.utils.CSVReader
 ;%0A%0Aimpor
@@ -610,20 +610,17 @@
 rvlet %7B%0A
-    
+%09
 private 
@@ -664,21 +664,66 @@
 1L;%0A
-%0A    /**%0A    
+%09public static HeartRateController heartController;%0A%09/**%0A%09
  * @
@@ -783,32 +783,41 @@
 pServletResponse
+%0A%09 *     
  response)%0A     
@@ -815,20 +815,14 @@
 se)%0A
-     */%0A    
+%09 */%0A%09
 @Ove
@@ -827,20 +827,17 @@
 verride%0A
-    
+%09
 protecte
@@ -906,17 +906,20 @@
 esponse)
- 
+%0A%09%09%09
 throws S
@@ -949,24 +949,18 @@
 ption %7B%0A
-        
+%09%09
 // respo
@@ -992,24 +992,18 @@
 html%22);%0A
-        
+%09%09
 // respo
@@ -1045,40 +1045,20 @@
 %22);%0A
-        %0A         
+%0A%09%09
 try
+ 
 %7B%0A
-         
+%09%09%09
 // j
@@ -1101,19 +1101,12 @@
  URL
-    %0A%09   %09 
+%0A%09%09%09
 Stri
@@ -1151,25 +1151,20 @@
 eUrl%22);%0A
-         
+%0A%09%09%09
 URL url 
@@ -1187,28 +1187,56 @@
 l);%0A
-             %0A%09     
+%09%09%09response.getWriter().println(%22step 1 %22);%0A%0A%09%09%09
 resp
@@ -1288,40 +1288,35 @@
 .get
-Name());%0A             %0A         
+Content().toString());%0A%0A%09%09%09
 // C
@@ -1336,20 +1336,12 @@
 file
-     %0A%09     
+%0A%09%09%09
 File
@@ -1386,21 +1386,18 @@
 csv%22);%0A%09
-     
+%09%09
 tmp.dele
@@ -1411,22 +1411,12 @@
 t();
-     %09 %0A%09     
+%0A%09%09%09
 IOUt
@@ -1474,27 +1474,12 @@
 ));%0A
-%09 %0A%09     %0A%09 %0A%09     
+%0A%09%09%09
 resp
@@ -1520,21 +1520,18 @@
 son%22);%0A%09
-     
+%09%09
 response
@@ -1565,17 +1565,17 @@
 ;%0A%0A%09
-   %7D
+%09%7D 
 catch
+ 
 (Exc
@@ -1587,16 +1587,14 @@
 n e)
+ 
 %7B%0A%09
-     
+%09%09
 resp
@@ -1630,27 +1630,12 @@
 l%22);
-%09    %09    %0A        
+%0A%09%09%09
 resp
@@ -1688,23 +1688,21 @@
 ter!%22);%0A
-       
+%09%09%09//
  e.print
@@ -1739,28 +1739,351 @@
 ));%0A
-        %0A%09   %7D%0A    %7D
+%0A%09%09%7D%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) throws ServletException %7B%0A%0A%09%09String csvFile = %22C://smartwatch//Heart Rate data fromQSACCESS.csv%22;%0A%09%09System.out.println(%22Evaluating file:  %22 + csvFile + System.lineSeparator());%0A%09%09heartController = new HeartRateController();%0A%09%09CSVReader.parseHeartRateCSVFile(csvFile,  heartController);%0A%09%7D%0A%09%0A%09%0A%09
 %0A%0A%7D%0A

Update SimpleServlet.java