Ahh! RTFM. Thank you for not yelling :) On Fri, Sep 12, 2008 at 11:55 AM, Hugo Palma <[EMAIL PROTECTED]> wrote:
> Actually it's the other way around. > You should return true from the dispatch method when you want to redirect. > > The javadoc for the dispatch method states: > "@return true if a response was delivered, false if the servlet container > should be allowed to handle the request" > > > Inge Solvoll wrote: > >> Hi! >> >> I've implemented my own version of the dispatcher pattern from the wiki >> >> http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher >> http://wiki.apache.org/tapestry/Tapestry5HowToCreateADispatcher2 >> >> I'm redirecting to our Struts login page through my custom made StrutsLink >> that works. I'm actually redirected to the correct login, but the >> requested >> tapestry 5 page is run first... Obviously I don't want that. I expected >> that >> when I return false from the dispatch method, the requested page is >> skipped. >> Am I wrong? >> >> >> >> My code: >> >> public class AccessController implements Dispatcher { >> >> private ApplicationStateManager asm; >> >> public AccessController(ApplicationStateManager asm) { >> this.asm = asm; >> } >> >> public boolean dispatch(Request request, Response response) throws >> IOException { >> boolean canAccess = false; >> >> if (asm.exists(User.class)) { >> canAccess = true; >> } >> else { >> User userInSession = (User) >> request.getSession(true).getAttribute(GlobalKeys.SESSION_USER); >> if (userInSession != null) { >> asm.set(User.class, userInSession); >> canAccess = true; >> } >> } >> >> if (!canAccess) { >> >> request.getSession(true).setAttribute("requestedPath", >> request.getPath()); >> >> response.sendRedirect(new StrutsLink(request, "/login.do")); >> } >> >> return false; >> } >> } >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >