Package java.net

Examples of java.net.JarURLConnection


        InputStream            istream;
        InputSource            isource;
        DocumentBuilderFactory builderFactory;
        DocumentBuilder        builder;
        JarURLConnection       jarConnection;
        JarEntry               jarentry;
        JarFile                jarfile;
        URL                    url;

        converterInfoList = new Vector();
        jarfilename       = jar;

        // Get Jar via URL
        //
        url               = new URL("jar:" + jar + "!/META-INF/converter.xml");
        jarConnection     = (JarURLConnection)url.openConnection();
        jarentry          = jarConnection.getJarEntry();
        jarfile           = jarConnection.getJarFile();

        // Build the InputSource
        //
        istream           = jarfile.getInputStream(jarentry);
        isource           = new InputSource(istream);
View Full Code Here


            // per-entry attribute is most probably the last resource in the
            // list, therefore search backwards
            for ( int i = res.size() - 1; i >= 0; i-- ) {
                URL jarurl = (URL) res.elementAt( i );
                try {
                    JarURLConnection jarConnection =
                        (JarURLConnection) jarurl.openConnection();
                    Manifest mf = jarConnection.getManifest();
                    Attributes attrs = (Attributes) mf.getAttributes(
                        "com/sun/star/lib/loader/Loader.class" );
                    if ( attrs != null ) {
                        className = attrs.getValue( "Application-Class" );
                        if ( className != null )
View Full Code Here

     * Add a resources JAR. The contents of /META-INF/resources/ will be used if
     * a requested resource can not be found in the main context.
     */
    public void addResourcesJar(URL url) {
        try {
            JarURLConnection conn = (JarURLConnection) url.openConnection();
            JarFile jarFile = conn.getJarFile();  
            ZipEntry entry = jarFile.getEntry("/");
            WARDirContext warDirContext = new WARDirContext(jarFile,
                    new WARDirContext.Entry("/", entry));
            warDirContext.loadEntries();
            altDirContexts.add(warDirContext);
View Full Code Here

      {
        urlConnection = url.openConnection();
        long lastModified = this.lastModified;
        if (urlConnection instanceof JarURLConnection)
        {
          JarURLConnection jarUrlConnection = (JarURLConnection)urlConnection;
          URL jarFileUrl = jarUrlConnection.getJarFileURL();
          URLConnection jarFileConnection = jarFileUrl.openConnection();
          try
          {
            lastModified = jarFileConnection.getLastModified();
          }
View Full Code Here

        // Expand the WAR into the new document base directory
        String canonicalDocBasePrefix = docBase.getCanonicalPath();
        if (!canonicalDocBasePrefix.endsWith(File.separator)) {
            canonicalDocBasePrefix += File.separator;
        }
        JarURLConnection juc = (JarURLConnection) war.openConnection();
        juc.setUseCaches(false);
        JarFile jarFile = null;
        InputStream input = null;
        boolean success = false;
        try {
            jarFile = juc.getJarFile();
            Enumeration<JarEntry> jarEntries = jarFile.entries();
            while (jarEntries.hasMoreElements()) {
                JarEntry jarEntry = jarEntries.nextElement();
                String name = jarEntry.getName();
                File expandedFile = new File(docBase, name);
View Full Code Here

        // Calculate the document base directory
        String canonicalDocBasePrefix = docBase.getCanonicalPath();
        if (!canonicalDocBasePrefix.endsWith(File.separator)) {
            canonicalDocBasePrefix += File.separator;
        }
        JarURLConnection juc = (JarURLConnection) war.openConnection();
        juc.setUseCaches(false);
        JarFile jarFile = null;
        try {
            jarFile = juc.getJarFile();
            Enumeration<JarEntry> jarEntries = jarFile.entries();
            while (jarEntries.hasMoreElements()) {
                JarEntry jarEntry = jarEntries.nextElement();
                String name = jarEntry.getName();
                File expandedFile = new File(docBase, name);
View Full Code Here

     */
    private synchronized void close() {
        if (conn != null) {
            try {
                if (conn instanceof JarURLConnection) {
                    JarURLConnection juc = (JarURLConnection) conn;
                    JarFile jf = juc.getJarFile();
                    jf.close();
                    jf = null;
                } else if (conn instanceof HttpURLConnection) {
                    ((HttpURLConnection) conn).disconnect();
                }
View Full Code Here

            }
        }
    }

    private NonClosingJarInputStream createJarInputStream() throws IOException {
        JarURLConnection jarConn = (JarURLConnection) url.openConnection();
        URL resourceURL = jarConn.getJarFileURL();
        URLConnection resourceConn = resourceURL.openConnection();
        resourceConn.setUseCaches(false);
        return new NonClosingJarInputStream(resourceConn.getInputStream());
    }
View Full Code Here

    private JarFile jarFile;
    private Enumeration<JarEntry> entries;
    private JarEntry entry = null;

    public FileUrlJar(URL url) throws IOException {
        JarURLConnection jarConn = (JarURLConnection) url.openConnection();
        jarFile = jarConn.getJarFile();
    }
View Full Code Here

        }

        else if (systemId.startsWith("jar:"))
        {
            URL url = new URL(systemId);
            JarURLConnection conn = (JarURLConnection) url.openConnection();
            JarEntry jarEntry = conn.getJarEntry();
            if (jarEntry == null)
            {
                log.fatal("JAR entry '" + systemId + "' not found.");
            }
            //_jarFile.getInputStream(jarEntry);
            stream = conn.getJarFile().getInputStream(jarEntry);
        }
        else
        {
            if (_externalContext == null)
            {
View Full Code Here

TOP

Related Classes of java.net.JarURLConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.