Reputation: 1686
I am not very familiar with java build tools such as Ant. We have an old java web start application and now with the new security requirements for RIAs I have to add a security tag to my build.xml But I can't figure out how to do it. I am using ant deploy to build my app. And I am also using ant-jnlp-war (I really can't figure out where this ant-jnlp-war is used) The relevant part of my build.xml is as the following:
<target name="pack" depends="buildinfo,dist,sign">
<jw:jnlpwar
tofile="${war}/lmc.war"
title="Company Management Console"
vendor="Company Teknoloji"
codebase="dummy"
signStorepass="secret"
signAlias="labris">
<jw:description>Company Management Console</jw:description>
<jw:description kind="short">LMC</jw:description>
<jw:shortcut desktop="true" menu="true" submenu="Company Management Console"/>
<jw:j2se minVersion="1.5" args="-Xmx128M" />
<lib dir="${dist}/lib">
<include name="**/*.jar"/>
<exclude name="client.jar"/>
</lib>
<lib dir="${dist}/modules">
<include name="**/*.jar"/>
</lib>
<jw:application mainclass="com.idealteknoloji.lmc.client.ClientManager" jar="${dist}/lib/client.jar"/>
</jw:jnlpwar>
<exec executable="./make-client-packages"/>
</target>
How and where can I add the security attribute as sandbox.
Upvotes: 4
Views: 1949
Reputation: 1199
Let's clarify...
Ant-jnlp-war just create war which allow you to distribute your application to clients and contains your jar that means that you should have jar before call ant-jnlp-war.
New security requirements for RIA related to jar because you need to specify in META-INF/MANIFEST.MF from which site application could be distributed:
Manifest Attributes
- Permissions – Introduced in 7u25, and required as of 7u51. Indicates if the RIA should run within the sandbox or require full-permissions.
- Codebase – Introduced in 7u25 and optional/encouraged as of 7u51. Points to the known location of the hosted code (e.g. intranet.example.com).
As we clarify you don't need to change ant-jnlp-war you just need to have correct MANIFEST.MF within your jar.
Here you have two options:
use Ant task to create MANIFEST.MF like and configure it, example:
<jar destfile="test.jar" basedir=".">
<include name="build"/>
<manifest>
<attribute name="Permissions" value="sandbox">
<attribute name="Codebase" value="example.com">
</manifest>
</jar>
create by hand MANIFEST.MF and put to your jar under folder META-INF
Manifest-Version: 1.0
Created-By: 1.7.0_51
Permissions: sandbox
Codebase: www.java.com
Upvotes: 2