getUser().addRole(new Role(Constants.USER_ROLE)); } else if (event.getRequestCycle().isRewinding()) { setUser(new User()); getUser().addRole(new Role(Constants.USER_ROLE));
    public void pageBeginRender(PageEvent event) {        if ((getUser() == null) && !event.getRequestCycle().isRewinding()) {            setUser(new User());            getUser().addRole(new Role(Constants.USER_ROLE));        } else if (event.getRequestCycle().isRewinding()) { // add            setUser(new User());            getUser().addRole(new Role(Constants.USER_ROLE));        }        // if user logged in with a cookie, display a warning that they        // can't change passwords        if (log.isDebugEnabled()) {            log.debug("checking for cookieLogin...");        }        if (getSession().getAttribute("cookieLogin") != null) {            setMessage(getMessage("userProfile.cookieLogin"));        }    }