Hi John,

It works because LoginPage persists the link in your session:

   @Persist
    private Link nextPageLink;

Have you really seen it fail? Try for yourself - try user 2 (login with admin, 
admin):

        
http://jumpstart.doublenegative.com.au/jumpstart/theapp/security/userview/2

then log out, then try user 3:

        
http://jumpstart.doublenegative.com.au/jumpstart/theapp/security/userview/3

then log out, then try role 1:

        
http://jumpstart.doublenegative.com.au/jumpstart/theapp/security/roleview/1

Does it ever not work? If it needs fixing then I'd really like to know.

Geoff


On 29/04/2013, at 6:47 PM, John wrote:

> I don't think the following code works, it doesn't when I run my version of 
> it.
> 
> The loginPage has it's nextPageLink property set, but then the loginPageLink 
> is returned by using the Login.class which presumably just redirects to a 
> fresh login page without the nextPageLink set.
> 
> So the nextPageLink is null in the Login page so the nextPageLink cannot be 
> used.
> 
> John
> 
> http://jumpstart.doublenegative.com.au/jumpstart/examples/infrastructure/protectingpages
> 
> 
>            // Get the Login page, give it a link to the requested page, and 
> redirect to Login
> 
>            IIntermediatePage loginPage = (IIntermediatePage) 
> componentSource.getPage(Login.class);
> 
>            Link requestedPageLink = 
> makeLinkToRequestedPage(requestedPageName, eventContext);
>            loginPage.setNextPageLink(requestedPageLink);
> 
>            Link loginPageLink = 
> pageRenderLinkSource.createPageRenderLink(Login.class);
>            response.sendRedirect(loginPageLink);
> 
>            return false;

Reply via email to