You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by al...@apache.org on 2025/02/01 20:22:31 UTC

(aries) branch ARIES-2166-fix-web-url-handler-in-eclipse-osgi-above-3-17 created (now b1e2a65cc)

This is an automated email from the ASF dual-hosted git repository.

alien11689 pushed a change to branch ARIES-2166-fix-web-url-handler-in-eclipse-osgi-above-3-17
in repository https://gitbox.apache.org/repos/asf/aries.git


      at b1e2a65cc ARIES-2166: Fix web url handler in org.eclipse.osgi > 3.17.0

This branch includes the following new commits:

     new b1e2a65cc ARIES-2166: Fix web url handler in org.eclipse.osgi > 3.17.0

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(aries) 01/01: ARIES-2166: Fix web url handler in org.eclipse.osgi > 3.17.0

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alien11689 pushed a commit to branch ARIES-2166-fix-web-url-handler-in-eclipse-osgi-above-3-17
in repository https://gitbox.apache.org/repos/asf/aries.git

commit b1e2a65cc8d2ed82347ae39d3fbf7b65114a1fa3
Author: Dominik Przybysz <al...@gmail.com>
AuthorDate: Sat Feb 1 21:22:13 2025 +0100

    ARIES-2166: Fix web url handler in org.eclipse.osgi > 3.17.0
---
 web/web-itests/pom.xml                                      |  2 +-
 .../org/apache/aries/web/url/WAR_URLServiceHandler.java     | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/web/web-itests/pom.xml b/web/web-itests/pom.xml
index f664390ed..0682caf7d 100644
--- a/web/web-itests/pom.xml
+++ b/web/web-itests/pom.xml
@@ -51,7 +51,7 @@
         <org.apache.aries.util.version>1.2.0-SNAPSHOT</org.apache.aries.util.version>
         <org.apache.aries.web.urlhandler.version>1.0.1-SNAPSHOT</org.apache.aries.web.urlhandler.version>
         <org.apache.felix.configadmin.version>1.9.26</org.apache.felix.configadmin.version>
-        <org.eclipse.osgi.version>3.17.0</org.eclipse.osgi.version>
+        <org.eclipse.osgi.version>3.22.0</org.eclipse.osgi.version>
         <tinybundles.version>2.1.1</tinybundles.version>
         <url.version>2.5.3</url.version>
     </properties>
diff --git a/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java b/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java
index 05047da23..52c4e076c 100644
--- a/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java
+++ b/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java
@@ -18,9 +18,12 @@
  */
 package org.apache.aries.web.url;
 
+import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.StringTokenizer;
@@ -69,8 +72,14 @@ public class WAR_URLServiceHandler extends AbstractURLStreamHandlerService imple
         firstProperty = false;
       }
     }
-        
-    return new WARConnection(new URL(url.getPath()), properties);
+      WARConnection warConnection = new WARConnection(new URL(url.getPath()), properties);
+      // in new version of org.eclipse.osgi > 3.17.0 we cannot return war connection
+      // since when its protocol is file then generated input stream is ignored
+      // and framework reads file again
+      // https://github.com/eclipse-equinox/equinox/blob/e35221a86afd24ee21b7b9d02db298a90ace1bc0/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java#L1158-L1181
+      File webbundle = File.createTempFile("webbundle", ".wab");
+      Files.copy(warConnection.getInputStream(), webbundle.toPath(), StandardCopyOption.REPLACE_EXISTING);
+      return webbundle.getAbsoluteFile().toURI().toURL().openConnection();
   }
 
   @Override