<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 1  文章 - 37  trackbacks - 0
    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    留言簿(16)

    隨筆分類(lèi)

    隨筆檔案

    文章分類(lèi)

    文章檔案

    test

    搜索

    •  

    最新評(píng)論

    關(guān)于作者
          The author of this article is co-author of the book "Struts Best Practices" published in German (2004) and French (Feb 2005). He has been working with Java n-tier web since 1998, including SilverStream appserver, before the advent of OS and J2EE. His company, Infonoia SA is editor of multi-platform, multi-repository software and solutions around document retrieval and publishing. Infonoia also provides consulting services, mentoring and training (English, French, German) on Best Practices in the web technologies and frameworks they use, such as Struts, Eclipse and RSP. Wolfgang is also available for speaking engagements on RSP. Wolfgang can be reached at wgehner at infonoia dot com.

    關(guān)于本文
          這篇文章將會(huì)分成兩個(gè)部分通過(guò)分析一個(gè)實(shí)例去分析如果使用OSGI構(gòu)建一個(gè)WEB應(yīng)用。
            第一個(gè)部分只是簡(jiǎn)單的介紹了如何在應(yīng)用中創(chuàng)建擴(kuò)展點(diǎn)(extension points),第二部分將通過(guò)映射你自己的Servlet和依賴關(guān)系使其能夠作為一個(gè)新的Web應(yīng)用運(yùn)行

    Extensions and Extension points
          在RSP Samples里面的每個(gè)Bundle目錄中都有一個(gè) plugin.xml,這里面所配置的 Extension 和 Extension point讓這些URL和Resource能夠被訪問(wèn)到,它為各個(gè)Bundle間的協(xié)作提供了一個(gè)通道。(個(gè)人感覺(jué)這里所說(shuō)的擴(kuò)展和擴(kuò)展點(diǎn)有點(diǎn)像Spring AOP里面的 Advice 和 Pointcut),
          OSGI-R4規(guī)范中提供了Declarative Services (簡(jiǎn)稱(chēng)DS)機(jī)制,關(guān)于DS的詳細(xì)介紹請(qǐng)查閱 BlueDavy 的Opendoc.

          用Plug-in Manifest Editor打開(kāi)org.rsp.framework.struts中的Plugin.xml,進(jìn)入 Extensions 面板,可以看到這個(gè)Bundle使用了3種Equinox的Extension(看字面意思就能知道這3種Extension是做什么用的),再進(jìn)入 Extension points面板,沒(méi)有發(fā)現(xiàn)該Bundle提供任何擴(kuò)展點(diǎn)(Extension points),分析一下具體配置.
     1<?xml version="1.0" encoding="UTF-8"?>
     2<?eclipse version="3.0"?>
     3<plugin>
     4    <extension id="myservletID" name="myservletName" point="org.eclipse.equinox.servlet.ext.servlets">
     5        <alias>/do</alias>
     6        <servlet-class>org.rsp.framework.struts.base.BundleActionServlet</servlet-class>
     7        <init-param>
     8            <param-name>config</param-name>
     9            <param-value>*/WEB-INF/struts-config.xml</param-value>            
    10        </init-param>        
    11        <init-param>
    12            <param-name>chainConfig</param-name>
    13            <param-value>*/WEB-INF/chain-config.xml</param-value>            
    14        </init-param>
    15        <httpcontext-name>cross-context</httpcontext-name>
    16    </extension>
    17
    18    <extension id="myservletID3" name="myservletName3" point="org.eclipse.equinox.servlet.ext.servlets">
    19        <alias>/struts/strutstest.jsp</alias>
    20        <servlet-class>org.rsp.framework.struts.strutstest_jsp</servlet-class>
    21        <httpcontext-name>cross-context</httpcontext-name>
    22    </extension>
    23
    24    <extension id="testResource" point="org.eclipse.equinox.servlet.ext.resources">
    25        <alias>/struts</alias>
    26        <base-name>/</base-name>
    27        <httpcontext-name>cross-context</httpcontext-name>
    28    </extension>
    29     
    30    <extension point="org.eclipse.equinox.servlet.ext.httpcontexts">
    31        <path>/WebContent</path>
    32        <httpcontext-name>cross-context</httpcontext-name>
    33    </extension>
    34 
    35</plugin>

    第4-16行,擴(kuò)展了org.eclipse.equinox.servlet.ext.servlets,也就是說(shuō)/do路徑下的URL都交給org.rsp.framework.struts.base.BundleActionServlet去處理
    第18-22行,將/struts/strutstest.jsp 交給 org.rsp.framework.struts.strutstest_jsp去處理
    第24-28行,資源路徑的映射
    第30-33行,Context映射


    The structure of servlet "extension points" is similar, but not quite identical to what you would find in a web.xml . replaces and is new. The OSGi standard specifies that each HTTP service (used by the BridgeServlet , under the hood) uses a different ServletContext * unless the HttpContext is shared*. This could create problems in case of MVC forwards, where usually certain information is passed from the first servlet to the second via the request context. That transport would be broken under Eclipse-OSGi if different or "null" HttpContexts are used among the related servlets. The trick is to give all servlets and resources the same " httpcontext-name ". The name of our choice is "cross-context" (alluding to the Tomcat server.xml attribute as in cross-context="true" , which does similar things but across web applications.). 

    同理,資源映射也是如此     

    本文翻譯到此已經(jīng)基本告一段落,原文后面的內(nèi)容都是基本操作,而本文宗旨就是對(duì)OSGI的Web應(yīng)用有個(gè)大概的了解,這個(gè)目的已經(jīng)達(dá)到了。

    結(jié)束語(yǔ)

    偶爾從Google上搜索到了這篇文章,感覺(jué)對(duì)像我這樣的OSGI初學(xué)者很有用,于是將其意思整理了一下,帖在BLOG上,希望能對(duì)路過(guò)的OSGI愛(ài)好者有所幫助。
    如果想更好的理解作者的意圖,建議看原文。
    歡迎大家通過(guò)郵箱
    osgi.phrancol@gmail.com與我討論有關(guān)OSGI的話題。

    作者針對(duì)原文開(kāi)的討論帖 , [點(diǎn)擊這里]
    Spring-osgi首頁(yè)有個(gè)OSGI視頻課程,值得一看 [
    點(diǎn)擊這里]
    BlueDavy的BLOG [
    點(diǎn)擊這里]
    Equinox in a Servlet Container
    Developing Eclipse/OSGi Web Applications Part 1 
    Developing Eclipse/OSGi Web Applications Part 2

    posted on 2007-08-30 11:05 Phrancol Yang 閱讀(2519) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): OSGI
    主站蜘蛛池模板: 日韩大片免费观看视频播放| 亚洲中文无码a∨在线观看| 爱情岛论坛亚洲品质自拍视频网站| 24小时日本在线www免费的| 亚洲最大在线观看| 18禁止观看免费私人影院| 亚洲午夜久久久久久尤物| 国产成人精品免费视频大全麻豆| 亚洲免费网站在线观看| 影音先锋在线免费观看| 朝桐光亚洲专区在线中文字幕| 亚洲精品无码专区2| 在线观看免费视频网站色| 亚洲av综合色区| 亚洲一级免费视频| 中文字幕无码精品亚洲资源网久久| 九九九精品成人免费视频| 亚洲精品无码aⅴ中文字幕蜜桃| 国产免费拔擦拔擦8x| 亚洲一级片免费看| 亚洲综合无码一区二区| 国产1024精品视频专区免费| 亚洲成a人片在线观看天堂无码| 亚洲av区一区二区三| 中文字幕手机在线免费看电影| 久久夜色精品国产亚洲| 亚洲成年人免费网站| 亚洲国产无线乱码在线观看| 亚洲精品国产综合久久一线| 99精品一区二区免费视频| 国产成人亚洲综合网站不卡| 亚洲精品国产日韩无码AV永久免费网 | 精品多毛少妇人妻AV免费久久| 亚洲av永久无码精品国产精品| 国产精品成人观看视频免费| 在线观看亚洲免费视频| 亚洲va无码va在线va天堂| 性盈盈影院免费视频观看在线一区| www免费黄色网| 亚洲1区1区3区4区产品乱码芒果 | 成年女人免费视频播放77777|