|inventory - Simple Database Access Application||Java EE sample applications||ldap-sample-app - LDAP Sample Application|
This sample application bundles a JAR file, namely jarresource-javaee6-jar-3.0-M1.jar in its WEB-INF/lib directory and the sample application contains both dynamic and static resources(index.html, head.html, jarresource.jsp) in its META-INF/resources directory. All these resources can be accessed as if they are in the application's root directory. Prior to Servlet 3.0, this may result in a 404 response.
Once the resources are requested, it will first search the root of the web application context for the requested resource before looking at any of the JAR files in the WEB-INF/lib directory. The order in which the JAR files in the WEB-INF/lib directory are scanned is undefined.
The full-blown of the application structure is depicted as the following:
web.xml specifies the welcome file list, we use index.html as enclosed by <welcome-files/> tags in the sample.
geronimo-web.xml specifies the module's dependency information and entry point of the application.
Information about the project such as module's unique name, dependencies is described inside the <sys:environment/> tags. It is one of the best practices to give your module an unique identification, so that it can later be referenced by some other deployable applications. In our sample application, the module is grouped as org.apache.geronimo.samples. The path specified in the <context-root/> tags is the entry point of the URL used to access this web application. Therefore the sample application can be accessed at http://<hostname>:<port>/jarresource-javaee6.
index.html is placed in the META-INF/resources directory of the JAR file which is then bundled in the WEB-INF/lib directory of this jarresource-javaee6 application.
The <frameset> tag in index.html defines a frameset.The frameset element holds two frame elements which indicate two separate documents header.html and jarresource.jsp.
jarresource.jsp is used to render output on the screen.
Get Source Code
Please reference Samples General Information for information on obtaining and building the source for this and other samples.
Build the web application
Once all the sources get checked out the next step is to build jarresource-javaee6 sample. It requires Maven 2 for building the binaries.
From the < jarresource-javaee6_home> directory run the following command:
This process will take a couple of minutes according to the availability of jar files in your local maven repository. The binaries will be generated in the corresponding target directory .
Deploy the web application
Deploying sample application is pretty straight forward as we are going to use the Geronimo Console.
- Click Deploy New form the left navigation panel on the console
- Load jarresource-javaee6-war-3.0-M1.war from jarresource-javaee6-war\target folder in to the Archive input box.
- Press Install button to deploy application in the server.
Test the web application
The app is accessible at http://localhost:8080/jarresource-javaee6.