Refine search
LOG.debug(web_app + " anti-aliased to " + web_app.getAlias()); web_app = context.newResource(web_app.getAlias()); if (LOG.isDebugEnabled()) LOG.debug("Try webapp=" + web_app + ", exists=" + web_app.exists() + ", directory=" + web_app.isDirectory()+" file="+(web_app.getFile())); Resource jarWebApp = JarResource.newJarResource(web_app); if (jarWebApp.exists() && jarWebApp.isDirectory()) web_app= jarWebApp; extractedWebAppDir.mkdir(); LOG.debug("Extract " + web_app + " to " + extractedWebAppDir); Resource jar_web_app = JarResource.newJarResource(web_app); jar_web_app.copyTo(extractedWebAppDir); extractionLock.delete(); extractedWebAppDir.mkdir(); LOG.debug("Extract " + web_app + " to " + extractedWebAppDir); Resource jar_web_app = JarResource.newJarResource(web_app); jar_web_app.copyTo(extractedWebAppDir); extractionLock.delete();
LOG.warn(e.toString()); LOG.debug(Log.EXCEPTION,e); return new BadResource(url,e.toString()); return new JarResource(url, useCaches);
@Override protected synchronized boolean checkConnection() { try { super.checkConnection(); } finally { if (_jarConnection==null) { _entry=null; _file=null; _jarFile=null; _list=null; } } return _jarFile!=null; }
@Override public InputStream getInputStream() throws java.io.IOException { checkConnection(); if (!_urlString.endsWith("!/")) return new FilterInputStream(getInputStream(false)) { @Override public void close() throws IOException {this.in=IO.getClosedStream();} }; URL url = new URL(_urlString.substring(4,_urlString.length()-2)); InputStream is = url.openStream(); return is; }
throws IOException if (!exists()) return; if(LOG.isDebugEnabled()) LOG.debug("Extract "+this+" to "+directory); String urlString = this.getURL().toExternalForm().trim(); int endOfJarUrl = urlString.indexOf("!/"); int startOfJarUrl = (endOfJarUrl >= 0?4:0); boolean subEntryIsDir = (subEntryName != null && subEntryName.endsWith("/")?true:false); if (LOG.isDebugEnabled()) LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL); URLConnection c = jarFileURL.openConnection();
@Override public synchronized void close() { _exists=false; _list=null; _entry=null; _file=null; //if the jvm is not doing url caching, then the JarFiles will not be cached either, //and so they are safe to close if (!getUseCaches()) { if ( _jarFile != null ) { try { if (LOG.isDebugEnabled()) LOG.debug("Closing JarFile "+_jarFile.getName()); _jarFile.close(); } catch ( IOException ioe ) { LOG.ignore(ioe); } } } _jarFile=null; super.close(); }
@Override public synchronized void release() { _list=null; _entry=null; _file=null; //if the jvm is not doing url caching, then the JarFiles will not be cached either, //and so they are safe to close if (!getUseCaches()) { if ( _jarFile != null ) { try { LOG.debug("Closing JarFile "+_jarFile.getName()); _jarFile.close(); } catch ( IOException ioe ) { LOG.ignore(ioe); } } } _jarFile=null; super.release(); }
LOG.debug(Log.EXCEPTION,e); return new BadResource(url,e.toString()); return new JarResource(url, useCaches);
@Override protected synchronized boolean checkConnection() { super.checkConnection(); try { if (_jarConnection!=_connection) newConnection(); } catch(IOException e) { LOG.ignore(e); _jarConnection=null; } return _jarConnection!=null; }
Resource jarResource = JarResource.newJarResource(rootResource); if (jarResource.exists() && jarResource.isDirectory()) rootResource = jarResource; LOG.debug("Context classloader = " + cl); try
res = JarResource.newJarResource(res); LOG.warn("Bad bundle location" , e); return null;
LOG.info("Quickstart Extract " + war + " to " + dir); dir.getFile().mkdirs(); JarResource.newJarResource(war).copyTo(dir.getFile()); LOG.info("Quickstart preconfigure: {}(war={},dir={})",this,war,dir);
@Override protected synchronized void newConnection() throws IOException { super.newConnection(); _entry=null; _file=null; _jarFile=null; _list=null; int sep = _urlString.lastIndexOf("!/"); _jarUrl=_urlString.substring(0,sep+2); _path=URIUtil.decodePath(_urlString.substring(sep+2)); if (_path.length()==0) _path=null; _jarFile=_jarConnection.getJarFile(); _file=new File(_jarFile.getName()); }
private void configureDocumentRoot(WebAppContext handler) { File root = getValidDocumentRoot(); File docBase = (root != null) ? root : createTempDir("jetty-docbase"); try { List<Resource> resources = new ArrayList<>(); Resource rootResource = (docBase.isDirectory() ? Resource.newResource(docBase.getCanonicalFile()) : JarResource.newJarResource(Resource.newResource(docBase))); resources.add((root != null) ? new LoaderHidingResource(rootResource) : rootResource); for (URL resourceJarUrl : this.getUrlsOfJarsWithMetaInfResources()) { Resource resource = createResource(resourceJarUrl); if (resource.exists() && resource.isDirectory()) { resources.add(resource); } } handler.setBaseResource( new ResourceCollection(resources.toArray(new Resource[0]))); } catch (Exception ex) { throw new IllegalStateException(ex); } }
public static void main(String[] args) throws Exception { JarResource jr = new JarResource("/home/mjiang/Downloads/solr-4.8.0/dist/solr-cell-4.8.0-test.jar"); byte[] resource = jr.getResource("/META-INF/NOTICE.txt"); InputStream input = new ByteInputStream(resource, resource.length); BufferedReader dis = new BufferedReader(new InputStreamReader(input)); String line = ""; while((line = dis.readLine()) != null) { System.out.println(line); } dis.close(); }
throws IOException if (!exists()) return; if(LOG.isDebugEnabled()) LOG.debug("Extract "+this+" to "+directory); String urlString = this.getURL().toExternalForm().trim(); int endOfJarUrl = urlString.indexOf("!/"); int startOfJarUrl = (endOfJarUrl >= 0?4:0); boolean subEntryIsDir = (subEntryName != null && subEntryName.endsWith("/")?true:false); if (LOG.isDebugEnabled()) LOG.debug("Extracting entry = "+subEntryName+" from jar "+jarFileURL);
@Override public synchronized void close() { _list=null; _entry=null; _file=null; //if the jvm is not doing url caching, then the JarFiles will not be cached either, //and so they are safe to close if (!getUseCaches()) { if ( _jarFile != null ) { try { if (LOG.isDebugEnabled()) LOG.debug("Closing JarFile "+_jarFile.getName()); _jarFile.close(); } catch ( IOException ioe ) { LOG.ignore(ioe); } } } _jarFile=null; super.close(); }
@Override public synchronized void release() { _list=null; _entry=null; _file=null; //if the jvm is not doing url caching, then the JarFiles will not be cached either, //and so they are safe to close if (!getUseCaches()) { if ( _jarFile != null ) { try { LOG.debug("Closing JarFile "+_jarFile.getName()); _jarFile.close(); } catch ( IOException ioe ) { LOG.ignore(ioe); } } } _jarFile=null; super.release(); }
LOG.debug(Log.EXCEPTION,e); return new BadResource(url,e.toString()); return new JarResource(url, useCaches);
@Override protected synchronized boolean checkConnection() { super.checkConnection(); try { if (_jarConnection!=_connection) newConnection(); } catch(IOException e) { LOG.ignore(e); _jarConnection=null; } return _jarConnection!=null; }