Package org.apache.wicket

Examples of org.apache.wicket.RestartResponseException


                    }
                }
               
                // shouldn't return null given that we're in a session ...
                PageProvider errorPageProvider = errorPageProviderFor(ex);
                throw new RestartResponseException(errorPageProvider, RedirectPolicy.ALWAYS_REDIRECT);
            }
        }
    }
View Full Code Here


        if (username == null || "".equals(username)) {
            log.warn("Username not specified, notifying user that it's a required field.");
            getSession().error(new NotificationMessage(
                    new StringResourceModel("errors.required", this, null, new Object[]{"username"})));
            throw new RestartResponseException(Login.class);
        }

        log.debug("Processing Password Hint for username: {}", username);

        // look up the user's information
        try {
            User user = userManager.getUserByUsername(username);

            StringBuilder msg = new StringBuilder();
            msg.append("Your password hint is: ").append(user.getPasswordHint());
            msg.append("\n\nLogin at: ")
                    .append(RequestCycle.get().getUrlRenderer().renderFullUrl(
                            Url.parse(urlFor(Login.class, null).toString())));

            SimpleMailMessage message = new SimpleMailMessage();
            message.setTo(user.getEmail());

            String subject = '[' + getString("webapp.name") + "] " + getString("user.passwordHint");
            message.setSubject(subject);
            message.setText(msg.toString());
            log.debug("subject: {}", subject);
            log.debug("message: {}", message);
            mailEngine.send(message);

            getSession().info(createDefaultInfoNotificationMessage(new StringResourceModel(
                    "login.passwordHint.sent", this, null, new Object[] {username, "provided email address"})));
        } catch (UsernameNotFoundException e) {
            log.warn(e.getMessage());
            // This exception is expected to not be rethrown
            getSession().error(new NotificationMessage(new StringResourceModel(
                    "login.passwordHint.error", this, null, new Object[] {username})));
        } catch (MailException me) {
            log.error(me.getMessage(), me);
            getSession().error(new NotificationMessage(new ResourceModel("errors.sending.email")));
        }

        throw new RestartResponseException(Login.class);
    }
View Full Code Here

        getSession().invalidate();

        removeRememberMeCookie();

        throw new RestartResponseException(Login.class);
    }
View Full Code Here

        super.onInitialize();

        StartupListener.setupContext(getServletContext());
       
        getSession().info(createDefaultInfoNotificationMessage(new ResourceModel("reload.succeeded")));
        throw new RestartResponseException(getApplication().getHomePage());
    }
View Full Code Here

            log.warn(ade.getMessage());
            throw new SecurityException("AccessDenied on saving new user", ade);
        } catch (UserExistsException e) {
            error(new StringResourceModel("errors.existing.user", this, null, new Object[] {
                    user.getUsername(), user.getEmail()}).getString());
            throw new RestartResponseException(getPage());
        }
        return user;
    }
View Full Code Here

  static final AtomicBoolean PAGE_B_RENDERED    = new AtomicBoolean(false);

  public PageB() {
    super();

    throw new RestartResponseException(PageC.class);
  }
View Full Code Here

            url = requestCycle.urlFor(getApplication().getHomePage(), null).toString();
          }
          String relativeUrl = requestCycle.getUrlRenderer()
            .renderContextPathRelativeUrl(url);
          Page browserInfoPage = newBrowserInfoPage(relativeUrl);
          throw new RestartResponseException(browserInfoPage);
        }
        // if we get here, the redirect already has been done; clear
        // the meta data entry; we don't need it any longer is the client
        // info object will be cached too
        setMetaData(BROWSER_WAS_POLLED_KEY, null);
View Full Code Here

    while (cause.getCause() != null)
      cause = cause.getCause();

    // Redirect to login screen on certain exceptions
    if (cause instanceof PageExpiredException)
      throw new RestartResponseException(ISIApplication.get().getSignInPageClass());

    // Otherwise, display details
    message += "<b>" + cause.toString() + "</b>\n<ul>\n";
    trace = cause.getStackTrace();
    for (int i = 0; i < trace.length; i++)
View Full Code Here

  {
    // logon successful. Continue to the original destination
    continueToOriginalDestination();

    // Ups, no original destination. Go to the home page
    throw new RestartResponseException(getApplication().getHomePage());
  }
View Full Code Here

      {
        // we haven't done the redirect yet; record that we will be
        // doing that now and redirect
        session.setMetaData(BROWSER_WAS_POLLED_KEY, Boolean.TRUE);
        String url = "/" + getRequest().getURL();
        throw new RestartResponseException(new BrowserInfoPage(url));
      }
      // if we get here, the redirect already has been done; clear
      // the meta data entry; we don't need it any longer is the client
      // info object will be cached too
      session.setMetaData(BROWSER_WAS_POLLED_KEY, (Boolean)null);
View Full Code Here

TOP

Related Classes of org.apache.wicket.RestartResponseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.