equinox中的內(nèi)置的jetty服務(wù)器已經(jīng)很優(yōu)秀了,但應(yīng)用可以需要用到已經(jīng)成熟的技術(shù),需要集成到如tomcat, weblogic等等容器中。(下面以tomcat容器為例, 其他已經(jīng)包括了OSGi框架的容器可能會(huì)更麻煩一點(diǎn))
下面按照自己的操作需要注意的關(guān)鍵步驟,記錄一下如何把OSGi應(yīng)用部署到tomcat容器中。
servletbridge相關(guān)插件[s1]
warproduct相關(guān)插件[s2](0.2.2.201212132117)
1) 集成到tomcat容器中,得去掉就javax.servlet Plugin的依賴。需要修改:插件中對(duì)于javax.servlet插件的引用,修改為package的方式添加依賴。
2) 在已經(jīng)可以運(yùn)行的product的基礎(chǔ)上 [s3],新建warproduct導(dǎo)出為war [r1]。(后面的就不用講了,和部署其他war是一樣的)
1、這其中最牛叉的就是servletbridge.jar,其中就三個(gè)Java類:
· org/eclipse/equinox/servletbridge/BridgeServlet.java
接收和轉(zhuǎn)發(fā)請(qǐng)求(給真正的Servlet),和插件org.eclipse.equinox.http.servletbridge配合把真正的Servlet(org.eclipse.equinox.http.servlet.HttpServiceServlet)注冊(cè)到容器(如tomcat)。
同時(shí)管理Framework。
· org/eclipse/equinox/servletbridge/CloseableURLClassLoader.java
(。。。HARD。。。)
· org/eclipse/equinox/servletbridge/FrameworkLauncher.java
對(duì)插件的部署,啟動(dòng),extensionbundle的創(chuàng)建/更新
2、當(dāng)然,能讓我們的導(dǎo)出工作如此輕松,warproduct居功至偉啊!warproduct是一個(gè)精簡(jiǎn)版的PDE-product的實(shí)現(xiàn),在PDE-product的基礎(chǔ)上實(shí)現(xiàn)自定義校驗(yàn)和添加了library的功能,以及實(shí)現(xiàn)自己的導(dǎo)出功能。(使用Ant導(dǎo)出的文章http://www.ibm.com/developerworks/cn/web/wa-rcprap/index.html
現(xiàn)在的版本都是使用warproduct,找了老久才找到一個(gè)老版本的[rold1]),封裝了如下的功能:
+ org.eclipse.equinox.http.servletbridge [s1] + tomcat 的功能相當(dāng)于org.eclipse.equinox.http.jetty
s1: equinox source
http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/
s2: warproducts demo
https://github.com/hstaudacher/org.eclipse.rap.build.examples/tree/master/warproducts
s3: example
http://winse.iteye.com/blog/1601916
r1: RAP/Equinox WAR products
http://wiki.eclipse.org/RAP/Equinox_WAR_products
http://download.eclipsesource.com/~hstaudacher/warproducts/3.7
http://eclipse.org/rap/developers-guide/devguide.php?topic=advanced/deployment.html&version=1.5
http://eclipsesource.com/blogs/2011/02/02/equinoxrap-war-products-has-moved-hello-eclipse-libra/
http://eclipsesource.com/blogs/2011/02/07/how-to-build-a-server-side-equinoxrap-application/
http://eclipsesource.com/blogs/2009/08/15/building-your-equinox-based-appserver-part-1/
rold1: webappbuilder
r2: Equinox in a Servlet Container
http://www.eclipse.org/equinox/server/
http://www.eclipse.org/equinox/server/http_in_container.php
聯(lián)系客服