RE: problems with redirectToInterceptPage
Could it be related to this issue I raised a little while ago: https://issues.apache.org/jira/browse/WICKET-2912 Try the fix and see if your problem goes away like mine did. Regards, Chris Colman >-Original Message- >From: nimmy [mailto:nim_sa...@hotmail.com] >Sent: Friday, 1 October 2010 9:22 PM >To: users@wicket.apache.org >Subject: problems with redirectToInterceptPage > > >Hi All, > >I'm having some trouble with 'redirectToInterceptPage' and would appreciate >any help you can provide > >I have a 'login' link on my page - PageA. > >My intention is that: >1. if the user clicks on the 'login' link the user will be forwarded to the >Index page, which includes the standard Wicket SignInPanel (the Index page >is similar to the gmail start/splash page) >2. If the user successfully authenticates, the user should be returned back >to PageA- the original page. > >Currently: >1. the user clicks the 'login' link and is forwarded to the Index page >2. on successful authentication, the user stays on the Index page > >Some details: >1. PageA is a bookmarkable page with 2 page parameters. Sample URL is >http://localhost:8080/PageA?id=1&authKey=f68d282f-7552-404b-b0b1- >96fadc7b04dc >2. The User does not have to be authenticated to view PageA. An >authenticated user will be able to see an additional panel (I haven't got >to >this bit yet) >3. My login link has the standard onClick function with >redirectToInterceptPage(new Index()); > >My debugging shows: >1. User sign-in process works - i.e. the user is successfully authenticated >(using Spring-Security) >2. The continueToOriginalDestination() method returns true >3. getURL() called from the onClick method of the 'login' link returns >?wicket:interface=:4:header:signin::ILinkListener:: and not the >bookmarkable >URL as I expected > >I have tried throwing a RestartResponseAtInterceptPageException but this >does not work. > >My feeling is that the correct URL is not being saved in the PageMap >therefore the application is not able to return the user to the target >page. > >Has anyone experienced this problem? Any idea what the fix is? > >Any suggestions greatly appreciated. > >Thanks, >Nim >-- >View this message in context: http://apache- >wicket.1842946.n4.nabble.com/problems-with-redirectToInterceptPage- >tp2892437p2892437.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >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: problems with redirectToInterceptPage
Hi Chris, Thanks for your reply. I did some debugging and think that the problem is more to do with my logic. This is what is currently happening: 1. PageA has a login link 2. Clicking the login link causes a new http request to the link listner 3. the link onClick method does a redirectToInterceptPage - forwarding the user to the Signin panel 4. On successful authentication, Wicket forwards the user to the interceptContinuationUrl, which is the last http request - to the link listner (step 2) 5. Wicket processes the link's onClick method. As there is no page to display, Wicket re-render the last page that was displayed (the signin page) I changed the link to an AjaxLink and the functionality works are required. The below code fragment from the 'PageMap' explains why: // The intercept continuation URL should be saved exactly as the // original request specified. // Only if it is an ajax request just redirect to the page where the request is from. if (cycle.getRequest() instanceof WebRequest && ((WebRequest)cycle.getRequest()).isAjax()) { interceptContinuationURL = cycle.urlFor(cycle.getRequest().getPage()).toString(); } else { // wicket-2061: getURL() returns a properly decoded URL. But we need is a // properly encoded URL. interceptContinuationURL = "/" + cycle.getRequest().getURL(); interceptContinuationURL = WicketURLEncoder.FULL_PATH_INSTANCE.encode(interceptContinuationURL); } I'm not sure whether I should stick with an AjaxLink or manually forward to the signin panel with the refferer URL as a query parameter. I'm a bit weary about using Ajax. Cheers, Nim Date: Fri, 1 Oct 2010 17:48:42 -0700 From: ml-node+2952087-1007324699-160...@n4.nabble.com To: nim_sa...@hotmail.com Subject: RE: problems with redirectToInterceptPage Could it be related to this issue I raised a little while ago: https://issues.apache.org/jira/browse/WICKET-2912 Try the fix and see if your problem goes away like mine did. Regards, Chris Colman >-Original Message- >From: nimmy [mailto:[hidden email]] >Sent: Friday, 1 October 2010 9:22 PM >To: [hidden email] >Subject: problems with redirectToInterceptPage > > >Hi All, > >I'm having some trouble with 'redirectToInterceptPage' and would appreciate >any help you can provide > >I have a 'login' link on my page - PageA. > >My intention is that: >1. if the user clicks on the 'login' link the user will be forwarded to the >Index page, which includes the standard Wicket SignInPanel (the Index page >is similar to the gmail start/splash page) >2. If the user successfully authenticates, the user should be returned back >to PageA- the original page. > >Currently: >1. the user clicks the 'login' link and is forwarded to the Index page >2. on successful authentication, the user stays on the Index page > >Some details: >1. PageA is a bookmarkable page with 2 page parameters. Sample URL is >http://localhost:8080/PageA?id=1&authKey=f68d282f-7552-404b-b0b1- >96fadc7b04dc >2. The User does not have to be authenticated to view PageA. An >authenticated user will be able to see an additional panel (I haven't got >to >this bit yet) >3. My login link has the standard onClick function with >redirectToInterceptPage(new Index()); > >My debugging shows: >1. User sign-in process works - i.e. the user is successfully authenticated >(using Spring-Security) >2. The continueToOriginalDestination() method returns true >3. getURL() called from the onClick method of the 'login' link returns >?wicket:interface=:4:header:signin::ILinkListener:: and not the >bookmarkable >URL as I expected > >I have tried throwing a RestartResponseAtInterceptPageException but this >does not work. > >My feeling is that the correct URL is not being saved in the PageMap >therefore the application is not able to return the user to the target >page. > >Has anyone experienced this problem? Any idea what the fix is? > >Any suggestions greatly appreciated. > >Thanks, >Nim >-- >View this message in context: http://apache- >wicket.1842946.n4.nabble.com/problems-with-redirectToInterceptPage- >tp2892437p2892437.html >Sent from the Users forum mailing list archive at Nabble.com. > >- >To unsubscribe, e-mail: [hidden email] >For additional commands, e-mail: [hidden email] - To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] View message @ http://apache-wicket.1842946.n4.nabble.com/problems-with-redirectToInterceptPage-tp2892437p2952087.
RE: problems with redirectToInterceptPage
Have you confirmed that your fix works for you on IE7 and IE8? My issue only surfaced in IE - worked fine in FF. Chris >-Original Message- >From: nimmy [mailto:nim_sa...@hotmail.com] >Sent: Sunday, 3 October 2010 9:04 AM >To: users@wicket.apache.org >Subject: RE: problems with redirectToInterceptPage > > > >Hi Chris, > >Thanks for your reply. I did some debugging and think that the problem is >more to do with my logic. > >This is what is currently happening: >1. PageA has a login link >2. Clicking the login link causes a new http request to the link listner >3. the link onClick method does a redirectToInterceptPage - forwarding the >user to the Signin panel >4. On successful authentication, Wicket forwards the user to the >interceptContinuationUrl, which is the last http request - to the link >listner (step 2) >5. Wicket processes the link's onClick method. As there is no page to >display, Wicket re-render the last page that was displayed (the signin >page) > >I changed the link to an AjaxLink and the functionality works are required. >The below code fragment from the 'PageMap' explains why: > >// The intercept continuation URL should be saved exactly as the >// original request specified. >// Only if it is an ajax request just redirect to the page where the >request is from. >if (cycle.getRequest() instanceof WebRequest && >((WebRequest)cycle.getRequest()).isAjax()) >{ >interceptContinuationURL = >cycle.urlFor(cycle.getRequest().getPage()).toString(); >} >else >{ >// wicket-2061: getURL() returns a properly decoded URL. But we >need is a >// properly encoded URL. >interceptContinuationURL = "/" + cycle.getRequest().getURL(); >interceptContinuationURL = >WicketURLEncoder.FULL_PATH_INSTANCE.encode(interceptContinuationURL); >} > >I'm not sure whether I should stick with an AjaxLink or manually forward to >the signin panel with the refferer URL as a query parameter. I'm a bit >weary about using Ajax. > >Cheers, >Nim > >Date: Fri, 1 Oct 2010 17:48:42 -0700 >From: ml-node+2952087-1007324699-160...@n4.nabble.com >To: nim_sa...@hotmail.com >Subject: RE: problems with redirectToInterceptPage > > > >Could it be related to this issue I raised a little while ago: > > >https://issues.apache.org/jira/browse/WICKET-2912 > >Try the fix and see if your problem goes away like mine did. > > >Regards, > >Chris Colman > > >>-Original Message- > >>From: nimmy [mailto:[hidden email]] > >>Sent: Friday, 1 October 2010 9:22 PM > >>To: [hidden email] > >>Subject: problems with redirectToInterceptPage > >> > >> > >>Hi All, > >> > >>I'm having some trouble with 'redirectToInterceptPage' and would >appreciate > >>any help you can provide > >> > >>I have a 'login' link on my page - PageA. > >> > >>My intention is that: > >>1. if the user clicks on the 'login' link the user will be forwarded to > >the > >>Index page, which includes the standard Wicket SignInPanel (the Index > >page > >>is similar to the gmail start/splash page) > >>2. If the user successfully authenticates, the user should be returned > >back > >>to PageA- the original page. > >> > >>Currently: > >>1. the user clicks the 'login' link and is forwarded to the Index page > >>2. on successful authentication, the user stays on the Index page > >> > >>Some details: > >>1. PageA is a bookmarkable page with 2 page parameters. Sample URL is > >>http://localhost:8080/PageA?id=1&authKey=f68d282f-7552-404b-b0b1- >>96fadc7b04dc > >>2. The User does not have to be authenticated to view PageA. An > >>authenticated user will be able to see an additional panel (I haven't >got > >>to > >>this bit yet) > >>3. My login link has the standard onClick function with > >>redirectToInterceptPage(new Index()); > >> > >>My debugging shows: > >>1. User sign-in process works - i.e. the user is successfully > >authenticated > >>(using Spring-Security) > >>2. The continueToOriginalDestination() method returns true > >>3. getURL() called from the onClick method of the 'login' link returns > >>?wicket:interface=:4:header:signin::ILinkListener:: and not the > >>bookmarkable > >>URL as I expected > >> > >>I have tried throwing
RE: problems with redirectToInterceptPage
Hi Chris, I have successfully tested it on IE8. I did some more digging in the 'Wicket in Action' book and figured out how to make the sign-in link work for a normal link - you have to override the isVisible method to disable the link or Wicket will get into a loop with steps 3 and 4 from my last email: >3. the link onClick method does a redirectToInterceptPage - forwarding the >user to the Signin panel >4. On successful authentication, Wicket forwards the user to the >interceptContinuationUrl, which is the last http request - to the link >listner By disabling the link, you break this loop and Wicket rerenders the page. Cheers, Nim Date: Sat, 2 Oct 2010 20:02:11 -0700 From: ml-node+2952891-407581717-160...@n4.nabble.com To: nim_sa...@hotmail.com Subject: RE: problems with redirectToInterceptPage Have you confirmed that your fix works for you on IE7 and IE8? My issue only surfaced in IE - worked fine in FF. Chris >-Original Message- >From: nimmy [mailto:[hidden email]] >Sent: Sunday, 3 October 2010 9:04 AM >To: [hidden email] >Subject: RE: problems with redirectToInterceptPage > > > >Hi Chris, > >Thanks for your reply. I did some debugging and think that the problem is >more to do with my logic. > >This is what is currently happening: >1. PageA has a login link >2. Clicking the login link causes a new http request to the link listner >3. the link onClick method does a redirectToInterceptPage - forwarding the >user to the Signin panel >4. On successful authentication, Wicket forwards the user to the >interceptContinuationUrl, which is the last http request - to the link >listner (step 2) >5. Wicket processes the link's onClick method. As there is no page to >display, Wicket re-render the last page that was displayed (the signin >page) > >I changed the link to an AjaxLink and the functionality works are required. >The below code fragment from the 'PageMap' explains why: > >// The intercept continuation URL should be saved exactly as the >// original request specified. >// Only if it is an ajax request just redirect to the page where the >request is from. >if (cycle.getRequest() instanceof WebRequest && >((WebRequest)cycle.getRequest()).isAjax()) >{ >interceptContinuationURL = >cycle.urlFor(cycle.getRequest().getPage()).toString(); >} >else >{ >// wicket-2061: getURL() returns a properly decoded URL. But we >need is a >// properly encoded URL. >interceptContinuationURL = "/" + cycle.getRequest().getURL(); >interceptContinuationURL = >WicketURLEncoder.FULL_PATH_INSTANCE.encode(interceptContinuationURL); >} > >I'm not sure whether I should stick with an AjaxLink or manually forward to >the signin panel with the refferer URL as a query parameter. I'm a bit >weary about using Ajax. > >Cheers, >Nim > >Date: Fri, 1 Oct 2010 17:48:42 -0700 >From: [hidden email] >To: [hidden email] >Subject: RE: problems with redirectToInterceptPage > > > >Could it be related to this issue I raised a little while ago: > > >https://issues.apache.org/jira/browse/WICKET-2912 > >Try the fix and see if your problem goes away like mine did. > > >Regards, > >Chris Colman > > >>-Original Message- > >>From: nimmy [mailto:[hidden email]] > >>Sent: Friday, 1 October 2010 9:22 PM > >>To: [hidden email] > >>Subject: problems with redirectToInterceptPage > >> > >> > >>Hi All, > >> > >>I'm having some trouble with 'redirectToInterceptPage' and would >appreciate > >>any help you can provide > >> > >>I have a 'login' link on my page - PageA. > >> > >>My intention is that: > >>1. if the user clicks on the 'login' link the user will be forwarded to > >the > >>Index page, which includes the standard Wicket SignInPanel (the Index > >page > >>is similar to the gmail start/splash page) > >>2. If the user successfully authenticates, the user should be returned > >back > >>to PageA- the original page. > >> > >>Currently: > >>1. the user clicks the 'login' link and is forwarded to the Index page > >>2. on successful authentication, the user stays on the Index page > >> > >>Some details: > >>1. PageA is a bookmarkable page with 2 page parameters. Sample URL is > >>http://localhost:8080/PageA?id=1&authKey=f68d282f-7552-404b-b0b1- >>96fadc7b04dc