jar = JarFactory.newInstance(url); jar.nextEntry(); String entryName = jar.getEntryName(); while (entryName != null) { if (entryName.endsWith(".class")) { is = null; try { is = jar.getEntryInputStream(); processAnnotationsStream(is, fragment); } catch (IOException e) { jar.nextEntry(); entryName = jar.getEntryName(); } finally { if (jar != null) { jar.close();
public static InputSource getInputSource(String fname, Jar jar, JspCompilationContext ctxt) throws IOException { InputSource source; if (jar != null) { String jarEntryName = fname.substring(1, fname.length()); source = new InputSource(jar.getInputStream(jarEntryName)); source.setSystemId(jar.getURL(jarEntryName)); } else { source = new InputSource(ctxt.getResourceAsStream(fname)); source.setSystemId(ctxt.getResource(fname).toExternalForm()); } return source; }
URL jarURL = jar.getJarFileURL(); try { jar.nextEntry(); for (String entryName = jar.getEntryName(); entryName != null; jar.nextEntry(), entryName = jar.getEntryName()) { if (!(entryName.startsWith("META-INF/") && entryName.endsWith(TLD_EXT))) { jar.close();
if ("jar".equals(url.getProtocol())) { jar = JarFactory.newInstance(url); jar.nextEntry(); String entryName = jar.getEntryName(); while (entryName != null) { if (entryName.startsWith("META-INF/resources/")) { break; jar.nextEntry(); entryName = jar.getEntryName(); } finally { if (jar != null) { jar.close();
if ("jar".equals(url.getProtocol())) { jar = JarFactory.newInstance(url); is = jar.getInputStream(SCI_LOCATION); } else if ("file".equals(url.getProtocol())) { String path = url.getPath(); jar.close();
jar.nextEntry(); String entryName = jar.getEntryName(); while (entryName != null) { if (entryName.startsWith("META-INF/resources/")) { break; jar.nextEntry(); entryName = jar.getEntryName();
} else { String entry = absFileName.substring(1); compiler.getPageInfo().addDependant(jar.getURL(entry), Long.valueOf(jar.getLastModified(entry)));
if (jar.entryExists("META-INF/resources/")) { context.addResourceJarUrl(url); } finally { if (jar != null) { jar.close();
public static BufferedInputStream getInputStream(String fname, Jar jar, JspCompilationContext ctxt) throws IOException { InputStream in = null; if (jar != null) { String jarEntryName = fname.substring(1, fname.length()); in = jar.getInputStream(jarEntryName); } else { in = ctxt.getResourceAsStream(fname); } if (in == null) { throw new FileNotFoundException(MESSAGES.fileNotFound(fname)); } return new BufferedInputStream(in, JspUtil.JSP_INPUT_STREAM_BUFFER_SIZE); }
private long[] getLastModified(TldResourcePath tldResourcePath) { long[] result = new long[2]; result[0] = -1; result[1] = -1; try { URL url = servletContext.getResource(tldResourcePath.getWebappPath()); URLConnection conn = url.openConnection(); result[0] = conn.getLastModified(); if ("file".equals(url.getProtocol())) { // Reading the last modified time opens an input stream so we // need to make sure it is closed again otherwise the TLD file // will be locked until GC runs. conn.getInputStream().close(); } Jar jar = tldResourcePath.getJar(); if (jar != null) { result[1] = jar.getLastModified(tldResourcePath.getEntryName()); } } catch (IOException e) { // Ignore (shouldn't happen) } return result; }
public URL getResource(String res) throws MalformedURLException { 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 = tagJar.getJarFileURL(); } if (jarUrl != null) { result = new URL(jarUrl.toExternalForm() + res.substring(1)); } else { // May not be in a JAR in some IDE environments result = context.getResource(canonicalURI(res)); } } 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; }
wrapperUri = tagFilePath; } else { wrapperUri = tagJar.getURL(tagFilePath);
jar.nextEntry(); String entryName = jar.getEntryName(); while (entryName != null) { if (entryName.startsWith("META-INF/resources/")) { break; jar.nextEntry(); entryName = jar.getEntryName(); } finally { if (jar != null) { jar.close();
if ("jar".equals(url.getProtocol())) { jar = JarFactory.newInstance(url); is = jar.getInputStream(SCI_LOCATION); } else if ("file".equals(url.getProtocol())) { String path = url.getPath(); jar.close();
} else { String entry = absFileName.substring(1); compiler.getPageInfo().addDependant(jar.getURL(entry), Long.valueOf(jar.getLastModified(entry)));
public static InputStream getInputStream(String fname, Jar jar, JspCompilationContext ctxt) throws IOException { InputStream in = null; if (jar != null) { String jarEntryName = fname.substring(1, fname.length()); in = jar.getInputStream(jarEntryName); } else { in = ctxt.getResourceAsStream(fname); } if (in == null) { throw new FileNotFoundException(Localizer.getMessage( "jsp.error.file.not.found", fname)); } return in; }
resource = resource.substring(1); result = tagJar.getLastModified(resource); } else { URL jspUrl = getResource(resource);
protected TagFileInfo createTagFileInfo(org.apache.jasper.deploy.TagFileInfo tagFileInfo, Jar jar) throws JasperException{ String name = tagFileInfo.getName(); String path = tagFileInfo.getPath(); if (path.startsWith("/META-INF/tags")) { // Tag file packaged in JAR // See https://issues.apache.org/bugzilla/show_bug.cgi?id=46471 // This needs to be removed once all the broken code that depends on // it has been removed ctxt.setTagFileJarUrl(path, jar.getJarFileURL()); } else if (!path.startsWith("/WEB-INF/tags")) { err.jspError(MESSAGES.invalidTagFileDirectory(path)); } TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives( parserController, name, path, jar, this); return new TagFileInfo(name, path, tagInfo); }
jar = JarFactory.newInstance(jarConn.getURL()); jar.nextEntry(); String entryName = jar.getEntryName(); while (entryName != null) { if (entryName.startsWith("META-INF/") && is = null; try { is = jar.getEntryInputStream(); XmlErrorHandler handler = tldScanStream(is); handler.logFindings(log, jarConn.getURL() + entryName); jar.nextEntry(); entryName = jar.getEntryName(); } finally { if (jar != null) { jar.close();