Skip to content

Commit

Permalink
Access the Manifest directly from the archive resource set.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1655126 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Jan 27, 2015
1 parent 93d07dd commit 12e4fff
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
Expand Up @@ -27,23 +27,23 @@


public abstract class AbstractArchiveResource extends AbstractResource { public abstract class AbstractArchiveResource extends AbstractResource {


private final AbstractArchiveResourceSet archiveResourceSet;
private final String base; private final String base;
private final String baseUrl; private final String baseUrl;
private final JarEntry resource; private final JarEntry resource;
private final Manifest manifest;
private final String codeBaseUrl; private final String codeBaseUrl;
private final String name; private final String name;
private boolean readCerts = false; private boolean readCerts = false;
private Certificate[] certificates; private Certificate[] certificates;


protected AbstractArchiveResource(AbstractArchiveResourceSet archiveResourceSet, protected AbstractArchiveResource(AbstractArchiveResourceSet archiveResourceSet,
String webAppPath, String base, String baseUrl, JarEntry jarEntry, String webAppPath, String base, String baseUrl, JarEntry jarEntry,
Manifest manifest, String codeBaseUrl) { String codeBaseUrl) {
super(archiveResourceSet.getRoot(), webAppPath); super(archiveResourceSet.getRoot(), webAppPath);
this.archiveResourceSet = archiveResourceSet;
this.base = base; this.base = base;
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
this.resource = jarEntry; this.resource = jarEntry;
this.manifest = manifest;
this.codeBaseUrl = codeBaseUrl; this.codeBaseUrl = codeBaseUrl;


String resourceName = resource.getName(); String resourceName = resource.getName();
Expand Down Expand Up @@ -204,7 +204,7 @@ public Certificate[] getCertificates() {


@Override @Override
public Manifest getManifest() { public Manifest getManifest() {
return manifest; return archiveResourceSet.getManifest();
} }


@Override @Override
Expand Down
Expand Up @@ -42,6 +42,10 @@ protected final void setManifest(Manifest manifest) {
this.manifest = manifest; this.manifest = manifest;
} }


protected final Manifest getManifest() {
return manifest;
}

protected final void setBaseUrl(URL baseUrl) { protected final void setBaseUrl(URL baseUrl) {
this.baseUrl = baseUrl; this.baseUrl = baseUrl;
if (baseUrl == null) { if (baseUrl == null) {
Expand Down
5 changes: 2 additions & 3 deletions java/org/apache/catalina/webresources/JarResource.java
Expand Up @@ -20,7 +20,6 @@
import java.io.InputStream; import java.io.InputStream;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.Manifest;


import org.apache.juli.logging.Log; import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory; import org.apache.juli.logging.LogFactory;
Expand All @@ -34,9 +33,9 @@ public class JarResource extends AbstractArchiveResource {
private static final Log log = LogFactory.getLog(JarResource.class); private static final Log log = LogFactory.getLog(JarResource.class);


public JarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath, public JarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath,
String base, String baseUrl, JarEntry jarEntry, Manifest manifest) { String base, String baseUrl, JarEntry jarEntry) {
super(archiveResourceSet, webAppPath, base, "jar:" + baseUrl, jarEntry, super(archiveResourceSet, webAppPath, base, "jar:" + baseUrl, jarEntry,
manifest, baseUrl); baseUrl);
} }


@Override @Override
Expand Down
3 changes: 1 addition & 2 deletions java/org/apache/catalina/webresources/JarResourceSet.java
Expand Up @@ -78,8 +78,7 @@ public JarResourceSet(WebResourceRoot root, String webAppMount, String base,
@Override @Override
protected WebResource createArchiveResource(JarEntry jarEntry, protected WebResource createArchiveResource(JarEntry jarEntry,
String webAppPath, Manifest manifest) { String webAppPath, Manifest manifest) {
return new JarResource(this, webAppPath, getBase(), getBaseUrlString(), return new JarResource(this, webAppPath, getBase(), getBaseUrlString(), jarEntry);
jarEntry, manifest);
} }


//-------------------------------------------------------- Lifecycle methods //-------------------------------------------------------- Lifecycle methods
Expand Down
5 changes: 2 additions & 3 deletions java/org/apache/catalina/webresources/JarWarResource.java
Expand Up @@ -21,7 +21,6 @@
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.JarInputStream; import java.util.jar.JarInputStream;
import java.util.jar.Manifest;


import org.apache.juli.logging.Log; import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory; import org.apache.juli.logging.LogFactory;
Expand All @@ -37,9 +36,9 @@ public class JarWarResource extends AbstractArchiveResource {
private final String archivePath; private final String archivePath;


public JarWarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath, public JarWarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath,
String base, String baseUrl, JarEntry jarEntry, String archivePath, Manifest manifest) { String base, String baseUrl, JarEntry jarEntry, String archivePath) {
super(archiveResourceSet, webAppPath, base, "jar:war:" + baseUrl + "^/" + archivePath, super(archiveResourceSet, webAppPath, base, "jar:war:" + baseUrl + "^/" + archivePath,
jarEntry, manifest, "jar:" + baseUrl + "!/" + archivePath); jarEntry, "jar:" + baseUrl + "!/" + archivePath);
this.archivePath = archivePath; this.archivePath = archivePath;
} }


Expand Down
Expand Up @@ -82,7 +82,7 @@ public JarWarResourceSet(WebResourceRoot root, String webAppMount,
protected WebResource createArchiveResource(JarEntry jarEntry, protected WebResource createArchiveResource(JarEntry jarEntry,
String webAppPath, Manifest manifest) { String webAppPath, Manifest manifest) {
return new JarWarResource(this, webAppPath, getBase(), getBaseUrlString(), return new JarWarResource(this, webAppPath, getBase(), getBaseUrlString(),
jarEntry, archivePath, manifest); jarEntry, archivePath);
} }


//-------------------------------------------------------- Lifecycle methods //-------------------------------------------------------- Lifecycle methods
Expand Down

0 comments on commit 12e4fff

Please sign in to comment.