public class JNLPFile
extends java.lang.Object
Provides methods to access the information in a Java Network Launching Protocol (JNLP) file. The Java Network Launching Protocol specifies in an XML file the information needed to load, cache, and run Java code over the network and in a secure environment.
This class represents the overall information about a JNLP file from the jnlp element. Other information is accessed through objects that represent the elements of a JNLP file (information, resources, application-desc, etc). References to these objects are obtained by calling the getInformation, getResources, getSecurity, etc methods.
Modifier and Type | Class and Description |
---|---|
static class |
JNLPFile.ManifestBoolean |
class |
JNLPFile.ManifestsAttributes |
Modifier and Type | Field and Description |
---|---|
protected java.net.URL |
codeBase
the URL used to resolve relative URLs in the file
|
protected ComponentDesc |
component
the component description
|
protected java.lang.String |
defaultArch
the default arch
|
protected java.util.Locale |
defaultLocale
the default JVM locale
|
protected java.lang.String |
defaultOS
the default OS
|
protected java.net.URL |
fileLocation
the network location of this JNLP file
|
protected Version |
fileVersion
file version
|
protected java.util.List<InformationDesc> |
info
information
|
protected LaunchDesc |
launchType
the application description
|
protected ParserSettings |
parserSettings
the ParserSettings which were used to parse this file
|
protected java.util.List<ResourcesDesc> |
resources
resources
|
protected SecurityDesc |
security
the security descriptor
|
protected ResourcesDesc |
sharedResources
additional resources not in JNLP file (from command line)
|
protected java.net.URL |
sourceLocation
the location this JNLP file was created from
|
protected Version |
specVersion
spec version
|
static java.lang.String |
TITLE_NOT_FOUND |
protected java.lang.String |
uniqueKey
A key that uniquely identifies connected instances (main jnlp+ext)
|
protected UpdateDesc |
update |
Modifier | Constructor and Description |
---|---|
protected |
JNLPFile()
Empty stub, allowing child classes to override the constructor
|
|
JNLPFile(java.io.InputStream input,
ParserSettings settings)
Create a JNLPFile from an input stream.
|
|
JNLPFile(java.io.InputStream input,
java.net.URL codebase,
ParserSettings settings)
Create a JNLPFile from an input stream.
|
|
JNLPFile(java.net.URL location)
Create a JNLPFile from a URL.
|
|
JNLPFile(java.net.URL location,
ParserSettings settings)
Create a JNLPFile from a URL checking for updates using the
default policy.
|
|
JNLPFile(java.net.URL location,
java.lang.String uniqueKey,
Version version,
ParserSettings settings,
UpdatePolicy policy)
Create a JNLPFile from a URL, parent URLm a version and checking for
updates using the specified policy.
|
|
JNLPFile(java.net.URL location,
Version version,
ParserSettings settings)
Create a JNLPFile from a URL and a Version checking for updates using
the default policy.
|
|
JNLPFile(java.net.URL location,
Version version,
ParserSettings settings,
UpdatePolicy policy)
Create a JNLPFile from a URL and a version, checking for updates
using the specified policy.
|
protected |
JNLPFile(java.net.URL location,
Version version,
ParserSettings settings,
UpdatePolicy policy,
java.net.URL forceCodebase)
Create a JNLPFile from a URL and a version, checking for updates
using the specified policy.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
createJnlpTitle() |
java.lang.String |
createJnlpTitleValue() |
java.lang.String |
createJnlpVendor() |
java.lang.String |
createJnlpVendorValue() |
AppletDesc |
getApplet() |
ApplicationDesc |
getApplication() |
java.net.URL |
getCodeBase() |
ComponentDesc |
getComponent() |
DownloadOptions |
getDownloadOptions() |
java.net.URL |
getFileLocation() |
Version |
getFileVersion() |
InformationDesc |
getInformation() |
InformationDesc |
getInformation(java.util.Locale locale) |
InstallerDesc |
getInstaller() |
LaunchDesc |
getLaunchInfo() |
JNLPFile.ManifestsAttributes |
getManifestsAttributes() |
java.util.List<java.lang.String> |
getNewVMArgs() |
java.net.URL |
getNotNullProbalbeCodeBase()
It is not recommended to use this method for internals of itw - use normal getCodeBase rather, as null is expected always except toString calls.
|
ParserSettings |
getParserSettings() |
SecurityDesc.RequestedPermissionLevel |
getRequestedPermissionLevel() |
ResourcesDesc |
getResources() |
ResourcesDesc |
getResources(java.util.Locale locale,
java.lang.String os,
java.lang.String arch) |
ResourcesDesc[] |
getResourcesDescs() |
ResourcesDesc[] |
getResourcesDescs(java.util.Locale locale,
java.lang.String os,
java.lang.String arch) |
SecurityDesc |
getSecurity() |
java.net.URL |
getSourceLocation() |
Version |
getSpecVersion() |
java.lang.String |
getTitle() |
java.lang.String |
getTitleFromJnlp() |
java.lang.String |
getTitleFromManifest() |
java.lang.String |
getUniqueKey() |
UpdateDesc |
getUpdate() |
java.lang.String |
getVendor() |
boolean |
isApplet() |
boolean |
isApplication() |
boolean |
isComponent() |
boolean |
isInstaller() |
boolean |
localeMatches(java.util.Locale requested,
java.util.Locale[] available,
net.sourceforge.jnlp.JNLPFile.Match matchLevel)
Returns whether a locale is matched by one of more other
locales.
|
boolean |
needsNewVM() |
static java.io.InputStream |
openURL(java.net.URL location,
Version version,
UpdatePolicy policy)
Open the jnlp file URL from the cache if there, otherwise
download to the cache.
|
boolean |
requiresSignedJNLPWarning()
Returns a boolean after determining if a signed JNLP warning should be
displayed in the 'More Information' panel.
|
void |
setDefaults(java.lang.String os,
java.lang.String arch,
java.util.Locale locale)
Sets the default view of the JNLP file returned by
getInformation, getResources, etc.
|
void |
setSignedJNLPAsMissing()
Informs that a signed JNLP file is missing in the main jar
|
protected java.net.URL sourceLocation
protected java.net.URL fileLocation
protected ParserSettings parserSettings
protected java.lang.String uniqueKey
protected java.net.URL codeBase
protected Version fileVersion
protected Version specVersion
protected java.util.List<InformationDesc> info
protected UpdateDesc update
protected java.util.List<ResourcesDesc> resources
protected ResourcesDesc sharedResources
protected LaunchDesc launchType
protected ComponentDesc component
protected SecurityDesc security
protected java.util.Locale defaultLocale
protected java.lang.String defaultOS
protected java.lang.String defaultArch
public static final java.lang.String TITLE_NOT_FOUND
protected JNLPFile()
public JNLPFile(java.net.URL location) throws java.io.IOException, ParseException
location
- the location of the JNLP filejava.io.IOException
- if an IO exception occurredParseException
- if the JNLP file was invalidpublic JNLPFile(java.net.URL location, ParserSettings settings) throws java.io.IOException, ParseException
location
- the location of the JNLP filesettings
- the parser settings to use while parsing the filejava.io.IOException
- if an IO exception occurredParseException
- if the JNLP file was invalidpublic JNLPFile(java.net.URL location, Version version, ParserSettings settings) throws java.io.IOException, ParseException
location
- the location of the JNLP fileversion
- the version of the JNLP filesettings
- the parser settings to use while parsing the filejava.io.IOException
- if an IO exception occurredParseException
- if the JNLP file was invalidpublic JNLPFile(java.net.URL location, Version version, ParserSettings settings, UpdatePolicy policy) throws java.io.IOException, ParseException
location
- the location of the JNLP fileversion
- the version of the JNLP filesettings
- the ParserSettings
to use when parsing the location
policy
- the update policyjava.io.IOException
- if an IO exception occurredParseException
- if the JNLP file was invalidprotected JNLPFile(java.net.URL location, Version version, ParserSettings settings, UpdatePolicy policy, java.net.URL forceCodebase) throws java.io.IOException, ParseException
location
- the location of the JNLP fileversion
- the version of the JNLP filesettings
- the parser settings to use while parsing the filepolicy
- the update policyforceCodebase
- codebase to use if not specified in JNLP file.java.io.IOException
- if an IO exception occurredParseException
- if the JNLP file was invalidpublic JNLPFile(java.net.URL location, java.lang.String uniqueKey, Version version, ParserSettings settings, UpdatePolicy policy) throws java.io.IOException, ParseException
location
- the location of the JNLP fileuniqueKey
- A string that uniquely identifies connected instancesversion
- the version of the JNLP filesettings
- the parser settings to use while parsing the filepolicy
- the update policyjava.io.IOException
- if an IO exception occurredParseException
- if the JNLP file was invalidpublic JNLPFile(java.io.InputStream input, ParserSettings settings) throws ParseException
input
- input stream from which create jnlp filesettings
- settings of parserParseException
- if the JNLP file was invalidpublic JNLPFile(java.io.InputStream input, java.net.URL codebase, ParserSettings settings) throws ParseException
input
- input stream of JNLP file.codebase
- codebase to use if not specified in JNLP file..settings
- the ParserSettings
to use when parsingParseException
- if the JNLP file was invalidpublic static java.io.InputStream openURL(java.net.URL location, Version version, UpdatePolicy policy) throws java.io.IOException
location
- of resource to openversion
- of resourcepolicy
- update policy of resourcejava.io.IOException
- if something goes wrongpublic java.lang.String getTitle()
public java.lang.String getTitleFromJnlp()
public java.lang.String getTitleFromManifest()
public java.lang.String getVendor()
public java.net.URL getSourceLocation()
public java.net.URL getFileLocation()
public java.lang.String getUniqueKey()
public ParserSettings getParserSettings()
public Version getFileVersion()
public Version getSpecVersion()
public java.net.URL getCodeBase()
public java.net.URL getNotNullProbalbeCodeBase()
public InformationDesc getInformation()
public InformationDesc getInformation(java.util.Locale locale)
locale
- preferred locale of informationspublic UpdateDesc getUpdate()
public SecurityDesc getSecurity()
public SecurityDesc.RequestedPermissionLevel getRequestedPermissionLevel()
public ResourcesDesc getResources()
public ResourcesDesc getResources(java.util.Locale locale, java.lang.String os, java.lang.String arch)
locale
- preferred locale of resourceos
- preferred os of resourcearch
- preferred arch of resourcepublic ResourcesDesc[] getResourcesDescs()
public ResourcesDesc[] getResourcesDescs(java.util.Locale locale, java.lang.String os, java.lang.String arch)
locale
- preferred locale of resourceos
- preferred os of resourcearch
- preferred arch of resourcepublic LaunchDesc getLaunchInfo()
public AppletDesc getApplet()
java.lang.UnsupportedOperationException
- if there is no applet informationpublic ApplicationDesc getApplication()
java.lang.UnsupportedOperationException
- if there is no application informationpublic ComponentDesc getComponent()
java.lang.UnsupportedOperationException
- if there is no component informationpublic InstallerDesc getInstaller()
java.lang.UnsupportedOperationException
- if there is no installer informationpublic boolean isApplet()
public boolean isApplication()
public boolean isComponent()
public boolean isInstaller()
public void setDefaults(java.lang.String os, java.lang.String arch, java.util.Locale locale)
os
- preferred os of resourcearch
- preferred arch of resourcelocale
- preferred locale of resourcepublic boolean localeMatches(java.util.Locale requested, java.util.Locale[] available, net.sourceforge.jnlp.JNLPFile.Match matchLevel)
requested
- the requested localeavailable
- the available localesmatchLevel
- the depth with which to match locales.true
if requested
matches any of available
, or if
available
is empty or null
.Locale
,
Match
public boolean needsNewVM()
public java.util.List<java.lang.String> getNewVMArgs()
public DownloadOptions getDownloadOptions()
public boolean requiresSignedJNLPWarning()
public void setSignedJNLPAsMissing()
public JNLPFile.ManifestsAttributes getManifestsAttributes()
public java.lang.String createJnlpVendorValue()
public java.lang.String createJnlpVendor()
public java.lang.String createJnlpTitleValue()
public java.lang.String createJnlpTitle()