Re: Mount a page class more than once.
Martin- Thanks for your help. I had a look at #getCompatabilityScore and #checkPageClass on IRequestMapper. I extended the MountedMapper class, and added some debug messages to help me follow what was going on. After a while I experimented with the class and came up with the following solution: It's a clunky solution but it gets the job done for me. I'll be able to put together something better when I have some more time. Also the reason I'm calling Mapper#add instead of #mountPage is that I am storing the MountedMapper instance for use at a later time. Thanks again. -Josh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-class-more-than-once-tp4659173p4659191.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Mount a page class more than once.
On Fri, May 31, 2013 at 9:37 AM, Martin Grigorov wrote: > #mountPage("/test1.html", MyPageClass1.class) Moreover, it's usually a good idea to have different classes so you can build your link to these pages easily. -- Guillaume - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Mount a page class more than once.
Hi, It won't work as you did it. Wicket's IRequestMapper uses #getCompatibilityScore() to decide which mapper to use to handle a request. If the scores for several mappers are the same then the order of their definition is used. Since "test3" is added last it has the highest priority. Later when Wicket needs to create a Url to a page (class) the mapper with the highest priority will be used. A simple workaround for you is to define 3 additional pages which just extend MyPageClass. They will have only the same constructors as MyPageClass, nothing more. Even the markup will be inherited. This way you can use different page types for the different urls. You can use #mountPage("/test1.html", MyPageClass1.class) instead of ICompoundRequestMapper mapper = getRootRequestMapperAsCompound(); mapper.add(new MountedMapper("/test1.html", MyPageClass1.class)); It is the same. On Fri, May 31, 2013 at 12:40 AM, josho wrote: > Hello all, > > I have been using Wicket for about 1 year now for our company website. It > has been working great. Recently we have decided to make the switch from > Wicket 1.4.22 to 6.8.0. After moving all the code to the new library we are > still having 1 problem. I am mounting several html pages against the same > class (they all require some login/cart information to be generated by > wicket, but have different content) like so: > > ICompoundRequestMapper mapper = getRootRequestMapperAsCompound(); > mapper.add(new MountedMapper("/test1.html", MyPageClass.class)); > mapper.add(new MountedMapper("/test2.html", MyPageClass.class)); > mapper.add(new MountedMapper("/test3.html", MyPageClass.class)); > > When I attempt to access "/test1.html" or "/test2.html" in my browser, the > server sends a 302 Redirect to "/test3.html" (the last page mounted). All > my > other classes with unique names are accessible (all extend this class as > well). > > I have extended the ResourceStreamLocator class, and am filtering on URL, > however the locator never recieves the first request. Previously we worked > around this issue by not allowing "MyPageClass.class" to have cached > markup. > However that solution is no longer working. I have made several searches on > Google and nabble for a solution, but no one seems to be in the same boat > as > me. > > Any help is appreciated. > > -Josh > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-class-more-than-once-tp4659173.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
RE: Mount a page class more than once.
Paul- Thanks for your reply. Currently we have a couple dozen semi static pages on our website. Things like company history, contact a sales rep and other bits of information. All of these have some small bit of login/cart information generated by wicket but the content to all these is generally different. Other more intensive pages have their own respective page class. Also, this was working in 1.4.22 but looking back it seems like we might have been exploiting a glitch rather than using wicket as intended. I'll start digging deeper into RequestMapper and other close by classes tomorrow. If you have any more ideas I would be grateful. Thank you -Josh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-class-more-than-once-tp4659173p4659176.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Mount a page class more than once.
You have an interesting use-case. I tried the following on my webapp inside my Application's init() method: mountPage("test1", Page.class); mountPage("test2", Page.class); mountPage("test3", Page.class); Navigating to either /test1 or /test2 would redirect me to /test3. I think what you want to do is clarify your use-case and perhaps look into using page parameters. ~ Thank you, Paul Bors -Original Message- From: josho [mailto:josh.oliv...@hotmail.com] Sent: Thursday, May 30, 2013 5:40 PM To: users@wicket.apache.org Subject: Mount a page class more than once. Hello all, I have been using Wicket for about 1 year now for our company website. It has been working great. Recently we have decided to make the switch from Wicket 1.4.22 to 6.8.0. After moving all the code to the new library we are still having 1 problem. I am mounting several html pages against the same class (they all require some login/cart information to be generated by wicket, but have different content) like so: ICompoundRequestMapper mapper = getRootRequestMapperAsCompound(); mapper.add(new MountedMapper("/test1.html", MyPageClass.class)); mapper.add(new MountedMapper("/test2.html", MyPageClass.class)); mapper.add(new MountedMapper("/test3.html", MyPageClass.class)); When I attempt to access "/test1.html" or "/test2.html" in my browser, the server sends a 302 Redirect to "/test3.html" (the last page mounted). All my other classes with unique names are accessible (all extend this class as well). I have extended the ResourceStreamLocator class, and am filtering on URL, however the locator never recieves the first request. Previously we worked around this issue by not allowing "MyPageClass.class" to have cached markup. However that solution is no longer working. I have made several searches on Google and nabble for a solution, but no one seems to be in the same boat as me. Any help is appreciated. -Josh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-class-more-than-once -tp4659173.html Sent from the Users forum mailing list archive at Nabble.com. - 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
Mount a page class more than once.
Hello all, I have been using Wicket for about 1 year now for our company website. It has been working great. Recently we have decided to make the switch from Wicket 1.4.22 to 6.8.0. After moving all the code to the new library we are still having 1 problem. I am mounting several html pages against the same class (they all require some login/cart information to be generated by wicket, but have different content) like so: ICompoundRequestMapper mapper = getRootRequestMapperAsCompound(); mapper.add(new MountedMapper("/test1.html", MyPageClass.class)); mapper.add(new MountedMapper("/test2.html", MyPageClass.class)); mapper.add(new MountedMapper("/test3.html", MyPageClass.class)); When I attempt to access "/test1.html" or "/test2.html" in my browser, the server sends a 302 Redirect to "/test3.html" (the last page mounted). All my other classes with unique names are accessible (all extend this class as well). I have extended the ResourceStreamLocator class, and am filtering on URL, however the locator never recieves the first request. Previously we worked around this issue by not allowing "MyPageClass.class" to have cached markup. However that solution is no longer working. I have made several searches on Google and nabble for a solution, but no one seems to be in the same boat as me. Any help is appreciated. -Josh -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-class-more-than-once-tp4659173.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org