Modifying the webapp » History » Version 8

Chris Cannam, 2014-03-13 11:11 AM

1 2 Chris Cannam
2 1 Chris Cannam
h1. Modifying the webapp
3 1 Chris Cannam
4 2 Chris Cannam
h2. Context
5 2 Chris Cannam
6 5 Chris Cannam
You want to change something in the interactive part of the application: the JSPs (Java Server Pages) that present the application in the browser -- or the servlets that process requests and hand off to the MATLAB layer -- and deploy the changed version.
7 2 Chris Cannam
8 2 Chris Cannam
You do not want to change any of the MATLAB code (see [[Modifying the MATLAB]] if you do).
9 2 Chris Cannam
10 2 Chris Cannam
h2. You will need
11 2 Chris Cannam
12 7 Chris Cannam
 * A computer with the "MATLAB Compiler Runtime":http://www.mathworks.co.uk/products/compiler/mcr/ (MCR) installed.
13 4 Chris Cannam
 ** This computer does *not* need a MATLAB licence.
14 2 Chris Cannam
 ** The computer must be the same kind (platform, architecture etc) as the one the web app will eventually be served from. It may be simplest if it is the same machine.
15 4 Chris Cannam
 ** It does *not* need to be the same kind of machine as the one with the licensed version of MATLAB used to compile the @isvr.jar@ file (see [[Modifying the MATLAB]]).
16 3 Chris Cannam
 ** The MATLAB Compiler Runtime must be of the same version as the MATLAB release that was used to compile the @isvr.jar@ file (see [[Modifying the MATLAB]]).
17 6 Chris Cannam
 * The Java development kit (JDK) of whichever version your MATLAB runtime expects. Current MATLAB seems to call for Java 7.
18 1 Chris Cannam
 * The @servlet-api.jar@ file from your web application server.
19 7 Chris Cannam
20 7 Chris Cannam
The most likely "production" setup is to have a workstation or server with a licensed copy of MATLAB on it, and to use that for [[Modifying the MATLAB]]; and then to have a separate, different machine (such as a Linux server) without MATLAB installed but with the MCR, which is used for both building and serving the web app.
21 7 Chris Cannam
22 7 Chris Cannam
h2. What to change; limitations
23 7 Chris Cannam
24 8 Chris Cannam
The "Java Server Pages":http://en.wikipedia.org/wiki/JavaServer_Pages files are found in @WebContent/*.jsp@. The default page is @index.jsp@. These files mix up HTML and Java segments in order to render the pages that are sent to the browser. They usually contain presentation code and forms and they may call out to other Java code for "real" work.
25 8 Chris Cannam
26 8 Chris Cannam
The servlets are found in @src/*.java@. A servlet is a Java class which accepts an HTTP request and generates some response, typically not a full HTML page (that's what the JSPs are used for).
27 8 Chris Cannam
28 8 Chris Cannam
In this application, currently, the JSPs generate the pages and the servlets are used to generate individual audio files for embedding into the pages.
29 8 Chris Cannam
30 8 Chris Cannam
The servlet code can call MATLAB functions, by building the special @MWStructArray@ class (from @com.mathworks.toolbox.javabuilder@ package) which contains a structure of MATLAB types and passing it to a method corresponding to the desired MATLAB function. That method (e.g. @simulateBinauralSignals@) is found in a Java class that was generated by the MATLAB compiler, in this case @HumanEcho@ inside @isvr.jar@.
31 8 Chris Cannam
32 7 Chris Cannam
h2. How to rebuild