because path=X is session information. and the X is the component (page)
id of the then generated page.
In head now we have homepage strategies:
/**
* Use this homepage strategy if you don't want to redirect so the
url just stays /
*/
public static final HomePageStrategy NO_REDIRECT = new
HomePageStrategy("no-redirect");
/**
* Use this homepage strategy if you want to redirect the homepage
to a bookmarkable url like: page=mybookmarkablepage
* This is the same as calling: setResponsePage(MyPage.class);
*/
public static final HomePageStrategy BOOKMARK_REDIRECT = new
HomePageStrategy("bookmark-redirect");
/**
* Use this homepage strategy if you want to redirect the homepage
just as a normal page would be in
* wicket (when you submit a form on the page or when you do in the
code: setResponsePage(new MyPage());
* If you have set the overall Redirect Strategy to ONE_PASS_RENDER
then the homepage response will honor that.
* Then it is the same as setting the homepage strategy to NO_REDIRECT.
*/
public static final HomePageStrategy PAGE_REDIRECT = new
HomePageStrategy("page-redirect");
so that you can choose what you want to do with youre homepage.
Also you can now do this:
getPages().putPageAlias(HelloWorld.class, "helloworld");
getPages().setHomePageRenderStrategy(ApplicationPages.BOOKMARK_REDIRECT);
this will result in this homepage url:
?bookmarkablePage=helloworld
johan
Gili wrote:
Sorry I still don't totally understand this.
So path=0 does not replace bookmarkablePage=X, and it has
something to do with a session. So what happens if I have a
bookmarkable page without any sort of state? My homepage is supposed
to be that, and yet I see path=X changing over time... why is that?
Gili
Johan Compagner wrote:
I already told you
That path=0 is the way wicket really knows the page. How it can look
it up from pagemap. That is they key where the instance of youre
homepage is stored in the session.
If a homepage has a form that then form will have an post action=
"/path=0" to get to that instance of the homepage.
A homepage is just a page that can be linked/access as any other
page. So in my eyes it should behave like any other page.
Did you check/see the difference between the forminput example what
is now on the wicket-library site and what is current in CVS?
Then you would see that the url stays stables from the first request
(/) on that is made and will not change on any submit of that form.
I never talked about stable bookmarkable pages...
I just talk about stable urls..
again /path=0 is not a bookmarkable page, it just makes the url
stable for that session.
johan
Gili wrote:
Ok, lets discuss this on the mailing list. This is still not
making any sense to me. What is this "path=..." stuff? What is it
used for? It should be possible to hit the bookmarkable page the
first time without a jsession because I, as the user, did not
introduce any session into the Page (redirect or not). So why are we
even adding "path=..." here?
If the URL is truely stable for bookmarkable pages, it should be
possible to issue a HTTP 307 to the expanded URL and have users and
crawlers hitting that address from now on. The URL should not be
dependant on the user context, because there shouldn't be one for
bookmarkable pages.
Gili
SourceForge.net wrote:
Comment By: Johan Compagner (joco01)
Date: 2005-07-15 13:29
Message:
Logged In: YES user_id=379231
but if a crawler or what ever really sees it as a perminant
link and is going to use that from that day on. Then it goes
wrong. Because the first time you MUST hit / you can't do directly
/path=0 (then you will get a page
expired message)
If you really want a bookmarkable page then you should link that
home page is mapped to the right url that it also is if you
did go to that same page through any other means (by a
submit or by a link)
That is unified now.
Just look at:
http://www.wicket-library.com/wicket-examples/forminput
Which still uses the old version
if you go to:
http://www.wicket-library.com/wicket-examples/forminput
you see that the url stays that way.
But if you then press save, the url changes to:
http://www.wicket-library.com/wicket-examples/forminput?component=2&version=0&interface=IRedirectListener
(or something like that)
So now you can go back in the browser ect, because the
browser sees it as a new page. But it is the same one.
With the new code if you go to:
http://www.wicket-library.com/wicket-examples/forminput
you will get directly:
http://www.wicket-library.com/wicket-examples/forminput?path=0
and if you press save you still have:
http://www.wicket-library.com/wicket-examples/forminput?path=0
so the url is stable.
The jsessionid is not what we as wicket append to the url.
It is what the webcontainer does for you if you give it a
redirect url.
(maybe not if you do that redirect yourself and set the url
yourself)
I think we need to introduce some kind of HomePage options:
1> don't redirect, just render homepage at once (url stays /)
2> redirect before render (url becomes /path=0)
3> make it a bookmarkable page (url becomes
/bookmarkablePage=" + getClass().getName())
And then with 3 you want a 301 with 2 a 307
----------------------------------------------------------------------
Comment By: Gili Tzabari (cowwoc)
Date: 2005-07-15 13:07
Message:
Logged In: YES user_id=80628
I think you better read
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2
Permanent redirect doesn't mean that clients can't continue
to hit the original URL, but it states they SHOULD not do
so. I suggest you read the full description in the above URL
as it explains it better than me. Take a look at HTTP 301
versus HTTP 307.
As far as I can tell, we should definately be issueing a
HTTP 301 here.
Also, I just tried CVS head. Can you please explain to me
why my bookmarkable Page now contains a jsessionid and path
argument?
For example, I now see this URL:
http://www.desktopbeautifier.com/Main;jsessionid=4DFF88C0742C617D27F84B716DBAB182?path=0
Bookmarkable pages shouldn't have a jsessionid. It causes
crawlers not to index them, for one.
----------------------------------------------------------------------
Comment By: Johan Compagner (joco01)
Date: 2005-07-15 07:20
Message:
Logged In: YES user_id=379231
they are all clientside redirects.. It is just a matter how the
browser it sees from that on.
But a user will always type:
/myapp
again and then again be redirected to what the homepage
page/component is:
/myapp?path=0
probely, but it shoudn't directly the first time hit that
redirect url!!
So it is not really a permantent redirect. But a temp one.
Because the next time he should hit / again not ?pag=0
----------------------------------------------------------------------
Comment By: Gili Tzabari (cowwoc)
Date: 2005-07-15 02:33
Message:
Logged In: YES user_id=80628
What is gained by a client-side redirect? To me, this is a
clear case of a permanent redirect. We are saying: "the URL
is not X, it is Y. Please don't try hitting X again".
Client-side redirects will lead to extra server overhead
(and people keep on hitting X) with no benefit that I can see.
----------------------------------------------------------------------
Comment By: Johan Compagner (joco01)
Date: 2005-07-14 22:01
Message:
Logged In: YES user_id=379231
and that should be done by setting the header/response code
youreself i believe:
res.setHeader("Location", "url" );
res.setStatus(301);
Maybe we should build in wicket that option that you can
choose between those 2 redirects.
----------------------------------------------------------------------
Comment By: Gili Tzabari (cowwoc)
Date: 2005-07-14 21:47
Message:
Logged In: YES user_id=80628
We should be issuing a HTTP 301, not HTTP 307 or client-side
redirect.
----------------------------------------------------------------------
Comment By: Johan Compagner (joco01)
Date: 2005-07-14 21:35
Message:
Logged In: YES user_id=379231
it is a client side redirect. So the url changes and stays
that way.
What kind of client side redirect are there ?
For now i am closing this bug a homepage call like:
/forminput
will be come
/forminput?path=0
If this doesn't fit some needs then please make a bug
describing that case.
----------------------------------------------------------------------
Comment By: Gili Tzabari (cowwoc)
Date: 2005-07-14 20:36
Message:
Logged In: YES user_id=80628
Hmm, please ensure this is a permanent redirect, not a
normal redirect() call which maps to temporary redirect.
Reason being that we want to indicate to Google to not index
the original URL and rather index to the URL we redirect to.
----------------------------------------------------------------------
Comment By: Johan Compagner (joco01)
Date: 2005-07-14 19:26
Message:
Logged In: YES user_id=379231
the homepage does do a redirect now. (1.1)
So that it does have the exact same adress as if you link or
do a submit to it. The url is now stable if you for example
look at the forminput example (homepage url is the same as
the url after the submit)
don't know what i find more appealing. I am more into stable
urls if you do something from youre homepage.
----------------------------------------------------------------------
Comment By: Gili Tzabari (cowwoc)
Date: 2005-06-30 17:39
Message:
Logged In: YES user_id=80628
Another problem with the homepage having two different URLs
but identical content is that Google sees this and lowers
your site PageRank because they count this as "URL spam". As
if you're trying to artificially increase your PageRank by
adding new, but fake, pages.
----------------------------------------------------------------------
Comment By: Gili Tzabari (cowwoc)
Date: 2005-06-13 05:48
Message:
Logged In: YES user_id=80628
Here is my proposed patch:
/**
* Ensures that the homepage gets a canonical URL.
*/
private void ensureCanonicalURL()
{
StringBuilder path = new
StringBuilder(getRequest().getURL().trim());
boolean redirect = false;
if (path.toString().endsWith("/"))
{
// If url hit is http://hostname/page/, redirect to
http://hostname/page
path.deleteCharAt(path.length()-1);
redirect = true;
}
if (getRequest().getParameter("bookmarkablePage")==null)
{
// Ensure URL always contains bookmarkablePage so
BookmarkableLinks to
// this page will show up as visited
if (path.indexOf("?")==-1)
path.append('?');
else
path.append('&');
path.append("bookmarkablePage=" + getClass().getName());
redirect = true;
}
if (redirect)
getResponse().redirect(path.toString());
}
simply execute this at the top of the homepage and it
ensures a canonical URL.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684975&aid=1219477&group_id=119783
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop