Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi Erik, I know the problem. It is a JavaScript problem, where the browser has to construct an absolute URL from the relative URL that is in the HTML fragment. The question is relative to what context this URL has to be constructed in the browser - relative to the source of the fragment, to some iframe or to the source of the page it is inserted into. I am not arguing with you that you have found a good solution to the problem. But if you wanted to solve the problem at the root of it, you would code the relative URLs at the server, and make them absolute at the client side. The conversion is quite trivial. I did this for a JavaScript based e-commerce app some time ago. This will always work because the browser cannot reqest relative URLs anyway. Regarding Wicket's inability to do this out of the box, I am once again disappointed. This is so basic it blows my mind. While Wicket is very flexible in many areas, in some areas it forces special use cases as "best practice" on site develpers who then don't have any choices. RelativePathPrefixHandler just breaks things by making a stupid assumption about paths. I wish I could replace it dynamically. If I start making alternative suggesions, then I am hearing catchy words like "best practice" "community consensus" , "begginner" and "we like to do it this way". That never convinces anyone because there is no such thing as a community consensus, and especially not one that agrees on a special use case. I would say that putting HTML pages alongside Java source files is a special use case for component deployment. It is ridiculous to call this Wicket best practice for site development. Once you explore benefits eg better separation of concerns of the more general cases, you run into trouble only because the original designers did not consider them enough. A framework might originate from special use cases but it should at some stage address general cases with higher priority not as never ending afterthoughts. These things should be pluggable. Regards, Bernard On Sat, 19 Jun 2010 20:43:12 +0200, you wrote: >Hi Bernard, > >We are using absolute URLs in one application (http://tipspot.com) that >does not use the wicket ajax library, only javascript (based on jquery) >written by the frontend developer. One of the things we do there is >filling popups through ajax requests. As most of that information is >completely stateless, we use a wicket page to produce the html >fragments. The URL depth and path of the original page (containing the >popup), and the page that is pasted into the popup, almost never >matches. This is a problem for linking to other pages. I found it easy >to make this problem go away by making all URLs absolute. > >I did not look at RelativePathPrefixHandler as I was unaware of its >existence. I am also not certain that any relative schema would be able >to solve the problem cleanly/easily. Secondly having absolute paths is a >non-issue for this application. > >Regards, > Erik. > > >Op 19-06-10 20:27, b...@actrix.gen.nz wrote: >> Thanks Erik. >> >> Why are you using absolute URLS? >> >> Are you using absolute URLs to support editing in the web directory, >> with a directory structure the same as the java package structure, >> without breaking images? >> >> Then it would look like you have found a different solution for the >> same problem. Interesting. Both solutions require only small changes. >> Have you tried to patch RelativePathPrefixHandler? With that change, >> you would no longer be restricted to absolute paths. >> >> >> Regards, >> >> Bernard >> >> >> On Sat, 19 Jun 2010 14:15:44 +0200, you wrote: >> >> >>> Hi, >>> >>> https://issues.apache.org/jira/browse/WICKET-1974 describes a way to >>> make all URLs absolute. >>> >>> Unfortunately the patch attached to the issue is still not applied so >>> you'll have to build wicket yourself. >>> >>> Regards, >>> Erik. >>> >>> >>> Op 18-06-10 21:56, b...@actrix.gen.nz schreef: >>> Hi Fernando, obviously quite a few including yourself are separating markup from Java packages to make it accessable to HTML developers. How do you cope with the fact that Wicket markup, when rendered in any folder without flattening the package structure, gets broken images? That is what I am trying to address with "Cannot substitute RelativePathPrefixHandler" https://issues.apache.org/jira/browse/WICKET-2881 The three lines of Java code in RelativePathPrefixHandler are solving this problem. int lastIndex = attrValue.lastIndexOf("../"); if (lastIndex>= 0){ attrValue = attrValue.substring(lastIndex + 3); } Regards, Bernard >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> ---
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi Bernard, We are using absolute URLs in one application (http://tipspot.com) that does not use the wicket ajax library, only javascript (based on jquery) written by the frontend developer. One of the things we do there is filling popups through ajax requests. As most of that information is completely stateless, we use a wicket page to produce the html fragments. The URL depth and path of the original page (containing the popup), and the page that is pasted into the popup, almost never matches. This is a problem for linking to other pages. I found it easy to make this problem go away by making all URLs absolute. I did not look at RelativePathPrefixHandler as I was unaware of its existence. I am also not certain that any relative schema would be able to solve the problem cleanly/easily. Secondly having absolute paths is a non-issue for this application. Regards, Erik. Op 19-06-10 20:27, b...@actrix.gen.nz wrote: Thanks Erik. Why are you using absolute URLS? Are you using absolute URLs to support editing in the web directory, with a directory structure the same as the java package structure, without breaking images? Then it would look like you have found a different solution for the same problem. Interesting. Both solutions require only small changes. Have you tried to patch RelativePathPrefixHandler? With that change, you would no longer be restricted to absolute paths. Regards, Bernard On Sat, 19 Jun 2010 14:15:44 +0200, you wrote: Hi, https://issues.apache.org/jira/browse/WICKET-1974 describes a way to make all URLs absolute. Unfortunately the patch attached to the issue is still not applied so you'll have to build wicket yourself. Regards, Erik. Op 18-06-10 21:56, b...@actrix.gen.nz schreef: Hi Fernando, obviously quite a few including yourself are separating markup from Java packages to make it accessable to HTML developers. How do you cope with the fact that Wicket markup, when rendered in any folder without flattening the package structure, gets broken images? That is what I am trying to address with "Cannot substitute RelativePathPrefixHandler" https://issues.apache.org/jira/browse/WICKET-2881 The three lines of Java code in RelativePathPrefixHandler are solving this problem. int lastIndex = attrValue.lastIndexOf("../"); if (lastIndex>= 0){ attrValue = attrValue.substring(lastIndex + 3); } Regards, Bernard - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Thanks Erik. Why are you using absolute URLS? Are you using absolute URLs to support editing in the web directory, with a directory structure the same as the java package structure, without breaking images? Then it would look like you have found a different solution for the same problem. Interesting. Both solutions require only small changes. Have you tried to patch RelativePathPrefixHandler? With that change, you would no longer be restricted to absolute paths. Regards, Bernard On Sat, 19 Jun 2010 14:15:44 +0200, you wrote: >Hi, > >https://issues.apache.org/jira/browse/WICKET-1974 describes a way to >make all URLs absolute. > >Unfortunately the patch attached to the issue is still not applied so >you'll have to build wicket yourself. > >Regards, > Erik. > > >Op 18-06-10 21:56, b...@actrix.gen.nz schreef: >> Hi Fernando, >> >> obviously quite a few including yourself are separating markup from >> Java packages to make it accessable to HTML developers. >> >> How do you cope with the fact that Wicket markup, when rendered in any >> folder without flattening the package structure, gets broken images? >> >> That is what I am trying to address with >> >> "Cannot substitute RelativePathPrefixHandler" >> https://issues.apache.org/jira/browse/WICKET-2881 >> >> The three lines of Java code in RelativePathPrefixHandler are solving >> this problem. >> >> int lastIndex = attrValue.lastIndexOf("../"); >> if (lastIndex>= 0){ >> attrValue = attrValue.substring(lastIndex + 3); >> } >> >> Regards, >> Bernard >> >> - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi, https://issues.apache.org/jira/browse/WICKET-1974 describes a way to make all URLs absolute. Unfortunately the patch attached to the issue is still not applied so you'll have to build wicket yourself. Regards, Erik. Op 18-06-10 21:56, b...@actrix.gen.nz schreef: Hi Fernando, obviously quite a few including yourself are separating markup from Java packages to make it accessable to HTML developers. How do you cope with the fact that Wicket markup, when rendered in any folder without flattening the package structure, gets broken images? That is what I am trying to address with "Cannot substitute RelativePathPrefixHandler" https://issues.apache.org/jira/browse/WICKET-2881 The three lines of Java code in RelativePathPrefixHandler are solving this problem. int lastIndex = attrValue.lastIndexOf("../"); if (lastIndex>= 0){ attrValue = attrValue.substring(lastIndex + 3); } Regards, Bernard -- Erik van Oosten http://www.day-to-day-stuff.blogspot.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi Fernando, obviously quite a few including yourself are separating markup from Java packages to make it accessable to HTML developers. How do you cope with the fact that Wicket markup, when rendered in any folder without flattening the package structure, gets broken images? That is what I am trying to address with "Cannot substitute RelativePathPrefixHandler" https://issues.apache.org/jira/browse/WICKET-2881 The three lines of Java code in RelativePathPrefixHandler are solving this problem. int lastIndex = attrValue.lastIndexOf("../"); if (lastIndex >= 0){ attrValue = attrValue.substring(lastIndex + 3); } Regards, Bernard On Fri, 18 Jun 2010 13:48:43 -0300, you wrote: >The solution I found: > >application.init > >getResourceSettings().addResourceFolder("/WEB-INF/html"); > >Your resources will be protected by web-inf and the configuration is the >same in local development machine and in the remote development machine, >where you can give permits to your web designers. Not the best solution but >the simplest. > >In maven, > > >false >src/main/webapp/ > > >On Fri, Jun 18, 2010 at 4:21 AM, wrote: > >> Hi, >> >> You could have the files in a sibling directory in the web directory >> that is hidden by the wicket filter mapping. Has many benefits. >> >> Allows web developers to freely edit and view files in context with >> links that actually work. FInally HTML refactoring will work. Can >> someone suggest how to get the three lines of code into Wicket that >> are needed to support this? >> >> Please See >> >> "Cannot substitute RelativePathPrefixHandler" >> https://issues.apache.org/jira/browse/WICKET-2881 >> >> >> Bernard >> >> >> >> >> >> >> >> >> On Thu, 17 Jun 2010 16:31:09 -0300, you wrote: >> >> >Hi all, >> >I need to change the development enviroment for >> > >> >IResourceStreamLocator locator = >> >new ResourceStreamLocator(new Path(new Folder("html"))); >> > getResourceSettings().setResourceStreamLocator(locator); >> > >> >but, what I also need is that maven copy the resources form >> > src/main/resources to src/main/WEB-INF/html. This is needed because when >> >maven creates the war file the resources should also be located in that >> >directory. >> > >> >I've tried >> > >> > >> > org.apache.maven.plugins >> > maven-resources-plugin >> > 2.4.1 >> > >> > >> > copy-package-config >> > package >> > >> > copy-resources >> > >> > >> > ${basedir}/html >> > >> > >> > >> > ${basedir}/src/main/resources >> > >> >true >> > >> > >> > >> > >> > >> > >> > >> >and I got >> > >> >[1] Inside the definition for plugin 'maven-resources-plugin' specify the >> >following: >> > >> > >> > ... >> > VALUE >> >. >> > >> > >> >I don't know what else to do >> > >> >thanks in advance >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
The solution I found: application.init getResourceSettings().addResourceFolder("/WEB-INF/html"); Your resources will be protected by web-inf and the configuration is the same in local development machine and in the remote development machine, where you can give permits to your web designers. Not the best solution but the simplest. In maven, false src/main/webapp/ On Fri, Jun 18, 2010 at 4:21 AM, wrote: > Hi, > > You could have the files in a sibling directory in the web directory > that is hidden by the wicket filter mapping. Has many benefits. > > Allows web developers to freely edit and view files in context with > links that actually work. FInally HTML refactoring will work. Can > someone suggest how to get the three lines of code into Wicket that > are needed to support this? > > Please See > > "Cannot substitute RelativePathPrefixHandler" > https://issues.apache.org/jira/browse/WICKET-2881 > > > Bernard > > > > > > > > > On Thu, 17 Jun 2010 16:31:09 -0300, you wrote: > > >Hi all, > >I need to change the development enviroment for > > > >IResourceStreamLocator locator = > >new ResourceStreamLocator(new Path(new Folder("html"))); > > getResourceSettings().setResourceStreamLocator(locator); > > > >but, what I also need is that maven copy the resources form > > src/main/resources to src/main/WEB-INF/html. This is needed because when > >maven creates the war file the resources should also be located in that > >directory. > > > >I've tried > > > > > > org.apache.maven.plugins > > maven-resources-plugin > > 2.4.1 > > > > > > copy-package-config > > package > > > > copy-resources > > > > > > ${basedir}/html > > > > > > > > ${basedir}/src/main/resources > > > >true > > > > > > > > > > > > > > > >and I got > > > >[1] Inside the definition for plugin 'maven-resources-plugin' specify the > >following: > > > > > > ... > > VALUE > >. > > > > > >I don't know what else to do > > > >thanks in advance > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Fernando Wermus. www.linkedin.com/in/fernandowermus
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi, You could have the files in a sibling directory in the web directory that is hidden by the wicket filter mapping. Has many benefits. Allows web developers to freely edit and view files in context with links that actually work. FInally HTML refactoring will work. Can someone suggest how to get the three lines of code into Wicket that are needed to support this? Please See "Cannot substitute RelativePathPrefixHandler" https://issues.apache.org/jira/browse/WICKET-2881 Bernard On Thu, 17 Jun 2010 16:31:09 -0300, you wrote: >Hi all, >I need to change the development enviroment for > >IResourceStreamLocator locator = >new ResourceStreamLocator(new Path(new Folder("html"))); > getResourceSettings().setResourceStreamLocator(locator); > >but, what I also need is that maven copy the resources form > src/main/resources to src/main/WEB-INF/html. This is needed because when >maven creates the war file the resources should also be located in that >directory. > >I've tried > > > org.apache.maven.plugins > maven-resources-plugin > 2.4.1 > > > copy-package-config > package > > copy-resources > > > ${basedir}/html > > > > ${basedir}/src/main/resources > >true > > > > > > > >and I got > >[1] Inside the definition for plugin 'maven-resources-plugin' specify the >following: > > > ... > VALUE >. > > >I don't know what else to do > >thanks in advance - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory
If you haven't customized the resource locator your telling wicket to look sibling directory to your classpath root WEB-INF/classes which "I THINK" is where wicket will start looking for resources. It may be easier to use the build helper plugin which handles resources much better than maven does on it's own. On Thu, Jun 17, 2010 at 3:31 PM, Fernando Wermus wrote: > Hi all, >I need to change the development enviroment for > >IResourceStreamLocator locator = >new ResourceStreamLocator(new Path(new Folder("html"))); > getResourceSettings().setResourceStreamLocator(locator); > > but, what I also need is that maven copy the resources form > src/main/resources to src/main/WEB-INF/html. This is needed because when > maven creates the war file the resources should also be located in that > directory. > > I've tried > > > org.apache.maven.plugins > maven-resources-plugin > 2.4.1 > > > copy-package-config > package > > copy-resources > > > ${basedir}/html > > > > ${basedir}/src/main/resources > > true > > > > > > > > and I got > > [1] Inside the definition for plugin 'maven-resources-plugin' specify the > following: > > > ... > VALUE > . > > > I don't know what else to do > > thanks in advance > -- > Fernando Wermus. > > www.linkedin.com/in/fernandowermus >
ResourceStreamLocator and mvn resource:resource copying resources in the right directory
Hi all, I need to change the development enviroment for IResourceStreamLocator locator = new ResourceStreamLocator(new Path(new Folder("html"))); getResourceSettings().setResourceStreamLocator(locator); but, what I also need is that maven copy the resources form src/main/resources to src/main/WEB-INF/html. This is needed because when maven creates the war file the resources should also be located in that directory. I've tried org.apache.maven.plugins maven-resources-plugin 2.4.1 copy-package-config package copy-resources ${basedir}/html ${basedir}/src/main/resources true and I got [1] Inside the definition for plugin 'maven-resources-plugin' specify the following: ... VALUE . I don't know what else to do thanks in advance -- Fernando Wermus. www.linkedin.com/in/fernandowermus