public URL getResource(String res) throws MalformedURLException {
- return context.getResource(canonicalURI(res));
+ URL result = null;
+
+ if (res.startsWith("/META-INF/")) {
+ // This is a tag file packaged in a jar that is being compiled
+ URL jarUrl = tagFileJarUrls.get(res);
+ if (jarUrl == null) {
+ jarUrl = tagFileJarUrl;
+ }
+ if (jarUrl != null) {
+ result = new URL(jarUrl.toExternalForm() + res.substring(1));
+ }
+ } else if (res.startsWith("jar:file:")) {
+ // This is a tag file packaged in a jar that is being checked
+ // for a dependency
+ result = new URL(res);
+
+ } else {
+ result = context.getResource(canonicalURI(res));
+ }
+ return result;
}
+
public Set getResourcePaths(String path) {
return context.getResourcePaths(canonicalURI(path));
}
public void compile() throws JasperException, FileNotFoundException {
createCompiler();
- if (isPackagedTagFile || jspCompiler.isOutDated()) {
+ if (jspCompiler.isOutDated()) {
try {
jspCompiler.removeGeneratedFiles();
jspLoader = null;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
+import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Iterator;
return false;
}
URLConnection uc = jspUrl.openConnection();
- jspRealLastModified = uc.getLastModified();
+ if (uc instanceof JarURLConnection) {
+ jspRealLastModified =
+ ((JarURLConnection) uc).getJarEntry().getTime();
+ } else {
+ jspRealLastModified = uc.getLastModified();
+ }
uc.getInputStream().close();
} catch (Exception e) {
return true;
return true;
}
- URLConnection includeUconn = includeUrl.openConnection();
- long includeLastModified = includeUconn.getLastModified();
- includeUconn.getInputStream().close();
+ URLConnection iuc = includeUrl.openConnection();
+ long includeLastModified = 0;
+ if (iuc instanceof JarURLConnection) {
+ includeLastModified =
+ ((JarURLConnection) iuc).getJarEntry().getTime();
+ } else {
+ includeLastModified = iuc.getLastModified();
+ }
+ iuc.getInputStream().close();
if (includeLastModified > targetLastModified) {
return true;
TagFileInfo tagFileInfo = n.getTagFileInfo();
if (tagFileInfo != null) {
String tagFilePath = tagFileInfo.getPath();
- JspCompilationContext ctxt = compiler.getCompilationContext();
- if (ctxt.getTagFileJarUrl(tagFilePath) == null) {
- // Omit tag file dependency info on jar files for now.
+ if (tagFilePath.startsWith("/META-INF/")) {
+ // For tags in JARs, add the TLD and the tag as a dependency
+ String[] location =
+ compiler.getCompilationContext().getTldLocation(
+ tagFileInfo.getTagInfo().getTagLibrary().getURI());
+ // Add TLD
+ pageInfo.addDependant("jar:" + location[0] + "!/" +
+ location[1]);
+ // Add Tag
+ pageInfo.addDependant("jar:" + location[0] + "!" +
+ tagFilePath);
+ } else {
pageInfo.addDependant(tagFilePath);
}
Class c = loadTagFile(compiler, tagFilePath, n.getTagInfo(),