Package org.apache.wicket

Examples of org.apache.wicket.RestartResponseException


  /**
   * Construct.
   */
  public HomePagePageRedirect()
  {
    throw new RestartResponseException(new RedirectPage());
  }
View Full Code Here


          // logon successful. Continue to the original destination
          if (!continueToOriginalDestination())
          {
            // Ups, no original destination. Go to the home page
            throw new RestartResponseException(getApplication().getSessionSettings()
              .getPageFactory()
              .newPage(getApplication().getHomePage()));
          }
        }
      }
View Full Code Here

          IRequestHandler activeRequestHandler = requestCycle.getActiveRequestHandler();
          String url = requestCycle.urlFor(activeRequestHandler).toString();
          String relativeUrl = requestCycle.getUrlRenderer()
            .renderContextPathRelativeUrl(url, request);
          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

    final Page responsePage = requestCycle.getResponsePage();

    Page override = onRuntimeException(responsePage, e);
    if (override != null)
    {
      throw new RestartResponseException(override);
    }
    else if (e instanceof AuthorizationException)
    {
      // are authorization exceptions always thrown before the real
      // render?
      // else we need to make a page (see below) or set it hard to a
      // redirect.
      Class accessDeniedPageClass = application.getApplicationSettings()
        .getAccessDeniedPage();

      throw new RestartResponseAtInterceptPageException(accessDeniedPageClass);
    }
    else if (e instanceof PageExpiredException)
    {
      Class pageExpiredErrorPageClass = application.getApplicationSettings()
        .getPageExpiredErrorPage();
      boolean mounted = isPageMounted(pageExpiredErrorPageClass);
      RequestCycle.get().setRedirect(mounted);
      throw new RestartResponseException(pageExpiredErrorPageClass);
    }
    else if (settings.getUnexpectedExceptionDisplay() != IExceptionSettings.SHOW_NO_EXCEPTION_PAGE)
    {
      // we do not want to redirect - we want to inline the error output
      // and preserve the url so when the refresh button is pressed we
      // rerun the code that caused the error
      requestCycle.setRedirect(false);

      // figure out which error page to show
      Class internalErrorPageClass = application.getApplicationSettings()
        .getInternalErrorPage();
      Class responseClass = responsePage != null ? responsePage.getClass() : null;

      if (responseClass != internalErrorPageClass &&
        settings.getUnexpectedExceptionDisplay() == IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
      {
        throw new RestartResponseException(internalErrorPageClass);
      }
      else if (responseClass != ExceptionErrorPage.class)
      {
        // Show full details
        throw new RestartResponseException(new ExceptionErrorPage(e, responsePage));
      }
      else
      {
        // give up while we're ahead!
        throw new WicketRuntimeException("Internal Error: Could not render error page " +
View Full Code Here

          // logon successful. Continue to the original destination
          if (!continueToOriginalDestination())
          {
            // Ups, no original destination. Go to the home page
            throw new RestartResponseException(getApplication().getSessionSettings()
              .getPageFactory()
              .newPage(getApplication().getHomePage()));
          }
        }
        else
View Full Code Here

          IRequestHandler activeRequestHandler = requestCycle.getActiveRequestHandler();
          String url = requestCycle.urlFor(activeRequestHandler).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

    }
    if (user == null || emailAddress == null) {
      LOGGER.error("There is no user or email address available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }

    if (emailAddress.getEmailHash() == null) {
      emailAddress.setEmailHash(userService.getHash(user, emailAddress.getEmail()));
    }
View Full Code Here

    }
    if (user == null || emailAddress == null) {
      LOGGER.error("There is no user or email address available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }

    if (emailAddress.getEmailHash() == null) {
      emailAddress.setEmailHash(userService.getHash(user, emailAddress.getEmail()));
    }
View Full Code Here

    User user = userService.getByUserName(ConsoleNotificationIndexPage.DEFAULT_USERNAME);
    if (user == null) {
      LOGGER.error("There is no user available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }
    user.setNotificationHash(userService.getHash(user, user.getPasswordHash()));
   
    add(new ResetPasswordHtmlNotificationPanel("htmlPanel", Model.of(user)));
    user.setNotificationHash(null);
View Full Code Here

             
              // Reset authentication session attribute
              request.getSession().removeAttribute(Pac4jAuthenticationUtils.AUTH_TOKEN_ATTRIBUTE);
             
              getSession().success(getString("register.success"));
              throw new RestartResponseException(HomePage.class);
            } else {
              LOGGER.warn("Username '" + user.getUserName() + "' already used");
              getSession().error(getString("register.userName.notUnique"));
            }
          }
        } catch (RestartResponseException e) {
          throw e;
        } catch (Exception e) {
          LOGGER.error("Error occured while creating account.", e);
          getSession().error(getString("register.error"));
        }
      }
    };
   
    // Email field
    EmailTextField emailInput = new EmailTextField("emailInput", BindingModel.of(userModel, Binding.user().email()));
    emailInput.setLabel(new ResourceModel("register.email"));
    emailInput.setRequired(true);
    form.add(emailInput);
   
    // Name fields
    TextField<String> fullNameInput = new TextField<String>("fullNameInput", BindingModel.of(userModel, Binding.user().fullName()));
    fullNameInput.setLabel(new ResourceModel("register.fullName"));
    form.add(fullNameInput);
   
    // Password fields
    WebMarkupContainer passwordContainer = new WebMarkupContainer("passwordContainer") {
      private static final long serialVersionUID = 2727669661139358058L;
     
      @SuppressWarnings("unchecked")
      @Override
      protected void onConfigure() {
        super.onConfigure();
        boolean isRemoteRegistration = isRemoteRegistration();
       
        setVisible(!isRemoteRegistration);
        for (int i = 0; i < size(); ++i) {
          ((FormComponent<String>) get(i)).setRequired(!isRemoteRegistration);
        }
      }
    };
    form.add(passwordContainer);
   
    PasswordTextField passwordInput = new PasswordTextField("passwordInput", this.passwordModel); // FIXME: Génère un warning au submit
    passwordInput.setLabel(new ResourceModel("register.password"));
    passwordInput.add(new PasswordPatternValidator());
    passwordContainer.add(passwordInput);
   
    PasswordTextField confirmPasswordInput = new PasswordTextField("confirmPasswordInput", this.confirmPasswordModel);
    confirmPasswordInput.setLabel(new ResourceModel("register.confirmPassword"));
    passwordContainer.add(confirmPasswordInput);
   
    // Remote identifier field
    TextField<String> remoteIdentifierInput = new TextField<String>("remoteIdentifierInput",
        BindingModel.of(userModel, Binding.user().remoteIdentifier())) {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onConfigure() {
        super.onConfigure();
        boolean isRemoteRegistration = isRemoteRegistration();

        setVisible(isRemoteRegistration);
        setRequired(isRemoteRegistration);
      }
    };
    remoteIdentifierInput.setLabel(new ResourceModel("register.remote.identifier"));
    remoteIdentifierInput.setEnabled(false);
    form.add(remoteIdentifierInput);
   
    Link<Void> clearRemoteIdentifierLink = new Link<Void>("clearRemoteIdentifierLink") {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick() {
        // Reset authentication session attribute
        HttpServletRequest request = ((ServletWebRequest) RequestCycle.get().getRequest()).getContainerRequest();
        request.getSession().removeAttribute(Pac4jAuthenticationUtils.AUTH_TOKEN_ATTRIBUTE);
       
        RegisterFormPanel.this.userModel.setObject(new User());
        RegisterFormPanel.this.userModel.getObject().setActive(false);
       
        throw new RestartResponseException(RegisterPage.class);
      }
    };
    form.add(clearRemoteIdentifierLink);
   
    if (!isRemoteRegistration()) {
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.