What is the JWaveJSPServlet?
The JWaveJSPServlet provides a mechanism for creating a JWAVE solution where all processing occurs on the server. In this architecture, the client only displays HTML. Applets, on the other hand, are Java programs that require a Java VM running on the client. Java Server Pages (JSP) have become a standard technology for displaying content that is dynamically generated in this way.
Location of the JWaveJSPServlet
The source code for the JWaveJSPServlet is located in:
(UNIX) RW_DIR/classes/com/visualnumerics/servlet
(WIN) RW_DIR\classes\com\visualnumerics\servlet
where RW_DIR is the main Rogue Wave installation directory.
Purpose of the JWaveJSPServlet
The JWaveJSPServlet serves two primary purposes:
*a functional program that you can use “as is” to create JSP/JWAVE interactions.
*an example that demonstrates how you can create a custom servlet that lets JWAVE work with JSP pages (dynamically generated content). The JWaveJSPServlet demonstrates how a set of JWAVE utility classes are used to manage images.
Overview of the JWaveJSPServlet
The JWaveJSPServlet accepts requests from a JSP page. Typically, the JSP page is used to display an HTML form interface through which a user can specify the parameters for a task, such as creating a plot or processing an image. The JSP page calls on a servlet to process these requests. The servlet is responsible for calling PV‑WAVE, which generates results and returns them to the client.
The output generated by PV‑WAVE is either graphical or numerical. When the results are returned to the servlet, the servlet responds by displaying a new JSP page that contains the results of the analysis. Numerical results can be forwarded directly back to the client as tags in the JSP Response object. Graphical results can either be streamed directly back to the client, or can be stored on the server for later retrieval. (A class called the JWaveImageManager, described in the next section, manages the storage and retrieval of images.) For numerical results, the JSP page simply retrieves variables from the Response object and displays them. For graphical results, the JSP page obtains a URL that allows the client to retrieve a graphic that was stored on the server by the JWaveImageManager.
JWaveImageManager
The JWaveImageManager is a convenience class that manages images on the server. Because images can take time to generate, users might normally experience a delay between the time when they submit a request from their browser and the time the image is received. If many users happen to be contacting the JWAVE server simultaneously, the delay could be substantial. By storing images on the server and returning a URL to the client, the user will not experience any appreciable delay in the server’s response. Numerical results are displayed almost immediately, while the images appear as soon as they are available. For security, each image stored by the JWaveImageManager is given a unique ID, which is returned to the client in the URL.
For more information, see "Understanding the JWaveJSPServlet".