Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
fragment #! in Url
Hello, did someone know how we do to remove this frament when we use Nagivator to navigate from view to an other view :
http://localhost:8080/vaadinsecurity/admin Instead of http://localhost:8080/vaadinsecurity/#!admin
My code :
from view 1:
.....
getSession().setAttribute("user", authentication.getName());
getUI().getNavigator().navigateTo(LoginMainView.NAME);
.....
To view 2:
public class LoginMainView extends CustomComponent implements View {
public static final String NAME = "admin";
Label text = new Label();
Button logout = new Button("Logout", new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
getSession().setAttribute("user",null);
getUI().getNavigator().navigateTo(NAME);
}
});
public LoginMainView() {
setCompositionRoot(new CssLayout(text, logout));
}
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
String username = String.valueOf(getSession().getAttribute("user"));
text.setValue("Hello " + username);
}
}
Those #! fragments are essential for the Navigator to work. You can check History add-on at https://vaadin.com/directory#!addon/history to work with Navigator having custom format for url.
Yeah, History add-on (and underlaying HTML pushState) is the thing that makes deep linkin work with views like it should.
In Vaadin 8 there will be also at least low level pushState support in the framework, but I'm hoping the core team will accept my patch which makes it in real use with Navigator by default:
https://github.com/vaadin/framework/pull/8209
If you find this important, like I do, please go to the pull request and comment there!
cheers,
matti