You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by anantasthana <an...@gmail.com> on 2011/10/20 21:36:15 UTC

Request mapping

I am trying to map my requests in a special way to achieve a very simple
purpose

say the root website is abc.com and has several users and each use has a
home page , admin page , requests page etc 
let us asume we have uers user1 and user 2
i want the urls to be coded as 

abc.com/user1/admin

abc.com/user1/home

abc.com/user1/requests

so basicaly abc.com/user1/home is the home page for user 1 and
abc.com/user1/admin is the the admin page for user 1

any help is welcome.
Thanks
Anant

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3923220.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: Request mapping

Posted by anantasthana <an...@gmail.com>.
Thanks martin this is exactly what I was looking for.
-----Original Message-----
From: "Martin Grigorov-4 [via Apache Wicket]" <ml...@n4.nabble.com>
Date: Thu, 20 Oct 2011 23:41:54 
To: anantasthana<an...@gmail.com>
Subject: Re: Request mapping



Application#getHomePage() can be dynamic:

@Override
public Class<? extends Page> getHomePage() {
   if (MySession.get().isLoggedIn()) {
      return AuthenticatedHomePage.class;
   } else {
    return NonAuthenticatedHomePage.class;
   }
}

mountPage("/", NonAuthenticatedHomePage.class);
mountPage("/${userId}/home", AuthenticatedHomePage.class);
mountPage("/${userId}/admin", AdminPage.class);

used with:
PageParameters params = new PageParameters();
if (MySession.get().isLoggedIn()) {
   String userId = MySession.get().getUser().getId();
   params.set("userId", userId);
}
linkToHome = new BookmarkablePageLink<Void>("someId",
getApplication().getHomePage(), params);

On Thu, Oct 20, 2011 at 10:36 PM, anantasthana <an...@gmail.com> wrote:
> I am trying to map my requests in a special way to achieve a very simple
> purpose
>
> say the root website is abc.com and has several users and each use has a
> home page , admin page , requests page etc
> let us asume we have uers user1 and user 2
> i want the urls to be coded as
>
> abc.com/user1/admin
>
> abc.com/user1/home
>
> abc.com/user1/requests
>
> so basicaly abc.com/user1/home is the home page for user 1 and
> abc.com/user1/admin is the the admin page for user 1
>
> any help is welcome.
> Thanks
> Anant
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3923220.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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3924434.html

To unsubscribe from Request mapping, visit http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3923220&code=YW5hbnQuYXN0eUBnbWFpbC5jb218MzkyMzIyMHwxOTU2OTQ5NjMy


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3924436.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: Request mapping

Posted by Martin Grigorov <mg...@apache.org>.
Application#getHomePage() can be dynamic:

@Override
public Class<? extends Page> getHomePage() {
   if (MySession.get().isLoggedIn()) {
      return AuthenticatedHomePage.class;
   } else {
    return NonAuthenticatedHomePage.class;
   }
}

mountPage("/", NonAuthenticatedHomePage.class);
mountPage("/${userId}/home", AuthenticatedHomePage.class);
mountPage("/${userId}/admin", AdminPage.class);

used with:
PageParameters params = new PageParameters();
if (MySession.get().isLoggedIn()) {
   String userId = MySession.get().getUser().getId();
   params.set("userId", userId);
}
linkToHome = new BookmarkablePageLink<Void>("someId",
getApplication().getHomePage(), params);

On Thu, Oct 20, 2011 at 10:36 PM, anantasthana <an...@gmail.com> wrote:
> I am trying to map my requests in a special way to achieve a very simple
> purpose
>
> say the root website is abc.com and has several users and each use has a
> home page , admin page , requests page etc
> let us asume we have uers user1 and user 2
> i want the urls to be coded as
>
> abc.com/user1/admin
>
> abc.com/user1/home
>
> abc.com/user1/requests
>
> so basicaly abc.com/user1/home is the home page for user 1 and
> abc.com/user1/admin is the the admin page for user 1
>
> any help is welcome.
> Thanks
> Anant
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3923220.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
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Request mapping

