SignedStaticContentpublic class SignedStaticContent extends StaticContent Represents a jar file that is signed before being served in
response to a Java Web Start request.
Signing occurs when the jar is first requested. |
Fields Summary |
---|
private final File | unsignedJarthe unsigned jar to be served in signed form | private final File | signedJarthe signed jar | private URI | installRootURIURI for the app server installation root | private final Logger | logger | private final com.sun.enterprise.util.i18n.StringManager | localStrings |
Constructors Summary |
---|
public SignedStaticContent(ContentOrigin origin, String contentKey, String path, File signedJar, File unsignedJar, URI installRootURI, com.sun.enterprise.util.i18n.StringManager localStrings, boolean isMain)Creates a new instance of SignedStaticContent
super(origin, contentKey, path, signedJar, installRootURI, isMain);
/*
*Find out as much as we can in order to sign the jar, but do not sign it yet.
*/
this.installRootURI = installRootURI;
this.unsignedJar = unsignedJar;
this.signedJar = signedJar;
this.localStrings = localStrings;
|
Methods Summary |
---|
private boolean | checkUserAlias(java.security.KeyStore keystore, java.lang.String candidateAlias)Returns whether the specified alias is present in the keystore or not. Also
logs a warning if the user-specified alias is missing.
boolean result;
if ( ! (result = keystore.containsAlias(candidateAlias)) ) {
logger.warning(localStrings.getString("jws.sign.userAliasAbsent", candidateAlias));
}
return result;
| private synchronized void | ensureSignedFileUpToDate()Makes sure that the signed jar exists and is up-to-date compared to the
corresponding unsigned jar. If not, create a new signed jar using
the alias provided on this object's constructor.
/*
*Check to see if the signed version of this jar is present.
*/
if ( ! unsignedJar.exists()) {
throw new IllegalArgumentException(
localStrings.getString("jws.sign.noUnsignedJar", unsignedJar.getAbsolutePath()));
}
if ( ! signedJar.exists() || (signedJar.lastModified() < unsignedJar.lastModified())) {
signJar();
}
| private java.lang.String | getKeystorePassword()Returns the password for the keystore.
return SSLUtils.getKeyStorePass();
| public java.net.URI | getRelativeURI()Returns the URI, relative to the app server installation directory, of
the signed jar file to be published, signing the unsigned jar if needed
to create the signed one to serve.
try {
ensureSignedFileUpToDate();
return installRootURI.relativize(signedJar.toURI());
} catch (Throwable t) {
throw new RuntimeException(t);
}
| private void | signJar()Signs the jar file.
/*
*In EE environments synchronization does not include empty directories.
*So the java-web-start/<app-name> directory may not yet exist if this
*is a non-DAS instance. So just make sure the required directories
*are created.
*/
File signedJarParent = signedJar.getParentFile();
if ( ! signedJarParent.exists() && ! signedJarParent.mkdirs() ) {
throw new Exception(localStrings.getString("jws.sign.errorCreatingDir", signedJarParent.getAbsolutePath()));
}
ASJarSigner.signJar(unsignedJar, signedJar);
|
|