[WW-5011] Tiles is retired and there is a bug in PostfixedApplicationResource breaking Struts....

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[WW-5011] Tiles is retired and there is a bug in PostfixedApplicationResource breaking Struts....

Jason Pyeron
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

> -----Original Message-----
> From: Jason Pyeron <[hidden email]>
> Sent: Thursday, January 31, 2019 12:59 AM
> To: 'Struts Users Mailing List' <[hidden email]>
> Subject: RE: [struts-user] XML based configuration
>
> > -----Original Message-----
> > From: Jason Pyeron <[hidden email]>
> > Sent: Wednesday, January 30, 2019 9:53 PM
> > > -----Original Message-----
> > > From: Jason Pyeron <[hidden email]>
> > > Sent: Wednesday, January 30, 2019 9:11 PM
> > >
> > > It has been 10+ years since I used the XML configuration, so please bear
> > > with me.
> > >
> > > I am attempting to deploy Apache Roller under a sub context
> > > (public#roller.war) so the url would be
> > > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> > >
> > > When I do so, I get an exception cannot find definition named .Login
> > >
>
> So I think I have narrowed it down.
>
> file:/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-
> INF/tiles.xml
>
> But when this URL is stored in the org.apache.tiles.request.ApplicationResource, specifically
> org.apache.struts2.tiles.StrutsApplicationResource it is splitting the URL in two:
>
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"
>
> and
>
> suffix=".82/webapps/public"
>
>
> If I hack it with the debugger to :
>
>
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-
> 7.0.82/webapps/public#roller/WEB-INF/tiles.xml"
>
> and
>
> suffix=""
>
> It works until the next restart!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [WW-5011] Tiles is retired and there is a bug in PostfixedApplicationResource breaking Struts....

Greg Huber
> > > I am attempting to deploy Apache Roller under a sub context
> > > (public#roller.war) so the url would be
> > > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> > >
> > > When I do so, I get an exception cannot find definition named .Login

I had a similar issue deploying a war with a ## name.  Maybe not the same
issue, but you could try and load tiles def as below (dose not use url's)

<context-param>

<param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
        <param-value>
            /WEB-INF/tiles.xml
        </param-value>
    </context-param>

see:
https://struts.apache.org/plugins/tiles/

...
Note: When using a Tomcat WAR versoning mechanism which uses ## you must
specify all the tiles definition directly using the init-param, in other
case it won’t be loaded. It’s due to limitation of URL class

On Thu, 31 Jan 2019 at 06:29, Jason Pyeron <[hidden email]> wrote:

> 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
>
> > -----Original Message-----
> > From: Jason Pyeron <[hidden email]>
> > Sent: Thursday, January 31, 2019 12:59 AM
> > To: 'Struts Users Mailing List' <[hidden email]>
> > Subject: RE: [struts-user] XML based configuration
> >
> > > -----Original Message-----
> > > From: Jason Pyeron <[hidden email]>
> > > Sent: Wednesday, January 30, 2019 9:53 PM
> > > > -----Original Message-----
> > > > From: Jason Pyeron <[hidden email]>
> > > > Sent: Wednesday, January 30, 2019 9:11 PM
> > > >
> > > > It has been 10+ years since I used the XML configuration, so please
> bear
> > > > with me.
> > > >
> > > > I am attempting to deploy Apache Roller under a sub context
> > > > (public#roller.war) so the url would be
> > > > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> > > >
> > > > When I do so, I get an exception cannot find definition named .Login
> > > >
> >
> > So I think I have narrowed it down.
> >
> >
> file:/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-
> > INF/tiles.xml
> >
> > But when this URL is stored in the
> org.apache.tiles.request.ApplicationResource, specifically
> > org.apache.struts2.tiles.StrutsApplicationResource it is splitting the
> URL in two:
> >
> >
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"
> >
> > and
> >
> > suffix=".82/webapps/public"
> >
> >
> > If I hack it with the debugger to :
> >
> >
> > pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-
> > 7.0.82/webapps/public#roller/WEB-INF/tiles.xml"
> >
> > and
> >
> > suffix=""
> >
> > It works until the next restart!
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [WW-5011] Tiles is retired and there is a bug in PostfixedApplicationResource breaking Struts....

Martin Gainty
In reply to this post by Jason Pyeron


________________________________
From: Jason Pyeron <[hidden email]>
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!


> -----Original Message-----
> From: Jason Pyeron <[hidden email]>
> Sent: Thursday, January 31, 2019 12:59 AM
> To: 'Struts Users Mailing List' <[hidden email]>
> Subject: RE: [struts-user] XML based configuration
>
> > -----Original Message-----
> > From: Jason Pyeron <[hidden email]>
> > Sent: Wednesday, January 30, 2019 9:53 PM
> > > -----Original Message-----
> > > From: Jason Pyeron <[hidden email]>
> > > Sent: Wednesday, January 30, 2019 9:11 PM
> > >
> > > It has been 10+ years since I used the XML configuration, so please bear
> > > with me.
> > >
> > > I am attempting to deploy Apache Roller under a sub context
> > > (public#roller.war) so the url would be
> > > http://127.0.0.1:8080/public/roller/roller-ui/login.rol .
> > >
> > > When I do so, I get an exception cannot find definition named .Login
> > >
>
> So I think I have narrowed it down.
>
> file:/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0.82/webapps/public#roller/WEB-
> INF/tiles.xml
>
> But when this URL is stored in the org.apache.tiles.request.ApplicationResource, specifically
> org.apache.struts2.tiles.StrutsApplicationResource it is splitting the URL in two:
>
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-7.0"
>
> and
>
> suffix=".82/webapps/public"
>
>
> If I hack it with the debugger to :
>
>
> pathPrefix="/C:/programs.x64/apache-software-foundation/apache-tomcat-
> 7.0.82/webapps/public#roller/WEB-INF/tiles.xml"
>
> and
>
> suffix=""
>
> It works until the next restart!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [struts-dev] Re: [WW-5011] Tiles is retired and there is a bug in PostfixedApplicationResource breaking Struts....

Jason Pyeron
> -----Original Message-----
> From: Martin Gainty <[hidden email]>
> Sent: Thursday, January 31, 2019 7:25 AM
> ________________________________
> From: Jason Pyeron <[hidden email]>
> 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: [hidden email]
For additional commands, e-mail: [hidden email]