public class CustomizedSystemMessages extends SystemMessages
Vaadin gets the SystemMessages from the SystemMessagesProvider
configured in VaadinService
. You can customize this by creating a
VaadinServiceInitListener
that sets an instance of
SystemMessagesProvider
to
VaadinService.setSystemMessagesProvider(SystemMessagesProvider)
, that
in turns creates instances of CustomizedSystemMessages.
The default behavior is to show a notification, and reload the browser page
once the user clicks the message.
However, only for session expiration, that default is to reload the page
without any notification. Instead of reloading the page, you can set a
specific URL that the user is taken to.
Setting both caption and message to null will reload the page (or go to the
specified URL) without displaying a notification.
set*NotificationEnabled(false) will achieve the same thing.
The situations are:
SystemMessagesProvider
,
VaadinService.setSystemMessagesProvider(SystemMessagesProvider)
,
Serialized FormcookiesDisabledCaption, cookiesDisabledMessage, cookiesDisabledNotificationEnabled, cookiesDisabledURL, internalErrorCaption, internalErrorMessage, internalErrorNotificationEnabled, internalErrorURL, sessionExpiredCaption, sessionExpiredMessage, sessionExpiredNotificationEnabled, sessionExpiredURL
Constructor and Description |
---|
CustomizedSystemMessages() |
Modifier and Type | Method and Description |
---|---|
void |
setCookiesDisabledCaption(String cookiesDisabledCaption)
Sets the caption to show in an "cookies disabled" notification.
|
void |
setCookiesDisabledMessage(String cookiesDisabledMessage)
Sets the message to show in a "cookies disabled" notification.
|
void |
setCookiesDisabledNotificationEnabled(boolean cookiesDisabledNotificationEnabled)
Sets whether a "cookies disabled" notification should be shown to the end
user.
|
void |
setCookiesDisabledURL(String cookiesDisabledURL)
Sets the URL the user will be redirected to after dismissing a "cookies
disabled" message.
|
void |
setInternalErrorCaption(String internalErrorCaption)
Sets the caption to show in an "internal error" notification.
|
void |
setInternalErrorMessage(String internalErrorMessage)
Sets the message to show in an "internal error" notification.
|
void |
setInternalErrorNotificationEnabled(boolean internalErrorNotificationEnabled)
Sets whether an "internal error" notification should be shown to the end
user.
|
void |
setInternalErrorURL(String internalErrorURL)
Sets the URL the user will be redirected to after dismissing an "internal
error" message.
|
void |
setSessionExpiredCaption(String sessionExpiredCaption)
Sets the caption to show in a "session expired" notification.
|
void |
setSessionExpiredMessage(String sessionExpiredMessage)
Sets the message to show in a "session expired" notification.
|
void |
setSessionExpiredNotificationEnabled(boolean sessionExpiredNotificationEnabled)
Sets whether a "session expired" notification should be shown to the end
user.
|
void |
setSessionExpiredURL(String sessionExpiredURL)
Sets the URL the user will be redirected to after dismissing a "session
expired" message.
|
getCookiesDisabledCaption, getCookiesDisabledMessage, getCookiesDisabledURL, getInternalErrorCaption, getInternalErrorMessage, getInternalErrorURL, getSessionExpiredCaption, getSessionExpiredMessage, getSessionExpiredURL, isCookiesDisabledNotificationEnabled, isInternalErrorNotificationEnabled, isSessionExpiredNotificationEnabled
public void setSessionExpiredURL(String sessionExpiredURL)
sessionExpiredURL
- the URL to redirect to, or null to refresh the pagepublic void setSessionExpiredNotificationEnabled(boolean sessionExpiredNotificationEnabled)
SystemMessages.getSessionExpiredURL()
.
By default, the "session expired" notification is disabled.sessionExpiredNotificationEnabled
- true
to show the notification to the end user,
false
to redirect directlypublic void setSessionExpiredCaption(String sessionExpiredCaption)
If both SystemMessages.getSessionExpiredCaption()
and
SystemMessages.getSessionExpiredMessage()
return null, the user will
automatically be forwarded to the URL returned by
SystemMessages.getSessionExpiredURL()
when the session expires.
sessionExpiredCaption
- The caption to show or null
to show no caption.public void setSessionExpiredMessage(String sessionExpiredMessage)
If both SystemMessages.getSessionExpiredCaption()
and
SystemMessages.getSessionExpiredMessage()
return null, the user will
automatically be forwarded to the URL returned by
SystemMessages.getSessionExpiredURL()
when the session expires.
sessionExpiredMessage
- The message to show or null
to show no message.public void setInternalErrorURL(String internalErrorURL)
internalErrorURL
- the URL to redirect to, or null to refresh the pagepublic void setInternalErrorNotificationEnabled(boolean internalErrorNotificationEnabled)
SystemMessages.getInternalErrorURL()
.
By default, the "internal error" notification is enabled.internalErrorNotificationEnabled
- true
to show the notification to the end user,
false
to redirect directlypublic void setInternalErrorCaption(String internalErrorCaption)
internalErrorCaption
- The caption to show or null
to show no caption.public void setInternalErrorMessage(String internalErrorMessage)
internalErrorMessage
- The message to show or null
to show no message.public void setCookiesDisabledURL(String cookiesDisabledURL)
cookiesDisabledURL
- the URL to redirect to, or null to refresh the pagepublic void setCookiesDisabledNotificationEnabled(boolean cookiesDisabledNotificationEnabled)
SystemMessages.getCookiesDisabledURL()
.
By default, the "cookies disabled" notification is enabled.cookiesDisabledNotificationEnabled
- true
to show the notification to the end user,
false
to redirect directlypublic void setCookiesDisabledCaption(String cookiesDisabledCaption)
cookiesDisabledCaption
- The caption to show or null
to show no caption.public void setCookiesDisabledMessage(String cookiesDisabledMessage)
cookiesDisabledMessage
- The message to show or null
to show no message.Copyright © 2025. All rights reserved.