Re: [1.5] new wicket URL-related questions

2010-08-28 Thread Antoine van Wel
 Q2: (a little n00b question) how can I find out which component makes my
 page stateful?


Check the wicket-devutils and StatelessChecker. It allows you to use an
annotation to validate the component is really stateless.


Antoine


Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Major Péter
Hi,

see inline

 Usually it is a component that returns false in isStateless or
 generates a stateful listener interface URL.

okay, but how did the 1.4 have nice url in browser bar and Ajax working
without this tweak? I mean this new ?number style urls are a bit ugly
IMHO, and I have many ajaxified pages, so I don't know how to deal with
this right now..

 when I try to hit the URL now:
 showuser/id/1234
 then I'm going to have indexed parameters and not named parameter with
 'id' name. Q3: Why is that?
 
 Because it's not a named paramerer (by default). The URL in question
 will have two indexed parameters. id and 1234.
 Big problem in 1.4 was that there was no distinction between indexed
 parameters (part of path) and named parameters (usually part query
 string). So it was difficult to build URLs such as
 showpage/13?sort=asc
 
 1.5 fixes this by defining URL scheme like this:
 
 /page/mount/path/indexed-param0/indexed-param1?named1=value1name2=value2
 
 Btw. you should be able to mount the url in question as
 showuser/id/{user-id}
 wicket should then make user-id a named parameter.

well, I've tried this with this quickstart:
http://aldaris.sch.bme.hu/quick.tar.gz
, but this really didn't worked. Also on my bigger project I was seeing
weird redirections:
* the app is on / contextroot
* the homepage could have parameters, but it's not mandatory
* and it's mapped to /app/show and /app/show/id/{id} too
now when I open / I get redirected to /app/show/id/{id}?3
when I open /app/show/id/123 then I got redirected to
/app/show/id/{id}/show/id/123?4

 It is still the same page instance. Obviously in your case you take
 the page parameters into account only in page constructor. So when you
 later change the id value (but leave page id the same) nothing
 changes.
 
 However if  you for example override page onBeforeRender() and call
 getPageParameters() there the id parameter will have proper value.

so people should move model bindings to onBeforeRender, or move to
stateless pages to be able to do this? Can't you store that page id
somewhere else?

 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??
 
 You can either set id and 1234 as indexed parameters or mount the page
 as /showuser/id/{user-id}

Probably my code is guilty, can you go through my quickstart?

Thank you,
Peter

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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Matej Knopp
2010/8/24 Major Péter majorpe...@sch.bme.hu:
 Hi,

 see inline

 Usually it is a component that returns false in isStateless or
 generates a stateful listener interface URL.

 okay, but how did the 1.4 have nice url in browser bar and Ajax working
 without this tweak? I mean this new ?number style urls are a bit ugly
 IMHO, and I have many ajaxified pages, so I don't know how to deal with
 this right now..
If you use regular bookmarkable pages in 1.4  with Ajax and refresh
the page then all your Ajax state is gone! This is why URLS are hybrid
by default in 1.5.

 when I try to hit the URL now:
 showuser/id/1234
 then I'm going to have indexed parameters and not named parameter with
 'id' name. Q3: Why is that?

 Because it's not a named paramerer (by default). The URL in question
 will have two indexed parameters. id and 1234.
 Big problem in 1.4 was that there was no distinction between indexed
 parameters (part of path) and named parameters (usually part query
 string). So it was difficult to build URLs such as
 showpage/13?sort=asc

 1.5 fixes this by defining URL scheme like this:

 /page/mount/path/indexed-param0/indexed-param1?named1=value1name2=value2

 Btw. you should be able to mount the url in question as
 showuser/id/{user-id}
 wicket should then make user-id a named parameter.

 well, I've tried this with this quickstart:
 http://aldaris.sch.bme.hu/quick.tar.gz
 , but this really didn't worked. Also on my bigger project I was seeing
 weird redirections:
 * the app is on / contextroot
 * the homepage could have parameters, but it's not mandatory
 * and it's mapped to /app/show and /app/show/id/{id} too
 now when I open / I get redirected to /app/show/id/{id}?3
 when I open /app/show/id/123 then I got redirected to
 /app/show/id/{id}/show/id/123?4
