国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
關(guān)于Liferay的配置文件 —— 基于Struts開發(fā)Portlet
http://hi.baidu.com/fly5099/blog/item/ed25934def40d3f1d62afc52.html
 
結(jié)合Liferay實例sample-struts-portlet,基于Struts開發(fā)Portlet一般具有以下配置文件:
  • liferay-display.xml
  • liferay-portlet.xml
  • portlet.xml
  • struts-config.xml
  • tiles-defs.xml
  • web.xml

 


(1)liferay-display.xml (定義Portal 中Portlet 管理的目錄結(jié)構(gòu))
        配置在Portlet 的顯示名稱,以及該portlet 在顯示列表中所在的目錄。值得注意的是該處并沒有直接給出在Portlet 顯示列表中的顯示名字,而是給出了Portlet ID,根據(jù)在porlet.xml 中portlet ID與Name 的關(guān)聯(lián),可得到該Portlet 的顯示名字。

        <display>
        <category name="category.test">
            <portlet id="sample_struts_portlet" />
            </category>
        </display>

        效果:添加porlet 內(nèi)容時,也就是在點擊“add content” 時,名叫sample_struts_portlet 的portlet 將在目錄中的test 項下顯示。

(2)liferay-portlet.xml (定義基于Liferay Portal 下的Portlet 的特有屬性)
    該配置文件定義portlet 屬性和角色,該配置文件對基于JSR168的 portlet.xml 的屬性進行擴展。

    <liferay-portlet-app>
        <portlet>
            <!-- 配置portlet 名,該名應(yīng)對應(yīng)于liferay-display.xml 中portlet 的id 屬性 -->
            <portlet-name>sample_struts_portlet</portlet-name>
            <!-- 配置portlet 的實現(xiàn)類,該類響應(yīng)該portlet 的請求,實現(xiàn)功能 -->
            <portlet-url-class>
                  com.liferay.portal.apache.bridges.struts.LiferayStrutsPortletURLImpl
        </portlet-url-class>

          <use-default-template>true</use-default-template>
          <restore-current-view>true</restore-current-view>
      </portlet>
        <!-- 配置該portlet 的角色,以及角色的顯示名字,角色名role-name 是由portlet.xml 中進行定義 -->
        <role-mapper>
            <role-name>administrator</role-name>
          <role-link>Administrator</role-link>
      </role-mapper>
        <role-mapper>
            <role-name>guest</role-name>
            <role-link>Guest</role-link>
        </role-mapper>
        <role-mapper>
            <role-name>power-user</role-name>
            <role-link>Power User</role-link>
        </role-mapper>
        <role-mapper>
            <role-name>user</role-name>
            <role-link>User</role-link>
        </role-mapper>
    </liferay-portlet-app>

    效果:該portlet 由com.liferay.portal.apache.bridges.struts.LiferayStrutsPortletURLImpl 類的實例進行處理,允許使用模版和實時刷新頁面??膳渲胊dministrator,guest,power-user,user 四種角色對其擁有不同的權(quán)限。

(3)portlet.xml (Portlet 的標(biāo)準(zhǔn)屬性,該配置文件中的各項屬性符合JSR168 標(biāo)準(zhǔn),并非Liferay專用)
       該配置文件設(shè)置Portlet的各個屬性,該各項屬性在Portlet初始化時得以加載。

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">

    <portlet>
        <portlet-name>sample_struts_portlet</portlet-name>

       <!-- display-name 即為該Portlet顯示的名字,liferay-display.xml 中配置了Portlet id,關(guān)聯(lián)該配置文件可找到其顯示的名字,如下“Sample Struts Portlet" -->
        <display-name>Sample Struts Portlet</display-name>

      
<!-- 由于在開發(fā)Portlet 時必須繼承Portlet 的基礎(chǔ)類,而此處是基于Struts 開發(fā)Portlet 時可繼承該類 -->
        <portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>
       
      
<!-- init-param 標(biāo)簽表示Portlet 的初始化參數(shù) ,由name 標(biāo)簽和 value 標(biāo)簽指明其名字和值的一對數(shù)據(jù) -->
        <init-param>
            <name>ServletContextProvider</name>
           
<!-- 其值為該Portlet 可接收響應(yīng)的URL或者類,URL 對應(yīng)的類是哪個由Struts-config.xml 定義-->
            <value>com.liferay.util.apache.bridges.struts.LiferayServletContextProviderWrapper</value>
        </init-param>
        <init-param>
            <name>EditPage</name>
            <value>/portlet_action/sample_struts_portlet/edit</value>
        </init-param>
        <init-param>
            <name>HelpPage</name>
            <value>/portlet_action/sample_struts_portlet/help</value>
        </init-param>
        <init-param>
            <name>ViewPage</name>
            <value>/portlet_action/sample_struts_portlet/view</value>
        </init-param>


        <expiration-cache>0</expiration-cache>

      
<!-- 定義該Portlet 所支持的功能,體現(xiàn)在每個Portlet 的展現(xiàn)模式 -->
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>edit</portlet-mode>
            <portlet-mode>help</portlet-mode>
        </supports>


        <portlet-info>
            <title>Sample Struts Portlet</title>
            <short-title>Sample Struts Portlet</short-title>
            <keywords>Sample Struts Portlet</keywords>
        </portlet-info>

       
<!-- 指明對該Portlet 可能擁有權(quán)限的角色,該角色定義決定了liferay-portlet.xml 所配置的角色名 -->
        <security-role-ref>
            <role-name>administrator</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>guest</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>power-user</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>user</role-name>
        </security-role-ref>
    </portlet>
</portlet-app>

效果:
定義了Portlet 的基本信息,展現(xiàn)方式,以及對該Portlet 可能分配權(quán)限的用戶角色。


(4)struts-config.xml (該配置文件為Struts 的配置文件,并非Liferay 專用)
<struts-config>

    <!-- Forms Beans -->
    <form-beans>
        <form-bean name="subscribeForm" type="com.sample.struts.struts.form.SubscribeForm" />
        <form-bean name="unsubscribeForm" type="com.sample.struts.struts.form.UnsubscribeForm" />
        <form-bean name="uploadForm" type="com.sample.struts.struts.form.UploadForm" />
    </form-beans>

    <!-- Action Mappings -->

    <action-mappings>

       <!-- Sample Struts -->

        <action path="/sample_struts_portlet/edit" forward="portlet.sample_struts_portlet.edit" />

        <action path="/sample_struts_portlet/help" forward="portlet.sample_struts_portlet.help" />

        <action path="/sample_struts_portlet/subscribe/action" type="com.sample.struts.struts.action.SubscribeAction" name="subscribeForm" scope="session" validate="true" input="portlet.sample_struts_portlet.subscribe">
            <forward name="/sample_struts_portlet/subscribe_success" path="/portlet_action/sample_struts_portlet/subscribe_success" redirect="true" />
        </action>

           <!--
            ……
            該處省略的雷同的設(shè)置代碼
             ……
      -->

    <!-- Custom Request Processor -->

    <controller processorClass="org.apache.portals.bridges.struts.PortletTilesRequestProcessor" />

    <!-- Message Resources -->

    <message-resources parameter="content.test.Language" />

    <!-- Tiles Plugin -->

    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
        <set-property property="moduleAware" value="true" />
        <set-property property="definitions-parser-validate" value="true" />
    </plug-in>

    <!-- Validator Plugin -->

    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
    </plug-in>
</struts-config>
效果:此處可與其它基于Struts 應(yīng)用開發(fā)同樣配置,與Liferay 相互獨立。


(5)tiles-defs.xml (該配置文件是利用Tile 進行頁面的布局管理,并非Liferay 專用)

<tiles-definitions>


   <!-- 關(guān)于頁面的布局定義,表示當(dāng)請求的Url為 portlet.sample_struts_portlet 則以路徑path參數(shù)指定的 /html/portlet/sample_struts_portlet/template.jsp 頁面進行響應(yīng)-->
    <definition name="portlet.sample_struts_portlet" path="/html/portlet/sample_struts_portlet/template.jsp" />
    <!-- 關(guān)于頁面的布局定義,表示名為 portlet.sample_struts_portlet.edit Url 的頁面嵌套頁面 /portlet/sample_struts_portlet/edit.jsp -->
    <definition name="portlet.sample_struts_portlet.edit" extends="portlet.sample_struts_portlet">
        <put name="portlet_content" value="/portlet/sample_struts_portlet/edit.jsp" />
    </definition>
   
    <!--
            ……
            該處省略的雷同的設(shè)置代碼
             ……
    -->

   
<tiles-definitions>
  
效果:此處可與其它基于Tiles 應(yīng)用開發(fā)同樣配置,與Liferay 相互獨立。


(6)web.xml (該配置文件為Tomcat 的應(yīng)用配置文件,并非Liferay 專用)
<web-app>
   <!-- 注意:此處的display-name與portlet.xml 中的display-name 含義不同,此處僅標(biāo)識在Tomcat 下的應(yīng)用編寫此不得與其它Portlet 和發(fā)布的其他應(yīng)用標(biāo)識重名 -->
    <display-name>sample-struts-portlet</display-name>

    <context-param>
        <param-name>company_id</param-name>
        <param-value>liferay.com</param-value>
    </context-param>

    <listener>
        <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class>
    </listener>

    <servlet>
        <servlet-name>sample_struts_portlet</servlet-name>
        <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
        <init-param>
            <param-name>portlet-class</param-name>
            <param-value>org.apache.portals.bridges.struts.StrutsPortlet</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>PortletActionServlet</servlet-name>
        <servlet-class>com.liferay.util.apache.bridges.struts.LiferayPortletServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>TestSessionServlet</servlet-name>
        <servlet-class>com.sample.struts.servlet.TestSessionServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>sample_struts_portlet</servlet-name>
        <url-pattern>/sample_struts_portlet/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>PortletActionServlet</servlet-name>
        <url-pattern>/portlet_action/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>TestSessionServlet</servlet-name>
        <url-pattern>/test_session/*</url-pattern>
    </servlet-mapping>

    <taglib>
        <taglib-uri>http://java.sun.com/portlet</taglib-uri>
        <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://struts.apache.org/tags-bean</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://portals.apache.org/bridges/struts/tags-portlet-html</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-portlet-html.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://struts.apache.org/tags-logic</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://struts.apache.org/tags-nested</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
    </taglib>
    <taglib>
        <taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
        <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
    </taglib>
</web-app>

效果:此處可與其它基于Tomcat 應(yīng)用開發(fā)同樣配置,但與Liferay 不完全獨立。
 
(#)
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Liferay簡單Struts Portlet開發(fā)
liferay二次開發(fā)指南
為Liferay開發(fā)Portlet - 玻璃瓶中的光明
portlet部署描述符
web.xml 中的listener、 filter、servlet 加載順序及其詳解
serverlet配置文件
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服