Re: [T5] Page with same name as package (background for clarity)
I've a couple reasons for wanting to be able to essentially have a package appear as a page. One is that I would love to have my static website be a Tapestry application. Partly because development using components just seems quicker and easier than development using Dreamweaver templates. I would then also have the ability to introduce more dynamic features wherever I want. Tapestry's 'pretty URLs' makes this a possibility. So say this is a URL at my site (which it is): www.dalewhalen.com/HousePlans/TwoStory.html A user can delete 'TwoStory.html' and be back at the HousePlans section of the site. www.dalewhalen.com/HousePlans/ It would be the same in a Tapestry version of the site, except that there would be no '.html' in the URL. To accomplish this right now, I have to create these two classes: com.dalewhalen.site.pages.houseplans.TwoStory com.dalewhalen.site.pages.houseplans.HousePlans (If you haven't read the rest of the postings on this topic, using houseplans.HousePlans was the only way I could find to accomplish this, though there seems to be a trailing '/' issue.) It would be nicer if Tapestry had a default page class (similar to 'index.html' in Apache) that could be placed inside of a package that would allow that class/page to appear when selecting that package/directory. It could be called 'index' or 'default' or anything else really, since you would never actually see the class/page name in the URL; only the package/directory name. Maybe 'packageDefault' ? Anyway, that's just one reason. The existence of 'pretty URLs' to some degree invites more direct user manipulation of the URL. It would be nice to be able to accommodate some of those more useful manipulations. patrick whalen wrote: > > Is there a way to create a page/class that has the same name as the > package it's in? It would be similar behavior to the way placing an > index.html file in a directory served by Apache will let you access that > file via the name of the directory, excluding 'index.html' in the URL. > > For example, in: > >com.mydomain.myapp.pages.subpackage1.* > > I could reference a page at: > >www.mydomain.com/myapp/subpackage1 > > I've tried creating a class under subpackage1 called 'Index' or 'Start', > but those didn't work. > > I've also tried creating a class under myapp.pages called (for this > example) 'Subpackage1'. This works, but then any pages/classes created > under the package pages.subpackage1 are ignored. As though when Tapestry > is reading the URL, it assumes i am referencing the class, and doesn't see > that there is also a matching package as well as more information in the > URL. > > One other behavior that seems related is that if I have the following page > class (and related html file): > >myapp.pages.project.projectinfo > > the URL: > >www.myapp.com/project/projectinfo > > doesn't work, but this URL: > >www.myapp.com/project/info > > does work. > > I'm new(ish), and have bounced in and out of tinkering with webapp > development for a while now. T5 has got me pretty close to being sucked > back in. > > Thanks much. patrick > -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12846148 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Page with same name as package
But visiting 'www.mydomain.com/myapp/package1' actually does work in that scenario, as long as there is a '/' at the end. And visiting 'www.mydomain.com/myapp/package1/package1/' doesn't work at all. This is actually what I was trying to accomplish, except for the fact that the absence of the trailing '/' causes the 404. (I tested, and it only does so in this scenario.) I assume that the first URL works, and the second URL doesn't, because of the URL filtering that you pointed out to me in the 'Component Classes' chapter. Because each package within the 'pages' package corresponds to a 'directory' in the URL, I would like for it to behave like a typical URL, so that deleting a portion of the URL back to a particular 'directory' will (if desired) cause an associated page to appear. This seems to work as long as in each package where this is desired, you place a class within that package that has the same name as the package. The only trouble is that it breaks if the trailing '/' is excluded. Chris Lewis-5 wrote: > > I'm afraid I don't understand your example: > > com.mydomain.myapp.pages.package1.Package1 > > then visit - > > www.mydomain.com/myapp/package1 > > > Of course this won't work, since 'package1' is not a page name. However > 'package1/package1' should. > As for your trailing slash issue, I've not seen that one and it > certainly should never occur. Do your tests again just to be sure, and > if you still get them then there may need to be a bug report. If this is > happening its likely a server issue (im using jetty and have never seen > that). > > chris > > > > -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12845926 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Page with same name as package
I'm afraid I don't understand your example: com.mydomain.myapp.pages.package1.Package1 then visit - www.mydomain.com/myapp/package1 Of course this won't work, since 'package1' is not a page name. However 'package1/package1' should. As for your trailing slash issue, I've not seen that one and it certainly should never occur. Do your tests again just to be sure, and if you still get them then there may need to be a bug report. If this is happening its likely a server issue (im using jetty and have never seen that). chris patrick whalen wrote: Strangely, this only works if there's another class in the same package, and you visit that page first. If you don't visit that page first, you get a 404 error. If you do, it works. After that, you can delete that other class and it will continue to work, even if you restart the application. To summarize: create - com.mydomain.myapp.pages.package1.Package1 then visit - www.mydomain.com/myapp/package1 returns a 404 error, unless you create - com.mydomain.myapp.pages.package1.TemporaryClass then visit - www.mydomain.com/myapp/package1/temporaryclass you will then be able to visit - www.mydomain.com/myapp/package1 without getting a 404 error. patrick whalen wrote: I see now that it does work to put a class of the same name as the package, inside the package. The redundant name is then filtered out.
Re: [T5] Page with same name as package
Ugh. Nevermind. Apparently I was excluding the final '/' in the URL. This apparently caused the 404 error. I've tested it a few times now, and that was the problem. Perhaps in the future Tapestry will automatically insert a missing '/' at the end for sloppy folks like myself. Sorry for the clutter. patrick whalen wrote: > > Strangely, this only works if there's another class in the same package, > and you visit that page first. If you don't visit that page first, you get > a 404 error. If you do, it works. After that, you can delete that other > class and it will continue to work, even if you restart the application. > > To summarize: > > create - > > com.mydomain.myapp.pages.package1.Package1 > > then visit - > > www.mydomain.com/myapp/package1 > > returns a 404 error, unless you create - > > com.mydomain.myapp.pages.package1.TemporaryClass > > then visit - > > www.mydomain.com/myapp/package1/temporaryclass > > you will then be able to visit - > > www.mydomain.com/myapp/package1 > > without getting a 404 error. > > > > > > patrick whalen wrote: >> >> I see now that it does work to put a class of the same name as the >> package, inside the package. The redundant name is then filtered out. >> >> > > -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12832189 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Page with same name as package
Strangely, this only works if there's another class in the same package, and you visit that page first. If you don't visit that page first, you get a 404 error. If you do, it works. After that, you can delete that other class and it will continue to work, even if you restart the application. To summarize: create - com.mydomain.myapp.pages.package1.Package1 then visit - www.mydomain.com/myapp/package1 returns a 404 error, unless you create - com.mydomain.myapp.pages.package1.TemporaryClass then visit - www.mydomain.com/myapp/package1/temporaryclass you will then be able to visit - www.mydomain.com/myapp/package1 without getting a 404 error. patrick whalen wrote: > > I see now that it does work to put a class of the same name as the > package, inside the package. The redundant name is then filtered out. > > -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12831853 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Page with same name as package
I see now that it does work to put a class of the same name as the package, inside the package. The redundant name is then filtered out. Chris Lewis-5 wrote: > > Check out: > > http://tapestry.apache.org/tapestry5/tapestry-core/guide/component-classes.html > > Specifically the section on "Sub-folders / Sub-packages." This deals > exactly with your situation. With your example: > > One other behavior that seems related is that if I have the following page > class (and related html file): > >myapp.pages.project.projectinfo > > the URL: > >www.myapp.com/project/projectinfo > > doesn't work, but this URL: > >www.myapp.com/project/info > > > You ran right in to a logical name transformation that T5 does on names. > Read that page - it should be clear after that. > > i_hate_screen_names wrote: >> Is there a way to create a page/class that has the same name as the >> package >> it's in? It would be similar behavior to the way placing an index.html >> file >> in a directory served by Apache will let you access that file via the >> name >> of the directory, excluding 'index.html' in the URL. >> >> For example, in: >> >>com.mydomain.myapp.pages.subpackage1.* >> >> I could reference a page at: >> >>www.mydomain.com/myapp/subpackage1 >> >> I've tried creating a class under subpackage1 called 'Index' or 'Start', >> but >> those didn't work. >> >> I've also tried creating a class under myapp.pages called (for this >> example) >> 'Subpackage1'. This works, but then any pages/classes created under the >> package pages.subpackage1 are ignored. As though when Tapestry is reading >> the URL, it assumes i am referencing the class, and doesn't see that >> there >> is also a matching package as well as more information in the URL. >> >> One other behavior that seems related is that if I have the following >> page >> class (and related html file): >> >>myapp.pages.project.projectinfo >> >> the URL: >> >>www.myapp.com/project/projectinfo >> >> doesn't work, but this URL: >> >>www.myapp.com/project/info >> >> does work. >> >> I'm new(ish), and have bounced in and out of tinkering with webapp >> development for a while now. T5 has got me pretty close to being sucked >> back >> in. >> >> Thanks much. patrick >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12830527 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Page with same name as package
Right in front of my nose. I practically stole my example right out of the chapter. Any insight though into the main part of my question where I am trying to create a page that has the same name as a package? It doesn't seem as though the optimizations described in that chapter should have an effect in this situation. Thanks. > For example, in: > >com.mydomain.myapp.pages.subpackage1.* > > I could reference a page at: > >www.mydomain.com/myapp/subpackage1 > -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12827544 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Page with same name as package
Check out: http://tapestry.apache.org/tapestry5/tapestry-core/guide/component-classes.html Specifically the section on "Sub-folders / Sub-packages." This deals exactly with your situation. With your example: One other behavior that seems related is that if I have the following page class (and related html file): myapp.pages.project.projectinfo the URL: www.myapp.com/project/projectinfo doesn't work, but this URL: www.myapp.com/project/info You ran right in to a logical name transformation that T5 does on names. Read that page - it should be clear after that. i_hate_screen_names wrote: Is there a way to create a page/class that has the same name as the package it's in? It would be similar behavior to the way placing an index.html file in a directory served by Apache will let you access that file via the name of the directory, excluding 'index.html' in the URL. For example, in: com.mydomain.myapp.pages.subpackage1.* I could reference a page at: www.mydomain.com/myapp/subpackage1 I've tried creating a class under subpackage1 called 'Index' or 'Start', but those didn't work. I've also tried creating a class under myapp.pages called (for this example) 'Subpackage1'. This works, but then any pages/classes created under the package pages.subpackage1 are ignored. As though when Tapestry is reading the URL, it assumes i am referencing the class, and doesn't see that there is also a matching package as well as more information in the URL. One other behavior that seems related is that if I have the following page class (and related html file): myapp.pages.project.projectinfo the URL: www.myapp.com/project/projectinfo doesn't work, but this URL: www.myapp.com/project/info does work. I'm new(ish), and have bounced in and out of tinkering with webapp development for a while now. T5 has got me pretty close to being sucked back in. Thanks much. patrick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] Page with same name as package
Is there a way to create a page/class that has the same name as the package it's in? It would be similar behavior to the way placing an index.html file in a directory served by Apache will let you access that file via the name of the directory, excluding 'index.html' in the URL. For example, in: com.mydomain.myapp.pages.subpackage1.* I could reference a page at: www.mydomain.com/myapp/subpackage1 I've tried creating a class under subpackage1 called 'Index' or 'Start', but those didn't work. I've also tried creating a class under myapp.pages called (for this example) 'Subpackage1'. This works, but then any pages/classes created under the package pages.subpackage1 are ignored. As though when Tapestry is reading the URL, it assumes i am referencing the class, and doesn't see that there is also a matching package as well as more information in the URL. One other behavior that seems related is that if I have the following page class (and related html file): myapp.pages.project.projectinfo the URL: www.myapp.com/project/projectinfo doesn't work, but this URL: www.myapp.com/project/info does work. I'm new(ish), and have bounced in and out of tinkering with webapp development for a while now. T5 has got me pretty close to being sucked back in. Thanks much. patrick -- View this message in context: http://www.nabble.com/-T5--Page-with-same-name-as-package-tf4497463.html#a12826135 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]