Thanks, works great. I just needed to convert IRequestParameters to PageParameters in RequestHandler#onException() in order to "remember" the tab selection made by the user throughout login. Is there a convenience method somewhere in wicket to convert between IRequestParameters and PageParameters?
Thanks, Ale On Thu, Sep 27, 2012 at 1:18 AM, Martin Grigorov <mgrigo...@apache.org> wrote: > Make the TabbedPanel stateless by using BookmarkablePageLink. > > P.S. Please start a new thread when you have new questions. > > On Wed, Sep 26, 2012 at 10:56 PM, Alec Swan <alecs...@gmail.com> wrote: >> Thanks, that worked as advertised. Now I am wondering if it's possible >> to get this to work when the user click on a tab in TabbedPanel? >> RenderPageRequestHandler(new PageProvider(HomePage.class), >> ALWAYS_REDIRECT) seems to lose the knowledge of the tab selected by >> the user and redirects the user to the default tab after he logs in on >> HomePage. >> >> Thoughts? >> >> Thanks, >> >> Alec >> >> On Wed, Sep 26, 2012 at 12:52 AM, Martin Grigorov <mgrigo...@apache.org> >> wrote: >>> You have to return a IRequestHandler. See RenderPageRequestHandler >>> >>> On Wed, Sep 26, 2012 at 1:45 AM, Alec Swan <alecs...@gmail.com> wrote: >>>> I am trying to implement Martin's @SubSite annotation approach to >>>> redirect the user to the sub-site's home page when >>>> AuthenticationException is thrown in Wicket 1.5. However, apparently I >>>> cannot throw a >>>> RestartResponseAtInterceptPageException(annotation.homePage()) >>>> from AbstractRequestCycleListener#onException. How else can I redirect >>>> the user to the sub-site login page? >>>> >>>> The following RCH causes a 500 HTTP error page to be shown in the >>>> browser when AuthenticationException is thrown. >>>> >>>> public class AuthenticationExceptionRequestCycleHandler extends >>>> AbstractRequestCycleListener >>>> { >>>> @Override >>>> public IRequestHandler onException(RequestCycle cycle, Exception ex) { >>>> if (ex instanceof WicketRuntimeException && >>>> ex.getCause().getCause() instanceof AuthenticationException) { >>>> IPageRequestHandler lastHandler = >>>> PageRequestHandlerTracker.getLastHandler(cycle); >>>> Class<? extends IRequestablePage> pageClass = lastHandler >>>> == null ? null : lastHandler.getPageClass(); >>>> if (pageClass != null) { >>>> SubSite annotation = >>>> pageClass.getAnnotation(SubSite.class); >>>> if (annotation != null && annotation.homePage() != null) { >>>> throw new >>>> RestartResponseAtInterceptPageException(annotation.homePage()); >>>> } >>>> } >>>> } >>>> return super.onException(cycle, ex); >>>> } >>>> } >>>> >>>> Thanks, >>>> >>>> Alec >>>> >>>> On Fri, Jun 8, 2012 at 2:54 PM, Alec Swan <alecs...@gmail.com> wrote: >>>>> I also use this approach, but with authentication exceptions thrown by >>>>> Wicket it's hard to tell if the user was redirected to Login page >>>>> because of authentication or some other exceptions. >>>>> >>>>> On Fri, Jun 8, 2012 at 1:15 PM, Michal Margiel <michal.marg...@gmail.com> >>>>> wrote: >>>>>> 2012/6/8 Alec Swan <alecs...@gmail.com> >>>>>> >>>>>>> That's clever. I will give it a try. >>>>>>> >>>>>>> What is the recommendation on verifying that an exception was thrown >>>>>>> during page rendering using Wicket tester? I am not talking just about >>>>>>> authentication here, but exceptions in general. >>>>>>> >>>>>>> >>>>>> Hello, >>>>>> Why you want to verify that exception was thrown in WicketTester? IMHO it >>>>>> is not proper place to check that. >>>>>> In my code I am verifying expcetions in services tests using >>>>>> catch-exception library [1]. >>>>>> >>>>>> And then while testing Page I am mocking my service to throw exception >>>>>> and >>>>>> I am verifying behaviour on exception (e.g. redirecting to login page, >>>>>> showing error message etc...) >>>>>> >>>>>> That makes not only clearer code but also simplify testing. >>>>>> you can see example of services tests in [2] and page tests in [3] >>>>>> >>>>>> [1] http://code.google.com/p/catch-exception/ >>>>>> [2] >>>>>> https://bitbucket.org/margielm/confitura/src/8599eae2ba00/src/test/java/jelatyna/services/UserServiceImplShould.java >>>>>> [3] >>>>>> https://bitbucket.org/margielm/confitura/src/8599eae2ba00/src/test/java/jelatyna/pages/admin/login/LoginPageShould.java >>>>>> -- >>>>>> Pozdrawiam/Best regards >>>>>> MichaĆ Margiel >>>>>> >>>>>> http://www.confitura.pl (dawniej Javarsovia) >>>>>> http://www.linkedin.com/in/MichalMargiel >>>>>> http://www.margiel.eu >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>> >>> >>> >>> >>> -- >>> Martin Grigorov >>> jWeekend >>> Training, Consulting, Development >>> http://jWeekend.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 >> > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.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