Vaadin 7 - Navigating between views using UrlFragments

Nowadays when you want to navigate between Views you usually use the
class. But I want to use
aswell. I have implemented following code so far but to be honest,I don’t know how to use
correctly. Please help![code]
public class MyUI extends UI {

Navigator navigator;

protected  static final String MAINVIEW = "main";

protected void init(VaadinRequest vaadinRequest) {
    getPage().setTitle("Vaadin vulnerabilities");
    getPage().addUriFragmentChangedListener(new UriFragmentChangedListener() {
        public void uriFragmentChanged(UriFragmentChangedEvent event) {
    navigator = new Navigator(this,this);
    navigator.addView(MAINVIEW, new MainView());
    navigator.addView("", new StartView());

void enter(String fragment) {

@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet {

public class StartView extends VerticalLayout implements View {
    public StartView() {
        Button button = new Button("Zur Hauptansicht",
                new Button.ClickListener() {
            public void buttonClick(ClickEvent event) {
                if(userNameTextField.getValue().equals("")|| userNameTextField.getValue().isEmpty()) {
          "Bitte einen gültigen Wert eingeben!");
                else {
                    navigator.navigateTo(MAINVIEW + "/" + userNameTextField.getValue());
                    // What to do here with urlfragments?

    public void enter(ViewChangeEvent event) {



the Navigator uses URI fragments anyway; I don’t think there’s any reason to create a Navigator if you want to implement your own URI fragments navigator.