wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: Exception handling and testing
Date Fri, 08 Jun 2012 00:18:41 GMT
On Fri, Jun 8, 2012 at 12:37 AM, Alec Swan <alecswan@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 <alecswan@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 <mgrigorov@apache.org> wrote:
>>> Hi,
>>>
>>> You can use IAuthenticationStrategy and throw
>>> RestartResponseAtInterceptException.
>>>
>>> On Wed, Jun 6, 2012 at 8:09 PM, Alec Swan <alecswan@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-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>>
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Mime
View raw message