Java 网络加载协议 (JNLP)

编写:徐建祥(netpirate@gmail.com)

时间:2006-03-09 01:15

来自:http://www.anymobile.org

 

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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值