This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Web application Archive creation

Documents for the development of and with JVx.

Web application Archive creation

Postby Development@SIB » Tue Sep 06, 2011 6:36 pm

To install/deploy an application, we recommend the creation of a Web application archive (WAR). This archive type is supported by all major application servers.


How is the archive structured?

<application>.war
..
|- jvxclient.jar
|- <application classes and resources (src.client)>.jar
|- <all shared libs (libs/*.jar)>
|- <all client libs (libs/client/*.jar)>
|- index.html
|- [index_applet.jnlp]
|- [applet.jnlp]
|- [application.jnlp]
|- [favicon.ico]
/- [help]
/- WEB-INF
..
|- web.xml
/- lib
..
|- jvx.jar
|- <application classes and resources (src.server)>.jar
|- <all shared libs (libs/*.jar)>
|- <all server libs (libs/server/*.jar)>
/- rad
..
/- apps
..
/- <your apps>
/- server
..
|- config.xml


A Deployment Descriptor (web.xml) example is available here.

If you launch an application via Webstart, the optional jnlp files must also be included in the archive.

As start page (index.html) you could use the start page from our Showcase Application.

Code: Select all
<html>
  <head>
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <title>Showcase Application</title>
  </head>
  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" scroll="no">

    <script language="JavaScript" type="text/javascript">
    <!--
      var attributes = {'width':'100\%',
                        'height':'100\%',
                        'align':'top',
                        'vspace':'0',
                        'hspace':'0'};
      var parameters = {'codebase':'.',
                        'code':'com.sibvisions.rad.ui.swing.impl.SwingApplet',
                        'archive':'jvxclient.jar, showcase.jar, jfreechart-1.0.13.jar, jcommon-1.0.16.jar',
                        'name':'Showcase Application',
                        'mayscript':'true',
                        'scriptable':'true',
                        'main':'com.sibvisions.apps.showcase.Showcase',
                        'config':'/com/sibvisions/apps/showcase/application.xml',
                        'Application.connectionClass':'com.sibvisions.rad.remote.http.HttpConnection'};

      var doc = '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ' +
                        'codebase="http://java.sun.com/update/1.6.0/jinstall-6u20-windows-i586.cab#Version=6,0,0,2"';
      for (var attribute in attributes) {
        doc += (' ' + attribute + '="' + attributes[attribute] + '"');
      }
      doc += '>';
      for (var parameter in parameters) {
        doc += '<param name="' + parameter + '" value="' + parameters[parameter] + '">';
      }
      doc += '<embed type="application/x-java-applet"';
      for (var attribute in attributes) {
        doc += (' ' + attribute + '="' + attributes[attribute] + '"');
      }
      for (var parameter in parameters) {
        doc += (' ' + parameter + '="' + parameters[parameter] + '"');
      }
      doc += '></embed>';
      doc += '</object>';

      document.writeln(doc);
    //-->
    </script>

  </body>
</html>

If you use the parameter jnlp_href, don't forget to increase the version number before every deployment. This is important for automatic client updates.

The used applet.jnlp file

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<jnlp
  spec="1.0+"
  codebase="http://servername/showcase">
  <information>
    <title>Showcase Application</title>
    <vendor>SIB Visions GmbH</vendor>
    <description>Showcase Application</description>
    <description kind="short">Showcase Application</description>
  </information>
  <resources>
    <j2se version="1.5+"/>
    <jar href="jvxclient.jar" main="true"/>
    <jar href="showcase.jar"/>
    <jar href="jfreechart-1.0.13.jar"/>
    <jar href="jcommon-1.0.16.jar"/>
  </resources>
  <applet-desc
    name="Showcase Application"
    main-class="com.sibvisions.rad.ui.swing.impl.SwingApplet"
    width="1024"
    height="768">
    <param name="main" value="com.sibvisions.apps.showcase.Showcase"/>
    <param name="config" value="/com/sibvisions/apps/showcase/application.xml"/>
    <param name="Application.connectionClass" value="com.sibvisions.rad.remote.http.HttpConnection"/>
    <param name="Application.Menu.exit.visible" value="false"/>
  </applet-desc>
</jnlp>


The download also contains examples for Webstart (jnlp).
User avatar
Development@SIB
 
Posts: 325
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation