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

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

          D/S結構(Destktop Application/Server Application):客戶端使用Swing,服務器端使用Servlet,采用Swing 和 Servlet來交換數據,可以采用標準的HTTP協議來通訊,來交換數據。

          JNLP 文件其實是一個xml文件,描述了產品信息,使用的jar文件網址和 main-class 定義等。
          客戶端點擊 JNLP 文件的連接,就會激活本地的 Java Web Start,選擇下載 jar 包后,下載完備就可以運行相關的程序。可以操作本地數據,其實是把 jar 包下載到本地(每次允許都會自動更新),調用遠程的 servlet 來交互數據。

          樣例 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
          動態 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) 評論(1)  編輯  收藏 所屬分類: Java Tech

          評論:
          # re: Java 網絡加載協議 (JNLP) 2007-03-29 14:21 | jaly
          這句是不是有些問題:<nativelib href="lib/win32/native.jar"/>
          在JDIC官方網上有這么一句話:
          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.

          請樓主再測試一下。  回復  更多評論
            
          主站蜘蛛池模板: 定南县| 锦州市| 北碚区| 依兰县| 呼伦贝尔市| 友谊县| 临颍县| 德江县| 左权县| 海门市| 婺源县| 喀什市| 康马县| 合山市| 衡阳市| 平南县| 新野县| 静安区| 出国| 万盛区| 滨州市| 额尔古纳市| 尚义县| 平果县| 上饶县| 乌苏市| 嘉定区| 甘德县| 吉首市| 隆尧县| 交城县| 新宁县| 玛多县| 白城市| 吴川市| 万宁市| 博客| 九台市| 松江区| 深圳市| 浏阳市|