Navigate from a thread

Good morning,
I am trying to navigate to another page from a Thread as follows:

timer.cancel();

ui.access(() -> {
	String route = ui.getRouter().getUrl(CertidaoReportView.class, resultLine);
	ui.getPage().executeJavaScript("window.open(\"" + route + "\", \"_blank\");");
});

And it is generating the following error message:

“Could not navigate to 'CertidaoRpView…”

How to fix it?

You can try:

ui.access(() -> {
	String route = ui.getRouter().getUrl(CertidaoReportView.class, resultLine); 
	ui.getPage().open(route);	
}); 

Hi Temitayo Odesanmi,

I tried to do as you suggested, but an “Page” doesn’t have the “open” method. I’m using Vaadin version 13.0.3.

Thank you very much,

I tried too:

ui.access(() -> {
	String route = ui.getRouter().getUrl(CertidaoReportView.class, resultLine);
	ui.navigate(route);
});

And it is generating the following error message:
“java.util.concurrent.ExecutionException: java.lang.IllegalStateException: No request bound to current thread”

I’m sorry guys. The statement
“ui.getPage (). ExecuteJavaScript (” window.open (\ “” + route + "", \ "_ blank "); “);”
works correctly. The problem was that the passed parameter had the “/” character to enter a datetime. After removing the “/” character everything worked normally.

Very grateful for your attention.