flow icon indicating copy to clipboard operation
flow copied to clipboard

UIInitEvent should have the current path

Open ImOlli opened this issue 1 year ago • 1 comments

Describe your motivation

There is no way to get the current path in the UIInitEvent. Since VaadinRequest.getPath() returns "/". But i don't see why this should be a problem since the BootstrapHandler has the current Route in the BootstrapContext.getRoute().

Describe the solution you'd like

I would like to access the current path in the UIInitEvent or access it threw the VaadinRequest

Describe alternatives you've considered

My current alternative is to implement my own BootstrapHandler and firing an own "UiInitEvent" after the createAndInitUI Method is called.

ImOlli avatar Jul 20 '22 07:07 ImOlli

@ImOlli maybe not be exactly what you want, but you can use the following to get the current URL basically anywhere in the code:

UI.getCurrent().getPage().fetchCurrentURL(url -> System.out.println(url));

taefi avatar Aug 02 '22 13:08 taefi