diff src/HumanEchoServlet.java @ 42:65a26b38bf43

Some debug output, and work toward neatening the jsp &c
author Chris Cannam
date Tue, 25 Feb 2014 16:46:12 +0000
parents 91ecbdda6f4a
children 84d02afe28e6
line wrap: on
line diff
--- a/src/HumanEchoServlet.java	Fri Feb 14 15:24:09 2014 +0000
+++ b/src/HumanEchoServlet.java	Tue Feb 25 16:46:12 2014 +0000
@@ -32,29 +32,39 @@
     private HumanEcho echo;
     private static Logger logger = Logger.getLogger(HumanEchoServlet.class);
 
-    private String tempdir = "";
     private String wavdir = "";
 
     public void init(ServletConfig config) throws ServletException {
         super.init(config);
 
-        // reading properties file
+	System.err.println("In init");
+
+	logger.error("java.library.path is " + 
+		     System.getProperty("java.library.path"));
+
         try {
+	    // Read directory properties
             Properties properties = new Properties();
-            properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("myapp.properties"));
+            properties.load
+		(Thread.currentThread().getContextClassLoader().
+		 getResourceAsStream("myapp.properties"));
 
-            //get the property value and print it out
-            tempdir = properties.getProperty("tmpdir");
             wavdir = properties.getProperty("outdir");
 
+	    System.err.println("WAV file directory is " + wavdir);
+
         } catch (IOException e) {
             e.printStackTrace();
         }
 
         try {
+	    // Test that we can construct one of the MATLAB objects
+	    
+	    long before = System.currentTimeMillis();
             echo = new HumanEcho();
-        }
-        catch(MWException e) {
+	    long after = System.currentTimeMillis();
+	    System.err.println("Created a HumanEcho object: it took " + (after - before) + " ms");
+        } catch (MWException e) {
             e.printStackTrace();
         }
     }
@@ -62,7 +72,7 @@
     public void destroy() {
         super.destroy();
 
-        if(echo!=null) {
+        if (echo != null) {
             echo.dispose();
         }
     }
@@ -75,20 +85,22 @@
         logger.info("String azim is: " + request.getParameter("azim"));
         Float azim = Float.parseFloat(request.getParameter("azim"));
 
-
-
-
         MWStructArray Input = null;
         HumanEcho echo;
 
         String outputfname = new String();
 
+	System.err.println("In doGet");
+
         try {
+	    //!!! erch, shouldn't be creating a new one on each request as well as a global one
             echo = new HumanEcho();
 
             logger.error("We are logging!");
             logger.warn(System.getProperty("catalina.base"));
 
+	    System.err.println("Done some logging");
+            System.err.println(System.getProperty("catalina.base"));
 
             // Matlab structure:
             // Input = struct('dist', 0.9, 'azim', 0, 'orient', 'horz', 'dirweight', 0.2, 'outputfname', 'foo.wav')