Example usage for com.vaadin.server CustomizedSystemMessages setAuthenticationErrorURL

List of usage examples for com.vaadin.server CustomizedSystemMessages setAuthenticationErrorURL

Introduction

In this page you can find the example usage for com.vaadin.server CustomizedSystemMessages setAuthenticationErrorURL.

Prototype

public void setAuthenticationErrorURL(String authenticationErrorURL) 

Source Link

Document

Sets the URL to go to when there is a authentication error.

Usage

From source file:com.klwork.explorer.web.DefaultSpringSystemMessagesProvider.java

License:Apache License

@Override
public SystemMessages getSystemMessages(Locale locale) {
    CustomizedSystemMessages systemMessages = new CustomizedSystemMessages();
    String message;/*  w  ww .j av a2  s.co  m*/

    message = messageSource.getMessage("vaadin.sessionExpired.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setSessionExpiredCaption(message);
    }
    message = messageSource.getMessage("vaadin.sessionExpired.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setSessionExpiredMessage(message);
    }
    message = messageSource.getMessage("vaadin.sessionExpired.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setSessionExpiredURL(message);
    }
    message = messageSource.getMessage("vaadin.sessionExpired.NotificationEnabled", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setSessionExpiredNotificationEnabled(notificationEnabled);
    }

    message = messageSource.getMessage("vaadin.communicationError.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCommunicationErrorCaption(message);
    }
    message = messageSource.getMessage("vaadin.communicationError.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCommunicationErrorMessage(message);
    }
    message = messageSource.getMessage("vaadin.communicationError.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCommunicationErrorURL(message);
    }
    message = messageSource.getMessage("vaadin.communicationError.NotificationEnabled", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setCommunicationErrorNotificationEnabled(notificationEnabled);
    }

    message = messageSource.getMessage("vaadin.authenticationError.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setAuthenticationErrorCaption(message);
    }
    message = messageSource.getMessage("vaadin.authenticationError.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setAuthenticationErrorMessage(message);
    }
    message = messageSource.getMessage("vaadin.authenticationError.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setAuthenticationErrorURL(message);
    }
    message = messageSource.getMessage("vaadin.authenticationError.NotificationEnabled", null,
            MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setAuthenticationErrorNotificationEnabled(notificationEnabled);
    }

    message = messageSource.getMessage("vaadin.internalError.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setInternalErrorCaption(message);
    }
    message = messageSource.getMessage("vaadin.internalError.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setInternalErrorMessage(message);
    }
    message = messageSource.getMessage("vaadin.internalError.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setInternalErrorURL(message);
    }
    message = messageSource.getMessage("vaadin.internalError.NotificationEnabled", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setInternalErrorNotificationEnabled(notificationEnabled);
    }

    message = messageSource.getMessage("vaadin.outOfSync.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setOutOfSyncCaption(message);
    }
    message = messageSource.getMessage("vaadin.outOfSync.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setOutOfSyncMessage(message);
    }
    message = messageSource.getMessage("vaadin.outOfSync.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setOutOfSyncURL(message);
    }
    message = messageSource.getMessage("vaadin.outOfSync.NotificationEnabled", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setOutOfSyncNotificationEnabled(notificationEnabled);
    }

    message = messageSource.getMessage("vaadin.cookiesDisabled.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCookiesDisabledCaption(message);
    }
    message = messageSource.getMessage("vaadin.cookiesDisabled.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCookiesDisabledMessage(message);
    }
    message = messageSource.getMessage("vaadin.cookiesDisabled.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCookiesDisabledURL(message);
    }
    message = messageSource.getMessage("vaadin.cookiesDisabled.NotificationEnabled", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setCookiesDisabledNotificationEnabled(notificationEnabled);
    }

    return systemMessages;
}

From source file:de.catma.servlet.CatmaApplicationServlet.java

License:Open Source License

@Override
protected void servletInitialized() throws ServletException {
    super.servletInitialized();
    getService().addSessionInitListener(new SessionInitListener() {

        @Override/*from   w ww. ja v a2 s . c  om*/
        public void sessionInit(SessionInitEvent event) throws ServiceException {
            event.getSession().addBootstrapListener(new CatmaBootstrapListener());
        }
    });

    getService().setSystemMessagesProvider(new SystemMessagesProvider() {
        @Override
        public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
            CustomizedSystemMessages messages = new CustomizedSystemMessages();
            try {
                String problemRedirectURL = RepositoryPropertyKey.BaseURL
                        .getValue(RepositoryPropertyKey.BaseURL.getDefaultValue());

                messages.setAuthenticationErrorURL(problemRedirectURL);
                messages.setInternalErrorURL(problemRedirectURL);
                messages.setSessionExpiredURL(problemRedirectURL);
                messages.setCommunicationErrorURL(problemRedirectURL);
                messages.setCookiesDisabledURL(problemRedirectURL);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return messages;
        }
    });

}

