Hi Chris,

It may help you :  

Url url = RequestCycle.get().mapUrlFor(page.getClass(), getPageParameters());
String canonicalLink = RequestCycle.get().getUrlRenderer().renderFullUrl(url);


François


Le 27 mars 2012 à 00:49, Chris Colman a écrit :

> I'm implementing canonical in our wicket app and so I need to add a
> canonical link to any page whose request has the ;jessionid=SESSIONID
> parameter but NOT for those pages that don't have the jsessionid
> parameter
> 
> Eg.,
> 
> If the page request was:
> 
> http://www.mydomain.com/page/aboutus;jsessionid=SESSIONID
> 
> then I need to output a canonical link with
> 
> http://www.mydomain.com/page/aboutus
> 
> as the reference but if the page request was for
> 
> http://www.mydomain.com/page/aboutus
> 
> then no canonical link should be provided because the request was for
> the canonical page.
> 
> 
> Is there a way in wicket to tell if the jsession parameter was provided
> in the URL?
> 
> I've tried all the usual J2EE methods but it seems like it 'pre-strips'
> the jsessionid and so I can't tell if it was present or not in the
> original request.
> 
> I tried using isRequestedSessionIdFromURL
> <http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/H
> ttpServletRequest.html#isRequestedSessionIdFromURL%28%29>  but that
> always seems to return false - probably because a cookie has already
> been made available. I guess when the request is from a search engine no
> cookies are enabled so isRequestedSessionIdFromURL would return true.
> Possibly meaning that I've just answered my own question ;) but I
> wouldn't mind confirming with others that the logic is correct.
> 
> Chris
> 
> 
> ______________________________________________        
> This email has been scanned by Netintelligence        
> http://www.netintelligence.com/email


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

Reply via email to