You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Objelean <al...@gmail.com> on 2010/10/20 07:28:00 UTC

Mount a page to root path in wicket 1.5


Hi! 
Is it possible to mount a page to root path ("/") in latest wicket 1.5
branch? 

Thanks! 
Alex
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003270.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: Mount a page to root path in wicket 1.5

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Wed, Oct 20, 2010 at 12:28 AM, Alex Objelean <al...@gmail.com>wrote:

>
>
> Hi!
> Is it possible to mount a page to root path ("/") in latest wicket 1.5
> branch?
>
> Thanks!
> Alex
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003270.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
>
>
Yes - see the notes in HomePageMapper, and you can also see the
wicket-examples RequestMapperApplication class.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Re: Mount a page to root path in wicket 1.5

Posted by Alex Objelean <al...@gmail.com>.
No, it seems that if nothing is mount, it redirects to the following
location:

"/" -> "/wicket/bookmarkable/com.mycompany.page.HomePage"

What would I expect is to access the HomePage with "/".
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003337.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: Mount a page to root path in wicket 1.5

Posted by phill <ph...@smershnet.com>.

Martin Grigorov-4 wrote:
> 
> See WICKET-3126. I attached a patch and unit tests.
> Now the Url is stable - always "/".
> 
> The problem comes when the user application wants to re-map to different
> class than application#getHomePage - MountedMapper("/", ...) believes that
> *all* requests to bookmarkable pages (/wicket/bookmarkable/com.xyz.MyPage)
> are targeted to "/" and the rest are indexed parameters...
> So it is not quite true what I said in my previous mail.
> 

With 1.5-M3 doing mountPage("/", getHomePage()) seems to mess up the paths
to my CSS files, both in the homepage and elsewhere. I'm using a behaviour
to add the links relative to context root:

public void renderHead(IHeaderResponse response) {
        response.renderCSSReference("css/main.css", "screen projection");
} 
With home page mounted on "/" gives this link which is incorrect and doesn't
take into account the context root.
<link rel="stylesheet" type="text/css" href="css/main.css" media="screen
projection" />

With the default home page mount "<context
root>/wicket/bookmarkable/com.xyz.MyHomePage" the link is as follows and
works fine.
<link rel="stylesheet" type="text/css" href="../../css/main.css"
media="screen projection" />
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3165707.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: Mount a page to root path in wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
See WICKET-3126. I attached a patch and unit tests.
Now the Url is stable - always "/".

The problem comes when the user application wants to re-map to different
class than application#getHomePage - MountedMapper("/", ...) believes that
*all* requests to bookmarkable pages (/wicket/bookmarkable/com.xyz.MyPage)
are targeted to "/" and the rest are indexed parameters...
So it is not quite true what I said in my previous mail.

On Wed, Oct 20, 2010 at 6:03 PM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> >
> > > By default, if you go to /, it will redirect you to wherever the class
> > > returned by getHomePage() is otherwise mounted.  I think he wants to
> > > maintain the / in the address bar.  Also, a bookmarkable link to your
> > home
> > > page class wouldn't actually link to /, but to the otherwise mounted
> url.
> > >
> >
> > I also find it strange to redirect to
> > /wicket/bookmarkable/com.example.MyPage after request to '/'.
> > The other day we discussed it in irc with Igor and that's why we made
> > possible to mount at '/'.
> > In the commit message I also added an idea: remove HomePageMapper and in
> > App#internalInit() always do mountPage("/", getHomePage())
> > This way '/' is always '/'.
> > If the user still wants to mount '/' to something else than
> > App#getHomePage() then she can always add another mapper which:
> >  * will be asked first because added later mapper are asked before the
> > older ones with the same compat score
> >  * may have a higher compat score
> >
> > WDYT?
> >
>
> I think that's a great idea, as long as it is easy (like you say it is) to
> override that mount with a single line.
>
> --
> Jeremy Thomerson
> http://wickettraining.com
> *Need a CMS for Wicket?  Use Brix! http://brixcms.org*
>

Re: Mount a page to root path in wicket 1.5

Posted by Jeremy Thomerson <je...@wickettraining.com>.
>
> > By default, if you go to /, it will redirect you to wherever the class
> > returned by getHomePage() is otherwise mounted.  I think he wants to
> > maintain the / in the address bar.  Also, a bookmarkable link to your
> home
> > page class wouldn't actually link to /, but to the otherwise mounted url.
> >
>
> I also find it strange to redirect to
> /wicket/bookmarkable/com.example.MyPage after request to '/'.
> The other day we discussed it in irc with Igor and that's why we made
> possible to mount at '/'.
> In the commit message I also added an idea: remove HomePageMapper and in
> App#internalInit() always do mountPage("/", getHomePage())
> This way '/' is always '/'.
> If the user still wants to mount '/' to something else than
> App#getHomePage() then she can always add another mapper which:
>  * will be asked first because added later mapper are asked before the
> older ones with the same compat score
>  * may have a higher compat score
>
> WDYT?
>

I think that's a great idea, as long as it is easy (like you say it is) to
override that mount with a single line.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Re: Mount a page to root path in wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Oct 20, 2010 at 5:00 PM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> On Wed, Oct 20, 2010 at 6:41 AM, James Carman <james@carmanconsulting.com
> >wrote:
>
> > Shouldn't "/" always go to the home page?  Why should we have to map
> that?
> >
> >
> By default, if you go to /, it will redirect you to wherever the class
> returned by getHomePage() is otherwise mounted.  I think he wants to
> maintain the / in the address bar.  Also, a bookmarkable link to your home
> page class wouldn't actually link to /, but to the otherwise mounted url.
>

I also find it strange to redirect to
/wicket/bookmarkable/com.example.MyPage after request to '/'.
The other day we discussed it in irc with Igor and that's why we made
possible to mount at '/'.
In the commit message I also added an idea: remove HomePageMapper and in
App#internalInit() always do mountPage("/", getHomePage())
This way '/' is always '/'.
If the user still wants to mount '/' to something else than
App#getHomePage() then she can always add another mapper which:
  * will be asked first because added later mapper are asked before the
older ones with the same compat score
  * may have a higher compat score

WDYT?

>
> --
> Jeremy Thomerson
> http://wickettraining.com
> *Need a CMS for Wicket?  Use Brix! http://brixcms.org*
>

Re: Mount a page to root path in wicket 1.5

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Wed, Oct 20, 2010 at 6:41 AM, James Carman <ja...@carmanconsulting.com>wrote:

> Shouldn't "/" always go to the home page?  Why should we have to map that?
>
>
By default, if you go to /, it will redirect you to wherever the class
returned by getHomePage() is otherwise mounted.  I think he wants to
maintain the / in the address bar.  Also, a bookmarkable link to your home
page class wouldn't actually link to /, but to the otherwise mounted url.

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Re: Mount a page to root path in wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
You don't have to map it.
HomePageMapper is pre-installed for you and it will handle '/'.
Now it is possible to register custom mapper to handle '/' and use whichever
Page you want.

Before the commit I mentioned in my previous email it wasn't possible to
mount anything at '/'.

On Wed, Oct 20, 2010 at 1:41 PM, James Carman <ja...@carmanconsulting.com>wrote:

> Shouldn't "/" always go to the home page?  Why should we have to map that?
>
> On Wed, Oct 20, 2010 at 3:05 AM, Martin Grigorov <mg...@apache.org>
> wrote:
> > Since 2 days it is possible to do: MyApp#init() { mountPage("/",
> > MyPage.class)}
> >
> > As I said you need latest trunk for that.
> >
> > Otherwise, you'll need to create your own custom mapper for that. Note:
> It
> > needs to have higher compatibilityScore than the default.
> >
> > On Wed, Oct 20, 2010 at 8:47 AM, Alex Objelean <alex.objelean@gmail.com
> >wrote:
> >
> >>
> >> So you suggest to create something like CustomHomeMapper in order to be
> >> able
> >> to mount a page to root?
> >> If it is true, shouldn't it be possible to have this feature out of the
> >> box?
> >> --
> >> View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003344.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
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Mount a page to root path in wicket 1.5

Posted by James Carman <ja...@carmanconsulting.com>.
Shouldn't "/" always go to the home page?  Why should we have to map that?

On Wed, Oct 20, 2010 at 3:05 AM, Martin Grigorov <mg...@apache.org> wrote:
> Since 2 days it is possible to do: MyApp#init() { mountPage("/",
> MyPage.class)}
>
> As I said you need latest trunk for that.
>
> Otherwise, you'll need to create your own custom mapper for that. Note: It
> needs to have higher compatibilityScore than the default.
>
> On Wed, Oct 20, 2010 at 8:47 AM, Alex Objelean <al...@gmail.com>wrote:
>
>>
>> So you suggest to create something like CustomHomeMapper in order to be
>> able
>> to mount a page to root?
>> If it is true, shouldn't it be possible to have this feature out of the
>> box?
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003344.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
>>
>>
>

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


Re: Mount a page to root path in wicket 1.5

Posted by Alex Objelean <al...@gmail.com>.
Good to know, thanks!
When a new milestone will be available?

Thanks!
Alex

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003369.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: Mount a page to root path in wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Since 2 days it is possible to do: MyApp#init() { mountPage("/",
MyPage.class)}

As I said you need latest trunk for that.

Otherwise, you'll need to create your own custom mapper for that. Note: It
needs to have higher compatibilityScore than the default.

On Wed, Oct 20, 2010 at 8:47 AM, Alex Objelean <al...@gmail.com>wrote:

>
> So you suggest to create something like CustomHomeMapper in order to be
> able
> to mount a page to root?
> If it is true, shouldn't it be possible to have this feature out of the
> box?
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003344.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: Mount a page to root path in wicket 1.5

Posted by Alex Objelean <al...@gmail.com>.
So you suggest to create something like CustomHomeMapper in order to be able
to mount a page to root?
If it is true, shouldn't it be possible to have this feature out of the box?
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003344.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: Mount a page to root path in wicket 1.5

Posted by James Carman <ja...@carmanconsulting.com>.
Isn't that the "home" page?

On Wed, Oct 20, 2010 at 1:28 AM, Alex Objelean <al...@gmail.com> wrote:
>
>
> Hi!
> Is it possible to mount a page to root path ("/") in latest wicket 1.5
> branch?
>
> Thanks!
> Alex
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mount-a-page-to-root-path-in-wicket-1-5-tp3003270p3003270.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
>
>

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