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.
Thanks, Alec On Thu, Jun 7, 2012 at 6:18 PM, Martin Grigorov <mgrigo...@apache.org> wrote: > On Fri, Jun 8, 2012 at 12:37 AM, Alec Swan <alecs...@gmail.com> wrote: >> I am also asking how to redirect to sub-site's home page when the user >> is not authenticated and tries to access on of those sub-site pages. > > Use a custom IAuthenticationStrategy that knows which pages are part > of this sub-site (e.g. you can annotate them with a special @SubSite) > and > if the user is not logged in then redirect to @SubSite.homePage class. > This way even every page can it have its own home page. > >> >> On Thu, Jun 7, 2012 at 3:35 PM, Alec Swan <alecs...@gmail.com> wrote: >>> The problem is that I cannot verify this exception in tests. I am >>> basically asking for best practices. >>> >>> Thanks! >>> >>> On Thu, Jun 7, 2012 at 1:30 AM, Martin Grigorov <mgrigo...@apache.org> >>> wrote: >>>> Hi, >>>> >>>> You can use IAuthenticationStrategy and throw >>>> RestartResponseAtInterceptException. >>>> >>>> On Wed, Jun 6, 2012 at 8:09 PM, Alec Swan <alecs...@gmail.com> wrote: >>>>> Hello, >>>>> >>>>> I am creating a new set of pages that are a part of an old project but >>>>> have a different home page. It's kind of like a sub-site within a >>>>> site. The user is required to log in on the sub-site's home page to be >>>>> able to access any of those pages. If the user tries to access any of >>>>> these pages directly he should be redirected to the sub-site's home >>>>> page. >>>>> >>>>> What's the best way to implement/configure the home page for this >>>>> sub-site? >>>>> What kind of exception should each sub-site page throw to trigger >>>>> redirection to home page? >>>>> How can I verify that an exception was thrown in my test? (Currently I >>>>> have a test which calls startPanel(..) which logs an exception if the >>>>> user is not logged in, but returns with no errors. So, I have to >>>>> verify that the rendered page is what it should be.) >>>>> >>>>> I am basically looking for best practices here. >>>>> >>>>> Thanks, >>>>> >>>>> Alec >>>>> >>>>> --------------------------------------------------------------------- >>>>> 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