小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

OSGi應(yīng)用發(fā)布到tomcat

 Baruch 2017-08-28

 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容器中。

 

1 環(huán)境準(zhǔn)備(或rap1.5):

servletbridge相關(guān)插件[s1]

  • org.eclipse.equinox.http.servletbridge_1.0.300.v20120522-2049.jar
  • org.eclipse.equinox.servletbridge.extensionbundle_1.2.100.v20120522-2049
  • org.eclipse.equinox.servletbridge_1.2.200.v20120522-2049(需打包成servletbridge.jar

warproduct相關(guān)插件[s2](0.2.2.201212132117)

  • /org.eclipse.libra.warproducts.core
  • /org.eclipse.libra.warproducts.ui

2 打包部署到tomcat

1) 集成到tomcat容器中,得去掉就javax.servlet Plugin的依賴。需要修改:插件中對(duì)于javax.servlet插件的引用,修改為package的方式添加依賴。



 

2) 在已經(jīng)可以運(yùn)行的product的基礎(chǔ)上 [s3],新建warproduct導(dǎo)出為war [r1]。(后面的就不用講了,和部署其他war是一樣的)

  • 下載demo.zip,然后導(dǎo)入eclipse
  • 打開/sample.server/server-web.product文件,運(yùn)行'Launch an Eclipse application'
  • 新建warproduct,選擇'Use a launch configuration'-'server-web.product'(warproduct插件的安裝參考[r1]的鏈接)
  • 需要添加servletbridge.jar的library
  • 導(dǎo)出成war,然后放置到tomcat/webapp目錄下即可。(web.xml & launch.ini會(huì)同時(shí)導(dǎo)出)


 

3 到底發(fā)生了什么

 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]),封裝了如下的功能:

  • 去掉對(duì)jetty的依賴
  • 同時(shí)添加servletbridge相關(guān)插件和jar的校驗(yàn)
  • 過濾javax.servlet插件依賴錯(cuò)誤的提示。
Org.eclipse.libra.warproducts.core.validation.validator代碼  收藏代碼
  1. public static final String SERVLET_BRIDGE_ID   
  2.   = 'org.eclipse.equinox.servletbridge'; //$NON-NLS-1$  
  3.   
  4. public static final String[] BANNED_BUNDLES = new String[] {   
  5.   'javax.servlet', //$NON-NLS-1$  
  6.   'org.eclipse.update.configurator',  //$NON-NLS-1$  
  7.   'org.eclipse.equinox.http.jetty',  //$NON-NLS-1$  
  8.   'org.mortbay.jetty.server',  //$NON-NLS-1$  
  9.   'org.mortbay.jetty.util'  //$NON-NLS-1$  
  10. };  
  11.   
  12. public static final String[] REQUIRED_BUNDLES = new String[] {   
  13.   'org.eclipse.equinox.servletbridge.extensionbundle', //$NON-NLS-1$  
  14.   'org.eclipse.equinox.http.registry', //$NON-NLS-1$  
  15.   'org.eclipse.equinox.registry', //$NON-NLS-1$  
  16.   'org.eclipse.equinox.http.servlet', //$NON-NLS-1$  
  17.   'org.eclipse.equinox.http.servletbridge' //$NON-NLS-1$  
  18. };  
public static final String SERVLET_BRIDGE_ID = 'org.eclipse.equinox.servletbridge'; //$NON-NLS-1$ public static final String[] BANNED_BUNDLES = new String[] { 'javax.servlet', //$NON-NLS-1$ 'org.eclipse.update.configurator', //$NON-NLS-1$ 'org.eclipse.equinox.http.jetty', //$NON-NLS-1$ 'org.mortbay.jetty.server', //$NON-NLS-1$ 'org.mortbay.jetty.util' //$NON-NLS-1$ }; public static final String[] REQUIRED_BUNDLES = new String[] { 'org.eclipse.equinox.servletbridge.extensionbundle', //$NON-NLS-1$ 'org.eclipse.equinox.http.registry', //$NON-NLS-1$ 'org.eclipse.equinox.registry', //$NON-NLS-1$ 'org.eclipse.equinox.http.servlet', //$NON-NLS-1$ 'org.eclipse.equinox.http.servletbridge' //$NON-NLS-1$ };

  + org.eclipse.equinox.http.servletbridge [s1] + tomcat 的功能相當(dāng)于org.eclipse.equinox.http.jetty

 

源碼Source

s1: equinox source

http://git./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./blog/1601916 

 

參考:

r1: RAP/Equinox WAR products

http://wiki./RAP/Equinox_WAR_products

http://download./~hstaudacher/warproducts/3.7

http:///rap/developers-guide/devguide.php?topic=advanced/deployment.html&version=1.5

 

http:///blogs/2011/02/02/equinoxrap-war-products-has-moved-hello-eclipse-libra/

http:///blogs/2011/02/07/how-to-build-a-server-side-equinoxrap-application/

http:///blogs/2009/08/15/building-your-equinox-based-appserver-part-1/

 

rold1: webappbuilder

http:///blogs/2007/12/07/rap-deployment-part-2-deploying-your-application-as-a-war-file/

http://help./galileo/index.jsp?topic=/org.eclipse.rap.help/help/html/advanced/deployment.html

寫道
the script/webappBuilder.xml of the org.eclipse.rap.demo.feature.

 

r2:  Equinox in a Servlet Container

http://www./equinox/server/

http://www./equinox/server/http_in_container.php

 

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多