> -----Original Message-----
> From: Martin Gainty <mgai...@hotmail.com>
> Sent: Thursday, January 31, 2019 7:25 AM
> ________________________________
> From: Jason Pyeron <jpye...@pdinc.us>
> Sent: Thursday, January 31, 2019 1:28 AM
> To: 'Struts Developers List'
> Subject: [WW-5011] Tiles is retired and there is a bug in 
> PostfixedApplicationResource breaking
> Struts....
> 
> http://tiles.apache.org/ - Project Tiles has retired. For details please 
> refer to its Attic page.
> 
> https://attic.apache.org/ - Process of leaving the Attic again - Options are:
> 
> * Forking the project - we'll link to any forks which have been created so 
> please let us know
> * Restarting the community in the Apache Incubator
> * Recreating a PMC for the project
> * Transfering(SIC) to an existing PMC
> 
> Now granted the jar tiles-request-api-1.0.6 is not the latest, I compared it 
> to the latest release
> tiles-request-api-1.0.7 and the PostfixedApplicationResource.java code is 
> identical.
> 
> My best suggestion is to patch the file as part of 
> struts2-tiles-plugin-2.5.17 and shadow the defunct
> tiles' class file.
> 
> -Jason
> 
> MG>can you fork the attic code to your own url or does Lukasz need to fix 
> this bug in-situ?
> MG>Thanks Jason!

It was late last night, so I did not follow up with the patch. I did update the 
ticket with the code snippet.

$ git diff
diff --git 
a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsApplicationResource.java
 
b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsApplicationResource.java
index 1f636f9ca..2c5f86bfd 100644
--- 
a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsApplicationResource.java
+++ 
b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsApplicationResource.java
@@ -30,10 +30,18 @@ public class StrutsApplicationResource extends 
PostfixedApplicationResource {
     private final URL url;

     public StrutsApplicationResource(URL url) {
-        super(url.getPath());
+        super(extractPath(url));
         this.url = url;
     }

+    public static String extractPath(URL url)
+    {
+        if (url==null) return null;
+        String proto = url.getProtocol();
+        if ("file".equals(proto)) return 
url.toExternalForm().substring(proto.length()+1);
+        return url.getPath();
+    }
+
     @Override
     public InputStream getInputStream() throws IOException {
         return url.openStream();



This uses the logic, that if it is a file protocol, none of the special URL 
meaning make sense. So all we do is strip the file:

This is a prototype, I want to use the File class to do it more safely as 
compared to my string manipulation, I will do that this weekend. 

-Jason


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to