Develop Web applications in equinox environment-html

Source: Internet
Author: User

I. Purpose of the document


The purpose of this article is to allow developers to enter the development stage as soon as possible, avoid spending too much energy and time on environment settings, simplify development environment settings, and improve work efficiency, play the role of R & D support.

 

The final expected result of this article is that readers can simply copy and paste the configuration content by following the instructions in this article and the provided environment configuration content, quickly build a static html runtime environment in the osgi environment. In addition, this article summarizes some problems that may be encountered during the development process and the solutions to the problems.

 

Ii. Expected readers


Developers engaged in osgi design and development in the eclipse environment.

 

Iii. content of this article


This article describes how to set the Equinox runtime environment in the eclipse development environment. Use an example to describe the process of environment creation.

 

Iv. Development Environment


JDK 1.5

Eclipse 3.3

 

V. Runtime Environment
Windows XP + SP2

 

Vi. Other Instructions


If you want to see more clearly in this article, drag and drop the image to enlarge it.

 

VII. Steps

1. Create an environment
1) create a plug-in project:

2) enter the project name and select equinox as the target platform:

3) no modification, next

4) no changes, finish

2. Project Structure



 

3. Add content


1)create a new directory webrootand an index.html File

 

Note: webroot is located in the root directory of the project. The index.html content is in any HTML format.

The reference content of index.html is shown in the figure below.

 

  1. <! -- Index.html reference -->
  2. <HTML>
  3. HTML hello
  4. </Html>

 

2) Create the plugin. xml file under the project root directory

 

The content of plugin. XML is as follows. You can directly copy the following content for use.

  1. <Plugin>
  2. <Extension point = "org. Eclipse. Equinox. http. Registry. Resources">
  3. <Resource
  4. Alias = "/Web"
  5. Base-name = "/webroot"/>
  6. </Extension>
  7. </Plugin>

At this time, manifest. MF will report an error.

 

3) Modify manifest. MF

 

A. Add it after bundle-symbolicname; singleton: = true

B. Add require-bundle content

 

The modified manifes. MF content is as follows:

 

  1. Manifest-version: 1.0
  2. Bundle-manifestversion: 2
  3. Bundle-Name: HTML plug-in
  4. Bundle-symbolicname: cn.tuscany.osgi.example.html; singleton: = true
  5. Bundle-version: 1.0.0
  6. Require-Bundle: org. Apache. commons. logging,
  7. Org. Eclipse. osgi. Services,
  8. Javax. servlet,
  9. Org. mortbay. jetty,
  10. Org. Eclipse. Equinox. http. jetty,
  11. Org. Eclipse. Equinox. http. servlet,
  12. Org. Eclipse. Equinox. Common,
  13. Org. Eclipse. Equinox. Registry,
  14. Org. Eclipse. Equinox. http. Registry

Note: there must be an empty line in the last line, and no space is allowed;

 

4. Run the application


1) Select "Run open run dialog..." from the tool menu...

2) pop-up window


3) double-click osgi framework

Click deseletc Al, modify the value of name to osgi_html_test, and then click Apply.


4) Select the cn.org.tuscany.osgi.test.html project in the workspace and click Add required bundles.

5) Click Run. The console displays the following:


6) Open IE and enter http: // localhost/web/index.html in the address bar.

7) display interface


VIII. Dependent bundle Information


Except for org. Apache. commons. Logging, other bundle comes with eclipse.

Org. Apache. commons. Logging can be found online.

IX. Possible Problems
1. manifest. MF format problems

There must be an empty row in the last line of the manifest. MF file, and there cannot be any space;

2. jetty Service Startup Problems

Check whether other Web applications on the local machine occupy port 80.

 

<End>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.