Class RedirectView
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
de.codecamp.vaadin.security.spring.util.RedirectView
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.router.BeforeEnterObserver,com.vaadin.flow.router.internal.BeforeEnterHandler,Serializable
@Route("redirect")
public class RedirectView
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
implements com.vaadin.flow.router.BeforeEnterObserver
Vaadin does not offer a way to redirect to a(n external) URL (as opposed to another view).
Page.setLocation(String) would work, but does not prevent the original target view from
being shown first. So this class provides a workaround until
issue #4606 is implemented in Vaadin.
Simply call redirectToUrl(BeforeEnterEvent, String) to redirect to a URL.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeEnter(com.vaadin.flow.router.BeforeEnterEvent event) static voidredirectToUrl(com.vaadin.flow.router.BeforeEnterEvent event, String targetUrl) Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Field Details
-
ROUTE_PATH
- See Also:
-
-
Constructor Details
-
RedirectView
public RedirectView()
-
-
Method Details
-
beforeEnter
public void beforeEnter(com.vaadin.flow.router.BeforeEnterEvent event) - Specified by:
beforeEnterin interfacecom.vaadin.flow.router.internal.BeforeEnterHandler
-
redirectToUrl
-