Package java.net

Examples of java.net.JarURLConnection


    try
    {
      if (connection instanceof JarURLConnection)
      {
        JarURLConnection jarUrlConnection = (JarURLConnection)connection;
        URL jarFileUrl = jarUrlConnection.getJarFileURL();
        URLConnection jarFileConnection = jarFileUrl.openConnection();
        try
        {
          return jarFileConnection.getLastModified();
        }
View Full Code Here


        List<URL> dirURLs = new ArrayList<URL>();
        File directory;
        if (url != null) {
            if (url.toString().startsWith("jar:file:")) {
                try {
                    JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
                    URL urlJC = jarConnection.getJarFileURL();
                    URI baseURI = new URI(urlJC.toString().replaceAll(" ", "%20"));
                    directory = new File(baseURI);
                    if (directory.isDirectory()) {
                        if (directory.canRead()) {
                            JarFile temp = new JarFile(directory);
View Full Code Here

            JarFile jarFile = null;
            InputStream is = null;
            ServletContainerInitializer sci = null;
            try {
                if ("jar".equals(url.getProtocol())) {
                    JarURLConnection conn =
                        (JarURLConnection) url.openConnection();
                    jarFile = conn.getJarFile();
                    ZipEntry entry = jarFile.getEntry(SCI_LOCATION);
                    if (entry != null) {
                        is = jarFile.getInputStream(entry);
                    }
                } else if ("file".equals(url.getProtocol())) {
View Full Code Here

            URL url = fragment.getURL();
            JarFile jarFile = null;
            try {
                // Note: Ignore file URLs for now since only jar URLs will be accepted
                if ("jar".equals(url.getProtocol())) {
                    JarURLConnection conn =
                        (JarURLConnection) url.openConnection();
                    jarFile = conn.getJarFile();  
                    ZipEntry entry = jarFile.getEntry("META-INF/resources/");
                    if (entry != null) {
                        context.addResourceJarUrl(url);
                    }
                }
View Full Code Here

    protected void processAnnotationsJar(URL url, WebXml fragment) {
        JarFile jarFile = null;
       
        try {
            URLConnection urlConn = url.openConnection();
            JarURLConnection jarUrlConn;
            if (!(urlConn instanceof JarURLConnection)) {
                // This should never happen
                sm.getString("contextConfig.jarUrl", url);
                return;
            }
           
            jarUrlConn = (JarURLConnection) urlConn;
            jarUrlConn.setUseCaches(false);
            jarFile = jarUrlConn.getJarFile();
           
            Enumeration<JarEntry> jarEntries = jarFile.entries();
            while (jarEntries.hasMoreElements()) {
                JarEntry jarEntry = jarEntries.nextElement();
                String entryName = jarEntry.getName();
View Full Code Here

 
  public InputStream getInputStreamFromConfigFileEntry(String fileName) throws MaltChainedException {
    if  (!url.toString().startsWith("jar")) {
      // New solution
      try {
        JarURLConnection conn = (JarURLConnection)new URL("jar:" + url.toString() + "!/").openConnection();
        JarFile mcoFile = conn.getJarFile();
        JarEntry entry = mcoFile.getJarEntry(getName()+'/'+fileName);
        if (entry == null) {
          entry = mcoFile.getJarEntry(getName()+'\\'+fileName);
        }
        if (entry == null) {
View Full Code Here

 
  public InputStreamReader getInputStreamReaderFromConfigFileEntry(String fileName, String charSet) throws MaltChainedException {
    if  (!url.toString().startsWith("jar")) {
      // New solution
      try {
        JarURLConnection conn = (JarURLConnection)new URL("jar:" + url.toString() + "!/").openConnection();

        JarFile mcoFile = null;
        mcoFile = conn.getJarFile();
        JarEntry entry = mcoFile.getJarEntry(getName() + '/' + fileName);
 
        if (entry == null) {
          entry = mcoFile.getJarEntry(getName() + '\\' + fileName);
        }
View Full Code Here

      if (resource != null && resource.getProtocol().equals("jar"))
      {
         try
         {
            // Obtain a reference to the JAR containing the scaffold directory
            JarURLConnection connection = (JarURLConnection) resource.openConnection();
            JarFile jarFile = connection.getJarFile();
            Enumeration<JarEntry> entries = jarFile.entries();
            // Iterate through the JAR entries and copy files to the template directory. Only files ending with .ftl,
            // and
            // present in the scaffold/ directory are copied.
            while (entries.hasMoreElements())
View Full Code Here

                // check files in jar file, entries will list all directories
                // and files in jar

                URLConnection openConnection = location.openConnection();
                if (openConnection instanceof JarURLConnection) {
                    JarURLConnection conn = (JarURLConnection) openConnection;

                    JarFile jarFile = conn.getJarFile();

                    Manifest manifest = jarFile.getManifest();
                    if (manifest == null) {
                        // No manifest so this is not a Vaadin Add-on
                        return;
View Full Code Here

     */
    private static void includeJar(File file, Map<String, URL> locations) {
        try {
            URL url = new URL("file:" + file.getCanonicalPath());
            url = new URL("jar:" + url.toExternalForm() + "!/");
            JarURLConnection conn = (JarURLConnection) url.openConnection();
            JarFile jarFile = conn.getJarFile();
            if (jarFile != null) {
                // the key does not matter here as long as it is unique
                locations.put(url.toString(), url);
            }
        } catch (Exception e) {
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.