|
Development mode This article explains how to run a Web-module in development mode in order to compile Servlets and debug JSP pages. 1 Introduction The goal of this article is to explain how to utilize development mode for Web-modules for debugging JSP pages and compiling Servlets. When a Web-module is running in development mode, Orion will re-compile classes on a per-request basis. This means that Orion will check if the source for the class has changed since the last request and recompile the class as needed. This is also true for JSP pages when a used bean is changed or an included page has changed. Running a Web-module in development mode also forces Orion to compile JSP pages to a slower, more readable format and store the source code for these in the persistence directory of the Web-modules deployment directory. The article requires basic knowledge of Servlets and JSP. 2 Enabling development mode The goal of this section is to explain how to enable development mode for a Web-module. The default web application will be used as an example Web-module. This section involves the following steps: 2.1 Step 1: Enabling Development Mode Development mode is enabled by adding an attribute to the Web-modules deployment descriptor. Below this will be exemplified using the global-web-application that is mounted at the root "/" in the default setup of an Orion Application Server. To perform this operation on another Web-module, perform the same changes to this modules orion-web.xml, located in the Web-modules deployment directory. Open the file global-web-application.xml. The file global-web-application.xml is really a orion-web.xml file. It is normally located in the /orion/config/ directory. Set development=true in the <orion-web-app> tag so that it looks something like the following:
The syntax for the tag orion-web-app can be found here This Web-module is now running in development mode. If JSP pages should not be reloaded when a used bean is changed, set the autoreload-jsp-beans attribute in the tag in orion-web-app to false. The default value is true. Please notice that changes made to implemented interfaces or abstract classes is not noticed If JSP pages should not be reloaded when an included page has changed, set the autoreload-jsp-pages attribute in the tag orion-web-app to false. The default value is true 3 Compiling Servlets The goal of this section is to explain how to utilize development mode for compiling Servlets on the Orion Application Server. It does so by describing step-by-step instructions for the creation and executing of a simple Servlet. For the purpose of simplicity, the default web application will be used throughout the section. Running a Web-module in development mode makes the Orion Application Server compile necessary classes on request basis as long as the source-code is available. This section involves the following steps: 3.1 Step 1: Creating a test servlet In order to try out Development-mode, create the source of a simple Servlet. Create the source code for a new Servlet named HelloWorldServlet2 and store it amongst the classes of your Web-module. The source is given below:
This Servlet will just output the good old "Hello world!" message. The classes directory of the default web application is normally found at /orion/default-web-app/WEB-INF/classes. If another Web-module is used, look for it's classes directory under it's WEB-INF directory. 3.2 Step 2: Compiling and running the Servlet With the Web-module in development mode and the source-code for an Servlet available, it's now time to try it out. Open the URL given below in a normal web browser.
You should now see the "Hello world!" message in your browser. 4 Debugging JSP pages The goal of this section is to explain how to utilize development mode for debugging JSP pages. Sometimes it's useful to see the source of a Servlet generated from an JSP page in order to track down an error. By enabling development mode for a Web-module, Orion will compile the JSP pages to a slower, more readable form whose source code will be saved into the persistence directory located in the Web-modules deployment directory. So if the default web application is running in development mode, the source-code for any invoked JSP pages would be found at:
Where [JSP name] is the name of the invoked page. Copyright © 2005 IronFlare AB |