Home
Categories
Dictionary
Download
Project Details
Changes Log
Who We Are
FAQ
License

Applet



The Server in the Swing framework can be run as an Applet to be integrated in a browser.

Signing the jar files

To be able to use the Applet in a browser, you will have to sign all the Jar files used in the Server application. To achieve this, there are several tasks in the ant build:
  • genKey and deleteKey to generate and delete a key[1]
    Note that self-signed Applets are blocked by default in current Web browsers. See also Browser Applet support more generally for browser Applets support
  • sign to sign the jar files

Example

The following html page will show a Server integrated in a Web page:
      <HTML>
         <TITLE>
      Applet Example
         </TITLE>
         <BODY>
            <APPLET CODE="arinc661.server.swing.ServerApplet.class" ARCHIVE="swingServer.jar" WIDTH="500" HEIGHT="500">
               <PARAM NAME="server.config" VALUE="arinc.properties" />
            </APPLET>
         </BODY>
      </HTML>
The result will look like this in the Applet Viewer for example:
applet
The arinc.properties configuration must point to a SuperLayer configuration, for example:
      graphics=DefGraphics.xml
      ui=LookAndFeel.xml
      pictures=DefPictures.xml
      lf=metal
      supplement=4
      serverInputPort=8080
      serverOutputPort=8081
      serverInputSize=50000
      serverOutputSize=200
      server.autoConnect=false
      windowManager=windows
      server.windows=simpleWindow.xml
      server.autoVisible=true

Applets limitations

Applets are by default executed in a much stricter security context than regular Java applications. For example:
  • All the jar files used in an Applet must be signed[2] . Also it is better to not use "self-signed" certificates[3]
  • There are a lot of security limitations on Applets, for example:
    • Calling System.getProperty("user.dir") or System.getProperty("java.io.tmpdir")is not allowed
    • Accessing by reflection private flags of classes is not allowed[4]
      This means for example that using the Server Container Swing Offset behavior flag is mandatory to avoid using in Swing the default behavior accessing a private JComponent flag
  • The Applet mechanism only works with the Swing framework
  • There are other specificities for Applets. For example:
    • An Applet can be closed if the Web page is closed, and then reopened, whereas in the normal case a Server Window would never be reopened
    • A Server Window is shown in a specified Window (the Applet Window) rather than its own Window. This means that the Server Applet will use a specific capability in the SuperLayer Window Manager allowing to paint the content of one Display in a specified Container[5]
      In this case, the container of the Applet

Browser Applet support

Browser Applet support

You should note that browser support for Java Applets, and more generally for the NPAPI[6]
or Netscape Plugin Application Programming
technology which enables Web Plugins and is used by Applets, will be discontinued soon in browsers[7]
Google Chrome discontinued support for NPAPI in 2015, Opera in May 2016, and Firefox plan to drop support for NPAPI end of 2016
[8] [9]

Notes

  1. ^ Note that self-signed Applets are blocked by default in current Web browsers. See also Browser Applet support more generally for browser Applets support
  2. ^ Understanding signing and verification.Oracle
  3. ^ Signing Applets using RSA certificates.Oracle
  4. ^ This means for example that using the Server Container Swing Offset behavior flag is mandatory to avoid using in Swing the default behavior accessing a private JComponent flag
  5. ^ In this case, the container of the Applet
  6. ^ or Netscape Plugin Application Programming
  7. ^ Google Chrome discontinued support for NPAPI in 2015, Opera in May 2016, and Firefox plan to drop support for NPAPI end of 2016
  8. ^ Moving to a Plugin free Web.Oracle. 2016-01-27
  9. ^ Migrating from Applets to Plugin free Java technologies.Oracle. 2016-01-27

See also


Categories: dev | server | swing | user

Copyright 2016-2017 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v2 licence