changeset 32:0c66cff0d1cc

The page is now generated using a simple form (using GET), and each time the page is generated a player is generated as well; small CSS changes.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 10 Dec 2013 17:39:27 +0000
parents c63f773b4e48
children f415cc429558
files WebContent/StyleSheet.css WebContent/index.jsp src/HumanEchoServlet.java
diffstat 3 files changed, 72 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/WebContent/StyleSheet.css	Tue Dec 10 17:38:43 2013 +0000
+++ b/WebContent/StyleSheet.css	Tue Dec 10 17:39:27 2013 +0000
@@ -1,19 +1,23 @@
-body
-{
+body {
 	font-size: 11pt;
 	font-family: Arial;
 	background-color: whitesmoke;
 }
-LABEL
-{
+
+label {
 	font-size: 12pt;
 	font-family: Arial;
 }
-H1
-{
+
+h1 {
 	font-family: Arial;
 	font-weight: bold;
 	font-size: 22pt;
 	color: black;
 }
 
+.description {
+    font-size: small;
+    font-style: italic;
+}
+
--- a/WebContent/index.jsp	Tue Dec 10 17:38:43 2013 +0000
+++ b/WebContent/index.jsp	Tue Dec 10 17:39:27 2013 +0000
@@ -1,45 +1,79 @@
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <html>
     <head>
         <title>Human Echolocation</title>
         <link rel="Stylesheet" type="text/css" media=all href="./StyleSheet.css" />
         <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
 
-        <script type="text/javascript" src="script/jquery-1.10.2.min.js"></script>
-        <script type="text/javascript" src="script/echo.js"></script>
+        <c:choose>
+            <c:when test="${not empty param.dist}">
+                <c:set var="dist" value="${param.dist}" />
+                <c:set var="distSet" value="true" />
+            </c:when>
+            <c:otherwise>
+                <c:set var="distSet" value="false" />
+            </c:otherwise>
+        </c:choose>
+
+        <c:set var="azim" value="${param.azim}" />
+        <c:set var="dirweight" value="${param.dirweight}" />
+        <c:set var="orient" value="${param.orient}" />
+
     </head>
 
     <body>
-        <div style="text-align: center">
-            <table width="760" cellpadding="0" cellspacing="0">
-                <tr>
-                    <td><img src="header_bg.jpg" alt="Header Image Not Found" width="779" height="72" /></td>
-                    </tr>
-            </table>
-            <br />
+        <form action="index.jsp" method="get">
+            <div style="text-align: center">
+                <table width="760" cellpadding="0" cellspacing="0">
+                    <tr>
+                        <td><img src="header_bg.jpg" alt="Header Image Not Found"   width="779" height="72" /></td>
+                        </tr>
+                </table>
+                <br />
 
-            <h1>Human Echolocation WebApp Example Page</h1>
+                <h1>Human Echolocation WebApp Example Page</h1>
 
-            Testing...<br />
+                Input parameters:
+                <br />
+                Distance (typical value: 0.9):
+                <input type="text" name="dist" size="8">
+                <br />
+                Azimuth (-17 to +17):
+                <input type="text" name="azim" size="8">
+                <br />
+                Orientation (angled / horiz):
+                <input type="text" name="orient" size="8">
+                <br />
+                Dirweight (angled / horiz):
+                <input type="text" name="dirweight" size="8">
+                <br />
+                <p class="description">Controls how easy it is to distinguish whether the reflector is to the left or the right (the lower .dirweight is, the easier).</p>
 
-            Input parameters:
-            <br>
-            Distance:
-            <input type="text" id="dist" "name="dist" size="8">
-            <br>
-            <input type="submit" value="Generate" id="generate">
-            <br>
+                <input type="submit" value="Generate">
+                <br />
 
-            <div id="ajax-loading">
-                <img src="ajax-loader.gif" class="ajax-loader" style="display:none" /></div>
+                <br />
+            </div>
+        </form>
 
-            <br />
 
-            <div id="responsetext"></div>
-
-            <br>
-            </div>
-
+        <div id="player">
+            <c:choose>
+                <c:when test="${distSet==true}">
+                    <p class="debug">
+                        Generating echo with the following parameters:
+                        <br/>Distance <c:out value="${dist}"/>
+                        <br/>Distset <c:out value="${distSet}"/>
+                    </p>
+                    <embed src="/echoapp/HumanEcho?dist=<c:out value="${dist}"/>" type="audio/x-wav"/>
+                </c:when>
+                <c:otherwise>
+                    <c:out value="Cowardly refusing to generate a player without distance parameter..."/>
+                </c:otherwise>
+            </c:choose>
+        </div>
+        <br />
     </body>
 </html>
 
--- a/src/HumanEchoServlet.java	Tue Dec 10 17:38:43 2013 +0000
+++ b/src/HumanEchoServlet.java	Tue Dec 10 17:39:27 2013 +0000
@@ -118,7 +118,7 @@
             File wavfile = new File(outputfname);
 
             //set response headers
-            response.setContentType("audio/wav");
+            response.setContentType("audio/x-wav");
             response.addHeader("Content-Disposition","attachment; filename=" + outputfname );
             response.setContentLength( (int) wavfile.length( ) );
 
@@ -141,10 +141,6 @@
                 buf.close( );
           }
 
-        System.out.println("MCRROOT: " + System.getenv("MCRROOT"));
-        System.out.println("PATH: " + System.getenv("PATH"));
-        System.out.println(MCRConfiguration.isInstalledMCR());
-
-        logger.warn("tmpdir " + tempdir);
+        logger.info("Wrote file:" + outputfname);
     }
 }