You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by armandoxxx <ar...@dropchop.com> on 2014/01/28 15:24:35 UTC

How to resolve page from url part without (hardcoded) mapping in application class

Hey guys 

I'm working on some dynamic page loading and would like to know how it's
supposed to be done in wicket (6.x) ... without mappings in my application
class. 

The example: 
some urls (for example /news, /article, /people) are bind by users (in admin
console) to a some page ... 
/news >> LayoutPage1 
/article >> LayoutPage2
/people >> LayoutPage1
this mapping is written in database and not in application class, because
users can set whatever URL and select whatever page to be shown for that
URL.

I would like know where to put this resolving from URL TO PAGE and how to
render the page ... 

Any help would be appreciated


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to resolve page from url part without (hardcoded) mapping in application class

Posted by armandoxxx <ar...@dropchop.com>.
Thank you ! 

Regards

Armando

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992p4663995.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to resolve page from url part without (hardcoded) mapping in application class

Posted by armandoxxx <ar...@dropchop.com>.
this will do .. thank you ! 

Regards

Armando

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992p4664003.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to resolve page from url part without (hardcoded) mapping in application class

Posted by armandoxxx <ar...@dropchop.com>.
thank you again ... works like a charm ;)

Regards

Armando

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992p4664012.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to resolve page from url part without (hardcoded) mapping in application class

Posted by Martin Grigorov <mg...@apache.org>.
You have to setup your mapper as root and keep the old root mapper as a
delegate.
See
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java?source=c#L54

If your mapper resolves a page for the current url then return
RenderPageRequestHandler(new PageProvider(SomePage.class)).
If there is no match then use the delegate to resolve it.
See
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java?source=c#L92

Martin Grigorov
Wicket Training and Consulting


On Tue, Jan 28, 2014 at 4:52 PM, armandoxxx <ar...@dropchop.com>wrote:

> Hey ...
>
> sorry but I don't understand
>
> the problem is that chain property in custom mapper is set upon
> initialization in application class and it sets page ..
> getRootRequestMapperAsCompound().add(new LocaleFirstMapper(new
> MountedMapper("/localized", LocalizedPage.class)));
>
> I'm trying to figure out how to do this in custom IRequestMapper
> implementation since my Page Class will change on each request ...
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992p4663997.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to resolve page from url part without (hardcoded) mapping in application class

Posted by armandoxxx <ar...@dropchop.com>.
Hey ... 

sorry but I don't understand 

the problem is that chain property in custom mapper is set upon
initialization in application class and it sets page .. 
getRootRequestMapperAsCompound().add(new LocaleFirstMapper(new
MountedMapper("/localized", LocalizedPage.class)));

I'm trying to figure out how to do this in custom IRequestMapper
implementation since my Page Class will change on each request ... 


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992p4663997.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to resolve page from url part without (hardcoded) mapping in application class

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use custom IRequestMapper that reads the url and asks the DB which
page to use.
Use WebApplication#setRootRequestMapper() to set it.
See
https://github.com/apache/wicket/blob/master/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?source=c

https://github.com/apache/wicket/blob/master/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/RequestMapperApplication.java#L55
for example


Martin Grigorov
Wicket Training and Consulting


On Tue, Jan 28, 2014 at 3:24 PM, armandoxxx <ar...@dropchop.com>wrote:

> Hey guys
>
> I'm working on some dynamic page loading and would like to know how it's
> supposed to be done in wicket (6.x) ... without mappings in my application
> class.
>
> The example:
> some urls (for example /news, /article, /people) are bind by users (in
> admin
> console) to a some page ...
> /news >> LayoutPage1
> /article >> LayoutPage2
> /people >> LayoutPage1
> this mapping is written in database and not in application class, because
> users can set whatever URL and select whatever page to be shown for that
> URL.
>
> I would like know where to put this resolving from URL TO PAGE and how to
> render the page ...
>
> Any help would be appreciated
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-resolve-page-from-url-part-without-hardcoded-mapping-in-application-class-tp4663992.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>