List of usage examples for org.springframework.util ResourceUtils URL_PROTOCOL_ZIP
String URL_PROTOCOL_ZIP
To view the source code for org.springframework.util ResourceUtils URL_PROTOCOL_ZIP.
Click Source Link
From source file:org.springframework.extensions.config.source.UrlConfigSource.java
private URL extractJarFileURL(final URL jarUrl) { String urlFile = jarUrl.getFile(); int separatorIndex = urlFile.indexOf(JarConfigSource.JAR_PATH_SEPARATOR); if (separatorIndex == -1) { // support for JBoss VFS filesystem JAR files URLs urlFile = jarUrl.toString();//from w w w. ja v a 2s . c o m separatorIndex = urlFile.indexOf(VFSJAR_URL_SEPARATOR); if (separatorIndex != -1) { // offset index to account for .jar suffix separatorIndex += 4; } } if (separatorIndex != -1) { String jarFile = urlFile.substring(0, separatorIndex); try { return new URL(jarFile); } catch (MalformedURLException ex) { // BEA WebLogic Server 12 fix, we know that there is jar separator and zip protocol if (jarUrl.getProtocol().equals(ResourceUtils.URL_PROTOCOL_ZIP)) { try { return new URL(ResourceUtils.FILE_URL_PREFIX + jarFile); } catch (MalformedURLException mue) { return jarUrl; } } else { return jarUrl; } } } else { return jarUrl; } }
From source file:org.springframework.extensions.webscripts.ClassPathStore.java
/** * Determine whether the given URL points to a resource in a jar file, * that is, has protocol "jar", "zip", "vfszip", "wsjar" or "code-source". * <p>"zip" and "wsjar" and "vfszip" are used by BEA WebLogic Server and IBM WebSphere * and JBoss, respectively, but can be treated like jar files. The same applies to * "code-source" URLs on Oracle OC4J, provided that the path contains a jar separator. * /* ww w . j av a 2 s . co m*/ * @param url the URL to check * * @return whether the URL has been identified as a JAR URL */ protected static boolean isJarURL(final URL url) { final String protocol = url.getProtocol(); return (ResourceUtils.URL_PROTOCOL_JAR.equals(protocol) || ResourceUtils.URL_PROTOCOL_VFSZIP.equals(protocol) || ResourceUtils.URL_PROTOCOL_ZIP.equals(protocol) || ResourceUtils.URL_PROTOCOL_VFS.equals(protocol) || ResourceUtils.URL_PROTOCOL_WSJAR.equals(protocol) || (ResourceUtils.URL_PROTOCOL_CODE_SOURCE.equals(protocol) && url.getPath().contains(ResourceUtils.JAR_URL_SEPARATOR))); }