public static URL buildJarUrl(File jarFile) throws MalformedURLException { return buildJarUrl(jarFile, null); }
public JarWarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath, String baseUrl, JarEntry jarEntry, String archivePath) { super(archiveResourceSet, webAppPath, "jar:war:" + baseUrl + UriUtil.getWarSeparator() + archivePath + "!/", jarEntry, "war:" + baseUrl + UriUtil.getWarSeparator() + archivePath); this.archivePath = archivePath; }
protected WarURLConnection(URL url) throws IOException { super(url); URL innerJarUrl = UriUtil.warToJar(url); wrappedJarUrlConnection = innerJarUrl.openConnection(); }
@Override protected void initInternal() throws LifecycleException { try (JarFile warFile = new JarFile(getBase())) { JarEntry jarFileInWar = warFile.getJarEntry(archivePath); InputStream jarFileIs = warFile.getInputStream(jarFileInWar); try (JarInputStream jarIs = new JarInputStream(jarFileIs)) { setManifest(jarIs.getManifest()); } } catch (IOException ioe) { throw new IllegalArgumentException(ioe); } try { setBaseUrl(UriUtil.buildJarSafeUrl(new File(getBase()))); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } }
} else if (leadingSlash || !UriUtil.hasScheme(location)) {
public static URL buildJarUrl(String fileUrlString, String entryPath) throws MalformedURLException { String safeString = makeSafeForJarUrl(fileUrlString); StringBuilder sb = new StringBuilder(); sb.append(safeString); sb.append("!/"); if (entryPath != null) { sb.append(makeSafeForJarUrl(entryPath)); } return new URL("jar", null, -1, sb.toString()); }
/** * Determine if a URI string has a <code>scheme</code> component. * * @param uri The URI to test * * @return {@code true} if a scheme is present, otherwise {code @false} */ public static boolean hasScheme(CharSequence uri) { int len = uri.length(); for(int i=0; i < len ; i++) { char c = uri.charAt(i); if(c == ':') { return i > 0; } else if(!UriUtil.isSchemeChar(c)) { return false; } } return false; }
@Override protected void initInternal() throws LifecycleException { try (JarFile warFile = new JarFile(getBase())) { JarEntry jarFileInWar = warFile.getJarEntry(archivePath); InputStream jarFileIs = warFile.getInputStream(jarFileInWar); try (JarInputStream jarIs = new JarInputStream(jarFileIs)) { setManifest(jarIs.getManifest()); } } catch (IOException ioe) { throw new IllegalArgumentException(ioe); } try { setBaseUrl(UriUtil.buildJarSafeUrl(new File(getBase()))); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } }
} else if (leadingSlash || !UriUtil.hasScheme(location)) {
public static URL buildJarSafeUrl(File file) throws MalformedURLException { String safe = makeSafeForJarUrl(file.toURI().toString()); return new URL(safe); }
public static URL buildJarUrl(String fileUrlString) throws MalformedURLException { return buildJarUrl(fileUrlString, null); }
public WarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath, String baseUrl, JarEntry jarEntry) { super(archiveResourceSet, webAppPath, "war:" + baseUrl + UriUtil.getWarSeparator(), jarEntry, baseUrl); }
protected WarURLConnection(URL url) throws IOException { super(url); URL innerJarUrl = UriUtil.warToJar(url); wrappedJarUrlConnection = innerJarUrl.openConnection(); }
@Override protected void initInternal() throws LifecycleException { try (JarFile jarFile = JreCompat.getInstance().jarFileNewInstance(getBase())) { setManifest(jarFile.getManifest()); } catch (IOException ioe) { throw new IllegalArgumentException(ioe); } try { setBaseUrl(UriUtil.buildJarSafeUrl(new File(getBase()))); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } }
!UriUtil.hasScheme(urlStringEncoded)) { urlStringEncoded.insert(0, request.getContext().getEncodedPath());
public static URL buildJarUrl(File jarFile, String entryPath) throws MalformedURLException { return buildJarUrl(jarFile.toURI().toString(), entryPath); }
public JarWarResource(AbstractArchiveResourceSet archiveResourceSet, String webAppPath, String baseUrl, JarEntry jarEntry, String archivePath) { super(archiveResourceSet, webAppPath, "jar:war:" + baseUrl + UriUtil.getWarSeparator() + archivePath + "!/", jarEntry, "war:" + baseUrl + UriUtil.getWarSeparator() + archivePath); this.archivePath = archivePath; }
public static Jar newInstance(URL url) throws IOException { String urlString = url.toString(); if (urlString.startsWith("jar:file:")) { if (urlString.endsWith("!/")) { return new JarFileUrlJar(url, true); } else { return new JarFileUrlNestedJar(url); } } else if (urlString.startsWith("war:file:")) { URL jarUrl = UriUtil.warToJar(url); return new JarFileUrlNestedJar(jarUrl); } else if (urlString.startsWith("file:")) { return new JarFileUrlJar(url, false); } else { return new UrlJar(url); } }
@Override protected void initInternal() throws LifecycleException { try (JarFile jarFile = JreCompat.getInstance().jarFileNewInstance(getBase())) { setManifest(jarFile.getManifest()); } catch (IOException ioe) { throw new IllegalArgumentException(ioe); } try { setBaseUrl(UriUtil.buildJarSafeUrl(new File(getBase()))); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } }
!UriUtil.hasScheme(urlStringEncoded)) { urlStringEncoded.insert(0, request.getContext().getEncodedPath());