From source file:pl.exsio.frameset.vaadin.bootstrap.spring.DefaultSpringSystemMessagesProvider.java

License:Open Source License

@Override
public SystemMessages getSystemMessages(Locale locale) {
    CustomizedSystemMessages systemMessages = new CustomizedSystemMessages();
    String message;//w w w .ja v a  2 s  .c om

    message = this.messageSource.getMessage("vaadin.sessionExpired.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setSessionExpiredCaption(message);
    }
    message = this.messageSource.getMessage("vaadin.sessionExpired.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setSessionExpiredMessage(message);
    }
    message = this.messageSource.getMessage("vaadin.sessionExpired.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setSessionExpiredURL(message);
    }
    message = this.messageSource.getMessage("vaadin.sessionExpired.NotificationEnabled", null,
            MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setSessionExpiredNotificationEnabled(notificationEnabled);
    }

    message = this.messageSource.getMessage("vaadin.communicationError.Caption", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCommunicationErrorCaption(message);
    }
    message = this.messageSource.getMessage("vaadin.communicationError.Message", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCommunicationErrorMessage(message);
    }
    message = this.messageSource.getMessage("vaadin.communicationError.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCommunicationErrorURL(message);
    }
    message = this.messageSource.getMessage("vaadin.communicationError.NotificationEnabled", null,
            MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setCommunicationErrorNotificationEnabled(notificationEnabled);
    }

    message = this.messageSource.getMessage("vaadin.authenticationError.Caption", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setAuthenticationErrorCaption(message);
    }
    message = this.messageSource.getMessage("vaadin.authenticationError.Message", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setAuthenticationErrorMessage(message);
    }
    message = this.messageSource.getMessage("vaadin.authenticationError.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setAuthenticationErrorURL(message);
    }
    message = this.messageSource.getMessage("vaadin.authenticationError.NotificationEnabled", null,
            MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setAuthenticationErrorNotificationEnabled(notificationEnabled);
    }

    message = this.messageSource.getMessage("vaadin.internalError.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setInternalErrorCaption(message);
    }
    message = this.messageSource.getMessage("vaadin.internalError.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setInternalErrorMessage(message);
    }
    message = this.messageSource.getMessage("vaadin.internalError.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setInternalErrorURL(message);
    }
    message = this.messageSource.getMessage("vaadin.internalError.NotificationEnabled", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setInternalErrorNotificationEnabled(notificationEnabled);
    }

    message = this.messageSource.getMessage("vaadin.outOfSync.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setOutOfSyncCaption(message);
    }
    message = this.messageSource.getMessage("vaadin.outOfSync.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setOutOfSyncMessage(message);
    }
    message = this.messageSource.getMessage("vaadin.outOfSync.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setOutOfSyncURL(message);
    }
    message = this.messageSource.getMessage("vaadin.outOfSync.NotificationEnabled", null, MESSAGE_NOT_FOUND,
            locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setOutOfSyncNotificationEnabled(notificationEnabled);
    }

    message = this.messageSource.getMessage("vaadin.cookiesDisabled.Caption", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCookiesDisabledCaption(message);
    }
    message = this.messageSource.getMessage("vaadin.cookiesDisabled.Message", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCookiesDisabledMessage(message);
    }
    message = this.messageSource.getMessage("vaadin.cookiesDisabled.URL", null, MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        systemMessages.setCookiesDisabledURL(message);
    }
    message = this.messageSource.getMessage("vaadin.cookiesDisabled.NotificationEnabled", null,
            MESSAGE_NOT_FOUND, locale);
    if (!message.equals(MESSAGE_NOT_FOUND)) {
        boolean notificationEnabled = (message.equalsIgnoreCase("true") || message.equalsIgnoreCase("1"));
        systemMessages.setCookiesDisabledNotificationEnabled(notificationEnabled);
    }

    return systemMessages;
}