Something like setUriFragment

In my Vaadin 7 MPR code, I have the following from my original Vaadin 7 app:

		try {
			if( com.vaadin.server.Page.getCurrent() instanceof com.vaadin.server.Page )
			{
				String uriFragment = com.vaadin.server.Page.getCurrent().getUriFragment();

				if( uriFragment != null && !uriFragment.trim().isEmpty() )
				{
					com.vaadin.server.Page.getCurrent().setUriFragment("", false );
				}
			}
		} catch (Exception e) {
			LOGGER.severe( "Error setting URI fragment, Vaadin 7: " + e );
		}

How do I do similar actions in Flow? In above case, I am actually just trying to get rid of the path segments, such as “/dashboard”, so it goes back to the root context/starting point. I figure it has something to do with the Location class, but searching the documents for that did not help much.

Total side note, but the above does nothing in my MPR Vaadin 7 code. It works perfectly in the pure Vaadin 7 app.

If I got your question right, you want to navigate from one URL to the root of your application. If that is the case, then as far as I know the best option for you is to find out which view is @Routed with the value of "" (eg. WelcomeView) and then you say UI.getCurrent().navigate(WelcomeView.class).

Some docs to look at:

https://vaadin.com/docs/v14/flow/routing/tutorial-routing-annotation.html

https://vaadin.com/docs/v14/flow/routing/tutorial-router-url-parameters.html

https://vaadin.com/docs/v14/flow/routing/tutorial-routing-navigation.html

T.

Thanks, I tried both UI.getCurrent().navigate(""); and UI.getCurrent().navigate(WmsEntryPoint.class);, and they worked perfectly. I am going with UI.getCurrent().navigate("");, as it makes a little more obvious for me in the code, but they both accomplish the same thing. I knew it was something obvious. Thanks.