Re: Wicket 1.5 and weird error on redirect

2011-12-18 Thread Dan Retzlaff
Try throwing RestartResponseException instead of calling setResponsePage.
This will stop the construction of your StopPage immediately.

I think setResponsePage is intended for use during the action part of a
request (e.g. onClick). 1.4 may just be more forgiving of its use elsewhere.

On Sun, Dec 18, 2011 at 2:18 PM, Guillaume Smet guillaume.s...@gmail.comwrote:

 Hello,

 We are currently migrating our applications from Wicket 1.4 to 1.5.

 I have a problem with a pattern we use for logout, namely:
 public class LogoutPage extends WebPage {
public LogoutPage() {
AuthenticatedWebSession session =
 AuthenticatedWebSession.get();
if (session != null) {
session.invalidate();
}


  
 setResponsePage(CoreWicketAuthenticatedApplication.get().getSignInPageClass());
}
 }

 In Wicket 1.4, it worked perfectly. The only change I made is that I
 had to remove the setRedirect(true) for 1.5.

 With 1.5, when I click on a bookmarkable link pointing to LogoutPage,
 I have the following error:
 org.apache.wicket.markup.MarkupNotFoundException: Can not determine
 Markup. Component is not yet connected to a parent. [Page class =
 fr.openwide.core.wicket.more.security.page.LogoutPage, id = 86, render
 count = 1]
 at org.apache.wicket.Component.getMarkup(Component.java:731)
 at org.apache.wicket.Component.internalRender(Component.java:2312)
 at org.apache.wicket.Component.render(Component.java:2275)
 at org.apache.wicket.Page.renderPage(Page.java:1035)
 at
 org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
 at
 org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
 at
 org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
 at
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
 at
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
 at
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
 at
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
 at
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
 at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)

 Any idea on why it doesn't work anymore and how I can fix it?

 Thanks.

 --
 Guillaume

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




Re: Wicket 1.5 and weird error on redirect

2011-12-18 Thread Guillaume Smet
Hi Dan,

On Sun, Dec 18, 2011 at 11:29 PM, Dan Retzlaff dretzl...@gmail.com wrote:
 Try throwing RestartResponseException instead of calling setResponsePage.
 This will stop the construction of your StopPage immediately.

Thanks for your answer.

Using throw new RestartResponseException(clazz); was indeed my next
move but I was wondering if this behaviour with setResponsePage() was
expected.

It works with the exception so I'll go change that everywhere I use
setResponsePage in a page.

Regards,

-- 
Guillaume

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



Re: Wicket 1.5 and weird error on redirect

2011-12-18 Thread Martin Grigorov
Hi,

On Mon, Dec 19, 2011 at 12:18 AM, Guillaume Smet
guillaume.s...@gmail.com wrote:
 Hello,

 We are currently migrating our applications from Wicket 1.4 to 1.5.

 I have a problem with a pattern we use for logout, namely:
 public class LogoutPage extends WebPage {
        public LogoutPage() {
                AuthenticatedWebSession session = 
 AuthenticatedWebSession.get();
                if (session != null) {

Better use Session.exists() instead of .get(), because #get() acts as
getOrCreate().

                        session.invalidate();
                }

                
 setResponsePage(CoreWicketAuthenticatedApplication.get().getSignInPageClass());
        }
 }

 In Wicket 1.4, it worked perfectly. The only change I made is that I
 had to remove the setRedirect(true) for 1.5.

 With 1.5, when I click on a bookmarkable link pointing to LogoutPage,
 I have the following error:
 org.apache.wicket.markup.MarkupNotFoundException: Can not determine
 Markup. Component is not yet connected to a parent. [Page class =
 fr.openwide.core.wicket.more.security.page.LogoutPage, id = 86, render
 count = 1]
     at org.apache.wicket.Component.getMarkup(Component.java:731)
     at org.apache.wicket.Component.internalRender(Component.java:2312)
     at org.apache.wicket.Component.render(Component.java:2275)
     at org.apache.wicket.Page.renderPage(Page.java:1035)
     at 
 org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
     at 
 org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
     at 
 org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
     at 
 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
     at 
 org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at 
 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
     at 
 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
     at 
 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:280)
     at 
 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
     at 
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)

 Any idea on why it doesn't work anymore and how I can fix it?

 Thanks.

 --
 Guillaume

 -
 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