java resource jar_页面比较 - jarresource-javaee6 - A simple bundled resources example (v.19 vs v.20) - A...

Application Overview

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.

Application structure

The full-blown of the application structure is depicted as the following:indent0

0\+\- WEB_INFindent1

1\|\_ web.xmlindent1

1\|\_ geronimo-web.xmlindent0

0\+\- libindent1

1\+\- jarresource-javaee6-jar-3.0-M1.jarindent2

2\+\- META-INFindent3

3\+\- resourcesindent4

4\|\_ index.htmlindent4

4\|\_ header.htmlindent4

4\|\_ jarresource.jsp

Application Implementation

web.xml specifies the welcome file list, we use index.html as enclosed by tags in the sample. xmlweb.xml

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 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 tags is the entry point of the URL used to access this web application. Therefore the sample application can be accessed at http://:/jarresource-javaee6. xmlgeronimo-web.xml

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

tag in index.html defines a frameset.The frameset element holds two frame elements which indicate two separate documents header.html and jarresource.jsp. htmlindex.html

jarresource.jsp is used to render output on the screen. htmljarresource.jsp

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: solidmvn clean install

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

jarresource.jpg?version=1&modificationDate=1279248135000&api=v2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值