隨筆-1  評(píng)論-68  文章-98  trackbacks-0
          Java 網(wǎng)絡(luò)加載協(xié)議 (JNLP): 是 Java Web Start 的一個(gè)組成協(xié)議,通常定義為一種通過網(wǎng)絡(luò)并穿透防火墻傳輸駐留于服務(wù)器的應(yīng)用程序、并在客戶機(jī)上啟動(dòng)它的機(jī)制。

          Java(TM) Web Start:是一種簡(jiǎn)化 Java 應(yīng)用程序部署的技術(shù),讓用戶不需要復(fù)雜的安裝過程,單擊 Web 瀏覽器就可以啟動(dòng)全功能的應(yīng)用程序。J2SE 捆綁了 Java Web Start。

          D/S結(jié)構(gòu)(Destktop Application/Server Application):客戶端使用Swing,服務(wù)器端使用Servlet,采用Swing 和 Servlet來交換數(shù)據(jù),可以采用標(biāo)準(zhǔn)的HTTP協(xié)議來通訊,來交換數(shù)據(jù)。

          JNLP 文件其實(shí)是一個(gè)xml文件,描述了產(chǎn)品信息,使用的jar文件網(wǎng)址和 main-class 定義等。
          客戶端點(diǎn)擊 JNLP 文件的連接,就會(huì)激活本地的 Java Web Start,選擇下載 jar 包后,下載完備就可以運(yùn)行相關(guān)的程序。可以操作本地?cái)?shù)據(jù),其實(shí)是把 jar 包下載到本地(每次允許都會(huì)自動(dòng)更新),調(diào)用遠(yuǎn)程的 servlet 來交互數(shù)據(jù)。

          樣例 JClaim 的jclaimsf.jnlp 代碼清單:

          <?xml version="1.0" encoding="utf-8"?> 
          <!--
            ~ Copyright (c) 2006, ITBS LLC. All Rights Reserved.
            ~
            ~     This file is part of JClaim.
            ~
            ~     JClaim is free software; you can redistribute it and/or modify
            ~     it under the terms of the GNU General Public License as published by
            ~     the Free Software Foundation; version 2 of the License.
            ~
            ~     JClaim is distributed in the hope that it will be useful,
            ~     but WITHOUT ANY WARRANTY; without even the implied warranty of
            ~     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
            ~     GNU General Public License for more details.
            ~
            ~     You should have received a copy of the GNU General Public License
            ~     along with JClaim; if not, find it at gnu.org or write to the Free Software
            ~     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
            ~
            
          -->

          <jnlp
            
          spec="1.0+" 
            codebase
          ="http://jclaim.sourceforge.net"
            href
          ="/jclaimsf.jnlp"
            
          >
            
          <information> 
              
          <title>JCLAIM</title> 
              
          <vendor>ITBS LLC</vendor> 
              
          <description>Java Compliant Logging and Auditing Instant Messenger.</description> 
              
          <description kind="short">JCLAIM</description> 
              
          <icon href="/logo.gif"/>
            
          </information> 
            
          <security> 
              
          <all-permissions/> 
            
          </security> 
            
          <resources>     
              
          <j2se version="1.5" max-heap-size="25m"/>
              
          <jar href="jclaim.jar" main="true"/>  
              
          <jar href="cos.jar" />  
              
          <jar href="jaimlib.jar" />  
              
          <jar href="jazzy.jar" />  
              
          <jar href="jdic.jar" />  
              
          <jar href="joscar.jar" />  
              
          <jar href="jsocks.jar" />  
              
          <jar href="msnm.jar" />  
              
          <jar href="oscar.jar" />  
              
          <jar href="smack.jar" />  
              
          <jar href="ymsg.jar" />  
            
          </resources> 
            
          <resources os="Mac">
               
          <jar         href="lib/mac/jdic_misc.jar"/> 
            
          </resources>
            
          <resources os="Windows">
               
          <jar         href="lib/win32/jdic_misc.jar"/> 
               
          <jar         href="lib/win32/jdic_stub.jar"/> 
               
          <nativelib   href="lib/win32/native.jar"/>
             
          </resources>
             
          <resources os="Linux">
                 
          <jar       href="lib/linux/jdic_stub.jar"/> 
               
          <nativelib   href="lib/linux/native.jar"/>
             
          </resources>
             
          <resources os="SunOS" arch="x86">
                
          <jar        href="lib/sunos/jdic_stub.jar"/> 
               
          <nativelib   href="lib/sunos/native.jar"/>
             
          </resources>
             
          <resources os="SunOS" arch="sparc">
                
          <jar        href="lib/sunos/jdic_stub.jar"/> 
               
          <nativelib   href="lib/sunos/native.jar"/>
             
          </resources>

            
          <application-desc main-class="com.itbs.aimcer.gui.Main">   
            
          </application-desc>
          </jnlp> 

          資源:

          Java Web Start http://java.sun.com/products/javawebstart/developers.html
          動(dòng)態(tài) JNLP https://www6.software.ibm.com/developerworks/cn/education/java/j-dynjnlp/tutorial/j-dynjnlp-1-1.html
          posted on 2006-03-09 01:15 Xu Jianxiang 閱讀(2557) 評(píng)論(1)  編輯  收藏 所屬分類: Java Tech

          評(píng)論:
          # re: Java 網(wǎng)絡(luò)加載協(xié)議 (JNLP) 2007-03-29 14:21 | jaly
          這句是不是有些問題:<nativelib href="lib/win32/native.jar"/>
          在JDIC官方網(wǎng)上有這么一句話:
          NOTE: the native jar file name must be jdic-native.jar. Since the application needs to retrieve the native files after the jar file is unjar'ed by Java Web Start.

          請(qǐng)樓主再測(cè)試一下。  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 浦县| 翁源县| 女性| 喀喇沁旗| 富锦市| 固原市| 玉林市| 金平| 东安县| 巧家县| 香港 | 克山县| 密云县| 邵武市| 上蔡县| 望城县| 施秉县| 三穗县| 道真| 仪陇县| 营山县| 云和县| 江都市| 扎鲁特旗| 岳西县| 吴桥县| 葵青区| 兴义市| 东山县| 工布江达县| 文昌市| 衡山县| 巍山| 漳平市| 大新县| 略阳县| 峨山| 望都县| 延吉市| 株洲市| 宜良县|