vaadin strip query parameters when calling forwardTo

Viewed 114

As part of my login process, I'm redirecting to a view LoginValidationView.

The validation view validates the login details and then forward the user to the default post-login page.

The problem is the LoginValidationView is passed some query parameters (outside of my control) but I don't want to pass those query parameters to the next view.

I've tried using UI.navigateTo but that doesn't appear to work in a beforeEnter handler.

So how do I remove the query parameters?

package dev.mine.ui.user.views;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.BeforeEnterObserver;
import com.vaadin.flow.router.Route;

@Route(value = "LoginValidate")
public class LoginValidatorView extends VerticalLayout implements  BeforeEnterObserver
{
    public LoginValidatorView()
    {

    }

    @Override
    public void beforeEnter(BeforeEnterEvent event)
    {
       /// Don't forward the query parameters.
        event.forwardTo(SearchView.class);

    }

}

1 Answers
Related