I don't think you can mount same page twice.

 It is still the same page instance. Obviously in your case you take
 the page parameters into account only in page constructor. So when you
 later change the id value (but leave page id the same) nothing
 changes.

 However if  you for example override page onBeforeRender() and call
 getPageParameters() there the id parameter will have proper value.

 so people should move model bindings to onBeforeRender, or move to
 stateless pages to be able to do this? Can't you store that page id
 somewhere else?
Huh? Why should we store it somewhere else? It's part of page
parameters. Page parameters are current page parameters for the
requests. You can use models properly and reload the data on every
request (by quering getPageParameters().getNamedParameter(user-id)
for the id.

 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??

 You can either set id and 1234 as indexed parameters or mount the page
 as /showuser/id/{user-id}

 Probably my code is guilty, can you go through my quickstart?
You didn't put any code in the archive, just class files.

-Matej

 Thank you,
 Peter

 -
 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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Peter Ertl
matej: So the new convention is that named parameters are always query string 
parameters?


Am 24.08.2010 um 02:13 schrieb Matej Knopp:

 Hi,
 
 see the replies below
 
 2010/8/23 Major Péter majorpe...@sch.bme.hu:
 Hi!
 
 As I'm testing wicket 1.5-SNAPSHOT, I'm seeing some strange behaviors:
 With 1.4 I've used to have url's like:
 showuser/id/1234
 now when I open simply the page without params, I will see the following
 URL:
 showuser?[0-9]+
 
 The number after ? is page id. Since wicket is a stateful framework
 (by default) we need to track page instances.
 
 When I looked at the JavaDoc of the new MountMapper (which is the
 replacement for mountBookmarkablePage), I saw that I'm having this URL,
 because my page is not stateless.
 
 In a way, yes. Stateless pages generally do not have page ids in URL.
 
 Q1: with 1.4 this was possible, because the URL contained the pagemap
 instance number, or is there something else?
 Q2: (a little n00b question) how can I find out which component makes my
 page stateful?
 
 Usually it is a component that returns false in isStateless or
 generates a stateful listener interface URL.
 
 
 when I try to hit the URL now:
 showuser/id/1234
 then I'm going to have indexed parameters and not named parameter with
 'id' name. Q3: Why is that?
 
 Because it's not a named paramerer (by default). The URL in question
 will have two indexed parameters. id and 1234.
 Big problem in 1.4 was that there was no distinction between indexed
 parameters (part of path) and named parameters (usually part query
 string). So it was difficult to build URLs such as
 showpage/13?sort=asc
 
 1.5 fixes this by defining URL scheme like this:
 
 /page/mount/path/indexed-param0/indexed-param1?named1=value1name2=value2
 
 Btw. you should be able to mount the url in question as
 showuser/id/{user-id}
 
 wicket should then make user-id a named parameter.
 
 if I have a page with URL in browser:
 showuser?8id=123
 and I rewrite the id to 124, then I'm going to still see the page for
 123, which is really disturbing! Q4: is there a solution for this to
 work? Or should I make my page stateless to be able to do this?? (How?)
 
 It is still the same page instance. Obviously in your case you take
 the page parameters into account only in page constructor. So when you
 later change the id value (but leave page id the same) nothing
 changes.
 
 However if  you for example override page onBeforeRender() and call
 getPageParameters() there the id parameter will have proper value.
 
 
 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??
 
 You can either set id and 1234 as indexed parameters or mount the page
 as /showuser/id/{user-id}
 
 -Matej
 
 
 Thanks for your help.
 
 Best Regards,
 Peter Major
 
 -
 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
 


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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Major Péter
 okay, but how did the 1.4 have nice url in browser bar and Ajax working
 without this tweak? I mean this new ?number style urls are a bit ugly
 IMHO, and I have many ajaxified pages, so I don't know how to deal with
 this right now..
 If you use regular bookmarkable pages in 1.4  with Ajax and refresh
 the page then all your Ajax state is gone! This is why URLS are hybrid
 by default in 1.5.

I don't mind that, is there a way to change the default?

 I don't think you can mount same page twice.

Okay, how can I create aliases for a page then? And how could I create a
nice url for parameterless and 'parameterful' pages? like /show shows a
user own profile, and /show/id/{id} shows another users profile?

 Huh? Why should we store it somewhere else? It's part of page
 parameters. Page parameters are current page parameters for the
 requests. You can use models properly and reload the data on every
 request (by quering getPageParameters().getNamedParameter(user-id)
 for the id.

I don't think you're using http referers to find out which page did the
request came from, I think you're using the browser bar URL when you
create the links for the page content. So the links on the page are
already containing the page id's, that's great. But the browser bar URL
is not used for anything after page rendering, or?

 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??

 You can either set id and 1234 as indexed parameters or mount the page
 as /showuser/id/{user-id}

 Probably my code is guilty, can you go through my quickstart?
 You didn't put any code in the archive, just class files.

doh, right.. The working url is http://aldaris.sch.bme.hu/myproject.tar.gz
Just execute a mvn jetty:run and see how it 'works'.

Thanks,
Peter

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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Matej Knopp
On Tue, Aug 24, 2010 at 11:47 AM, Peter Ertl pe...@gmx.org wrote:
 matej: So the new convention is that named parameters are always query string 
 parameters?
It depends on the mapper. It is true for the standard mappers, unless
the mapping looks like /mount/path/{name1}/{name2} where name1 and
name2 will be named parameters but they are encoded in the path.

-Matej


 Am 24.08.2010 um 02:13 schrieb Matej Knopp:

 Hi,

 see the replies below

 2010/8/23 Major Péter majorpe...@sch.bme.hu:
 Hi!

 As I'm testing wicket 1.5-SNAPSHOT, I'm seeing some strange behaviors:
 With 1.4 I've used to have url's like:
 showuser/id/1234
 now when I open simply the page without params, I will see the following
 URL:
 showuser?[0-9]+

 The number after ? is page id. Since wicket is a stateful framework
 (by default) we need to track page instances.

 When I looked at the JavaDoc of the new MountMapper (which is the
 replacement for mountBookmarkablePage), I saw that I'm having this URL,
 because my page is not stateless.

 In a way, yes. Stateless pages generally do not have page ids in URL.

 Q1: with 1.4 this was possible, because the URL contained the pagemap
 instance number, or is there something else?
 Q2: (a little n00b question) how can I find out which component makes my
 page stateful?

 Usually it is a component that returns false in isStateless or
 generates a stateful listener interface URL.


 when I try to hit the URL now:
 showuser/id/1234
 then I'm going to have indexed parameters and not named parameter with
 'id' name. Q3: Why is that?

 Because it's not a named paramerer (by default). The URL in question
 will have two indexed parameters. id and 1234.
 Big problem in 1.4 was that there was no distinction between indexed
 parameters (part of path) and named parameters (usually part query
 string). So it was difficult to build URLs such as
 showpage/13?sort=asc

 1.5 fixes this by defining URL scheme like this:

 /page/mount/path/indexed-param0/indexed-param1?named1=value1name2=value2

 Btw. you should be able to mount the url in question as
 showuser/id/{user-id}

 wicket should then make user-id a named parameter.

 if I have a page with URL in browser:
 showuser?8id=123
 and I rewrite the id to 124, then I'm going to still see the page for
 123, which is really disturbing! Q4: is there a solution for this to
 work? Or should I make my page stateless to be able to do this?? (How?)

 It is still the same page instance. Obviously in your case you take
 the page parameters into account only in page constructor. So when you
 later change the id value (but leave page id the same) nothing
 changes.

 However if  you for example override page onBeforeRender() and call
 getPageParameters() there the id parameter will have proper value.


 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??

 You can either set id and 1234 as indexed parameters or mount the page
 as /showuser/id/{user-id}

 -Matej


 Thanks for your help.

 Best Regards,
 Peter Major

 -
 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



 -
 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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Matej Knopp
2010/8/24 Major Péter majorpe...@sch.bme.hu:
 okay, but how did the 1.4 have nice url in browser bar and Ajax working
 without this tweak? I mean this new ?number style urls are a bit ugly
 IMHO, and I have many ajaxified pages, so I don't know how to deal with
 this right now..
 If you use regular bookmarkable pages in 1.4  with Ajax and refresh
 the page then all your Ajax state is gone! This is why URLS are hybrid
 by default in 1.5.

 I don't mind that, is there a way to change the default?
I don't think there is simple way to do that (unless you tweak the mapper).
Why would you want to do that though? All bookmarkable URLs are
generated without the page Id,
The redirect is temporary (so google indexes the original URL). URL is
still bookmarkable so users can copy and paste it, page Id is pretty
much harmless.


 I don't think you can mount same page twice.

 Okay, how can I create aliases for a page then? And how could I create a
 nice url for parameterless and 'parameterful' pages? like /show shows a
 user own profile, and /show/id/{id} shows another users profile?
You can't mount the page twice, because in that case wicket will not
know which mapping to use for the page when generating the URL.
If you need page to be accessible on both
/show
and
/show/id/4

then you need to mount it on /show and treat /id/3 as indexed parameters.

 Huh? Why should we store it somewhere else? It's part of page
 parameters. Page parameters are current page parameters for the
 requests. You can use models properly and reload the data on every
 request (by quering getPageParameters().getNamedParameter(user-id)
 for the id.

 I don't think you're using http referers to find out which page did the
 request came from, I think you're using the browser bar URL when you
 create the links for the page content. So the links on the page are
 already containing the page id's, that's great. But the browser bar URL
 is not used for anything after page rendering, or?
Http refereres? Where did that come from?

As I said, every time you call getPageParameters() it contains the
*current* URL parameters. It might be different from the
PageParameters that you got in page constructor, because that was
during page construction only.

so if you have an entity to show, best way is to use LDM
i.e.
new LoadableDetachableModel() {
public Object load() {
   return userdao.load(getPageParameters().getNamedParameter(user-id));
}
}

This will result of the correct entity loaded even if you change page
parameters (while leaving the original page id).

-Matej

 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??

 You can either set id and 1234 as indexed parameters or mount the page
 as /showuser/id/{user-id}

 Probably my code is guilty, can you go through my quickstart?
 You didn't put any code in the archive, just class files.

 doh, right.. The working url is http://aldaris.sch.bme.hu/myproject.tar.gz
 Just execute a mvn jetty:run and see how it 'works'.

 Thanks,
 Peter

 -
 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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Major Péter
 I don't think there is simple way to do that (unless you tweak the mapper).
 Why would you want to do that though? All bookmarkable URLs are
 generated without the page Id,
 The redirect is temporary (so google indexes the original URL). URL is
 still bookmarkable so users can copy and paste it, page Id is pretty
 much harmless.

I would like to have clean URLs, and page Id on every single URL isn't
that pretty.

 I don't think you can mount same page twice.

 Okay, how can I create aliases for a page then? And how could I create a
 nice url for parameterless and 'parameterful' pages? like /show shows a
 user own profile, and /show/id/{id} shows another users profile?
 You can't mount the page twice, because in that case wicket will not
 know which mapping to use for the page when generating the URL.
 If you need page to be accessible on both
 /show
 and
 /show/id/4
 
 then you need to mount it on /show and treat /id/3 as indexed parameters.

will do, but what about aliases? Let's say I want to support legacy
uri's, what should I do then?

 Http refereres? Where did that come from?
 
 As I said, every time you call getPageParameters() it contains the
 *current* URL parameters. It might be different from the
 PageParameters that you got in page constructor, because that was
 during page construction only.
 
 so if you have an entity to show, best way is to use LDM
 i.e.
 new LoadableDetachableModel() {
 public Object load() {
return userdao.load(getPageParameters().getNamedParameter(user-id));
 }
 }
 
 This will result of the correct entity loaded even if you change page
 parameters (while leaving the original page id).

oh yeah, I don't use LDM's (I know I should), instead I'm using simple
propertymodels and compoundpropertymodels. This is a method of yours to
make people use LDM everywhere?

Also the main question was unanswered:
are you using the browser bar URL for anything after page rendering?

p.s: the quickstart is here: http://aldaris.sch.bme.hu/myproject.tar.gz

Thanks,
Peter

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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Matej Knopp
2010/8/24 Major Péter majorpe...@sch.bme.hu:
 I don't think there is simple way to do that (unless you tweak the mapper).
 Why would you want to do that though? All bookmarkable URLs are
 generated without the page Id,
 The redirect is temporary (so google indexes the original URL). URL is
 still bookmarkable so users can copy and paste it, page Id is pretty
 much harmless.

 I would like to have clean URLs, and page Id on every single URL isn't
 that pretty.
We need to store page id somewhere. The scenario when user loses all
state by refreshing page (in Wicket 1.4) is far from being ideal.

 I don't think you can mount same page twice.

 Okay, how can I create aliases for a page then? And how could I create a
 nice url for parameterless and 'parameterful' pages? like /show shows a
 user own profile, and /show/id/{id} shows another users profile?
 You can't mount the page twice, because in that case wicket will not
 know which mapping to use for the page when generating the URL.
 If you need page to be accessible on both
 /show
 and
 /show/id/4

 then you need to mount it on /show and treat /id/3 as indexed parameters.

 will do, but what about aliases? Let's say I want to support legacy
 uri's, what should I do then?

Make your own mapper for legacy URL that just redirects to the new one.


 Http refereres? Where did that come from?

 As I said, every time you call getPageParameters() it contains the
 *current* URL parameters. It might be different from the
 PageParameters that you got in page constructor, because that was
 during page construction only.

 so if you have an entity to show, best way is to use LDM
 i.e.
 new LoadableDetachableModel() {
     public Object load() {
        return userdao.load(getPageParameters().getNamedParameter(user-id));
     }
 }

 This will result of the correct entity loaded even if you change page
 parameters (while leaving the original page id).

 oh yeah, I don't use LDM's (I know I should), instead I'm using simple
 propertymodels and compoundpropertymodels. This is a method of yours to
 make people use LDM everywhere?
It's your choice. We don't make you use LDM.

 Also the main question was unanswered:
 are you using the browser bar URL for anything after page rendering?
I have answered the question. I told you that after page rendering the
parameters from browser bar are available in getPageParameters().
Wicket doesn't do anything with those parameters as they are specific
to your application. You can query them any time you want.

-Matej

 p.s: the quickstart is here: http://aldaris.sch.bme.hu/myproject.tar.gz

 Thanks,
 Peter

 -
 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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Igor Vaynberg
2010/8/24 Major Péter majorpe...@sch.bme.hu:
 well, I've tried this with this quickstart:
 http://aldaris.sch.bme.hu/quick.tar.gz
 , but this really didn't worked. Also on my bigger project I was seeing
 weird redirections:
 * the app is on / contextroot
 * the homepage could have parameters, but it's not mandatory
 * and it's mapped to /app/show and /app/show/id/{id} too
 now when I open / I get redirected to /app/show/id/{id}?3
 when I open /app/show/id/123 then I got redirected to
 /app/show/id/{id}/show/id/123?4

thats because the default placeholder format is ${key} not {key}

-igor

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



Re: [1.5] new wicket URL-related questions

2010-08-24 Thread Matej Knopp
Sorry, my bad.

-Matej

On Tue, Aug 24, 2010 at 5:08 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:
 2010/8/24 Major Péter majorpe...@sch.bme.hu:
 well, I've tried this with this quickstart:
 http://aldaris.sch.bme.hu/quick.tar.gz
 , but this really didn't worked. Also on my bigger project I was seeing
 weird redirections:
 * the app is on / contextroot
 * the homepage could have parameters, but it's not mandatory
 * and it's mapped to /app/show and /app/show/id/{id} too
 now when I open / I get redirected to /app/show/id/{id}?3
 when I open /app/show/id/123 then I got redirected to
 /app/show/id/{id}/show/id/123?4

 thats because the default placeholder format is ${key} not {key}

 -igor

 -
 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



[1.5] new wicket URL-related questions

2010-08-23 Thread Major Péter
Hi!

As I'm testing wicket 1.5-SNAPSHOT, I'm seeing some strange behaviors:
With 1.4 I've used to have url's like:
showuser/id/1234
now when I open simply the page without params, I will see the following
URL:
showuser?[0-9]+
When I looked at the JavaDoc of the new MountMapper (which is the
replacement for mountBookmarkablePage), I saw that I'm having this URL,
because my page is not stateless.
Q1: with 1.4 this was possible, because the URL contained the pagemap
instance number, or is there something else?
Q2: (a little n00b question) how can I find out which component makes my
page stateful?

when I try to hit the URL now:
showuser/id/1234
then I'm going to have indexed parameters and not named parameter with
'id' name. Q3: Why is that?
if I have a page with URL in browser:
showuser?8id=123
and I rewrite the id to 124, then I'm going to still see the page for
123, which is really disturbing! Q4: is there a solution for this to
work? Or should I make my page stateless to be able to do this?? (How?)

Also how could I make Wicket to use by default the /id/1234 format
instead of ?3id=1234 for link creation??

Thanks for your help.

Best Regards,
Peter Major

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



Re: [1.5] new wicket URL-related questions

2010-08-23 Thread bht
Hi,

A2:

http://blog.armstrongconsulting.com/?p=14

A4:

I will look at this in 1.5 myself at some stage as well, so please
keep in touch. Meanwhile, have you seen

http://day-to-day-stuff.blogspot.com/2008/10/wicket-extreme-consistent-urls.html

I have a special use case for this where I don't want to create
browser history entries of different versions of a stateful page (back
button problem solution).


Regards,

Bernard



On Mon, 23 Aug 2010 20:53:26 +0200, you wrote:

Hi!

As I'm testing wicket 1.5-SNAPSHOT, I'm seeing some strange behaviors:
With 1.4 I've used to have url's like:
showuser/id/1234
now when I open simply the page without params, I will see the following
URL:
showuser?[0-9]+
When I looked at the JavaDoc of the new MountMapper (which is the
replacement for mountBookmarkablePage), I saw that I'm having this URL,
because my page is not stateless.
Q1: with 1.4 this was possible, because the URL contained the pagemap
instance number, or is there something else?
Q2: (a little n00b question) how can I find out which component makes my
page stateful?

when I try to hit the URL now:
showuser/id/1234
then I'm going to have indexed parameters and not named parameter with
'id' name. Q3: Why is that?
if I have a page with URL in browser:
showuser?8id=123
and I rewrite the id to 124, then I'm going to still see the page for
123, which is really disturbing! Q4: is there a solution for this to
work? Or should I make my page stateless to be able to do this?? (How?)

Also how could I make Wicket to use by default the /id/1234 format
instead of ?3id=1234 for link creation??

Thanks for your help.

Best Regards,
Peter Major

-
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



Re: [1.5] new wicket URL-related questions

2010-08-23 Thread Matej Knopp
Hi,

see the replies below

2010/8/23 Major Péter majorpe...@sch.bme.hu:
 Hi!

 As I'm testing wicket 1.5-SNAPSHOT, I'm seeing some strange behaviors:
 With 1.4 I've used to have url's like:
 showuser/id/1234
 now when I open simply the page without params, I will see the following
 URL:
 showuser?[0-9]+

The number after ? is page id. Since wicket is a stateful framework
(by default) we need to track page instances.

 When I looked at the JavaDoc of the new MountMapper (which is the
 replacement for mountBookmarkablePage), I saw that I'm having this URL,
 because my page is not stateless.

In a way, yes. Stateless pages generally do not have page ids in URL.

 Q1: with 1.4 this was possible, because the URL contained the pagemap
 instance number, or is there something else?
 Q2: (a little n00b question) how can I find out which component makes my
 page stateful?

Usually it is a component that returns false in isStateless or
generates a stateful listener interface URL.


 when I try to hit the URL now:
 showuser/id/1234
 then I'm going to have indexed parameters and not named parameter with
 'id' name. Q3: Why is that?

Because it's not a named paramerer (by default). The URL in question
will have two indexed parameters. id and 1234.
Big problem in 1.4 was that there was no distinction between indexed
parameters (part of path) and named parameters (usually part query
string). So it was difficult to build URLs such as
showpage/13?sort=asc

1.5 fixes this by defining URL scheme like this:

/page/mount/path/indexed-param0/indexed-param1?named1=value1name2=value2

Btw. you should be able to mount the url in question as
showuser/id/{user-id}

wicket should then make user-id a named parameter.

 if I have a page with URL in browser:
 showuser?8id=123
 and I rewrite the id to 124, then I'm going to still see the page for
 123, which is really disturbing! Q4: is there a solution for this to
 work? Or should I make my page stateless to be able to do this?? (How?)

It is still the same page instance. Obviously in your case you take
the page parameters into account only in page constructor. So when you
later change the id value (but leave page id the same) nothing
changes.

However if  you for example override page onBeforeRender() and call
getPageParameters() there the id parameter will have proper value.


 Also how could I make Wicket to use by default the /id/1234 format
 instead of ?3id=1234 for link creation??

You can either set id and 1234 as indexed parameters or mount the page
as /showuser/id/{user-id}

-Matej


 Thanks for your help.

 Best Regards,
 Peter Major

 -
 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