Posted by anantasthana <an...@gmail.com>.
Also I know with that I can do abc.com/users/user1
But would it work if I do 
abc.com/users/user1/testimonials
Which means the testimonials page for user1? I know how to implement the first scenario.. But I just can't figure out the second

-----Original Message-----
From: "Ernesto Reinaldo Barreiro-4 [via Apache Wicket]" <ml...@n4.nabble.com>
Date: Thu, 20 Oct 2011 23:28:31 
To: anantasthana<an...@gmail.com>
Subject: Re: Request mapping



Anant,

Maybe you can use IndexedParamUrlCodingStrategy to solve your problem...?

Regards,

Ernesto

On Thu, Oct 20, 2011 at 9:36 PM, anantasthana <an...@gmail.com> wrote:
> I am trying to map my requests in a special way to achieve a very simple
> purpose
>
> say the root website is abc.com and has several users and each use has a
> home page , admin page , requests page etc
> let us asume we have uers user1 and user 2
> i want the urls to be coded as
>
> abc.com/user1/admin
>
> abc.com/user1/home
>
> abc.com/user1/requests
>
> so basicaly abc.com/user1/home is the home page for user 1 and
> abc.com/user1/admin is the the admin page for user 1
>
> any help is welcome.
> Thanks
> Anant
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3923220.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



_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3924424.html

To unsubscribe from Request mapping, visit http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3923220&code=YW5hbnQuYXN0eUBnbWFpbC5jb218MzkyMzIyMHwxOTU2OTQ5NjMy


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3924427.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: Request mapping

Posted by anantasthana <an...@gmail.com>.
Does it work with wicket 1.5 as well?? I know its there till 1.4v
-----Original Message-----
From: "Ernesto Reinaldo Barreiro-4 [via Apache Wicket]" <ml...@n4.nabble.com>
Date: Thu, 20 Oct 2011 23:28:31 
To: anantasthana<an...@gmail.com>
Subject: Re: Request mapping



Anant,

Maybe you can use IndexedParamUrlCodingStrategy to solve your problem...?

Regards,

Ernesto

On Thu, Oct 20, 2011 at 9:36 PM, anantasthana <an...@gmail.com> wrote:
> I am trying to map my requests in a special way to achieve a very simple
> purpose
>
> say the root website is abc.com and has several users and each use has a
> home page , admin page , requests page etc
> let us asume we have uers user1 and user 2
> i want the urls to be coded as
>
> abc.com/user1/admin
>
> abc.com/user1/home
>
> abc.com/user1/requests
>
> so basicaly abc.com/user1/home is the home page for user 1 and
> abc.com/user1/admin is the the admin page for user 1
>
> any help is welcome.
> Thanks
> Anant
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3923220.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



_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3924424.html

To unsubscribe from Request mapping, visit http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3923220&code=YW5hbnQuYXN0eUBnbWFpbC5jb218MzkyMzIyMHwxOTU2OTQ5NjMy


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3924426.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: Request mapping

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Anant,

Maybe you can use IndexedParamUrlCodingStrategy to solve your problem...?

Regards,

Ernesto

On Thu, Oct 20, 2011 at 9:36 PM, anantasthana <an...@gmail.com> wrote:
> I am trying to map my requests in a special way to achieve a very simple
> purpose
>
> say the root website is abc.com and has several users and each use has a
> home page , admin page , requests page etc
> let us asume we have uers user1 and user 2
> i want the urls to be coded as
>
> abc.com/user1/admin
>
> abc.com/user1/home
>
> abc.com/user1/requests
>
> so basicaly abc.com/user1/home is the home page for user 1 and
> abc.com/user1/admin is the the admin page for user 1
>
> any help is welcome.
> Thanks
> Anant
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Request-mapping-tp3923220p3923220.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