URI Clean up

Good day,
I’m having an issue where I’m unable to get rid of URI parameters included in a link sent to users. Here is the situation;
I send a link to users in the form
http://mysite/myapp?token=91792a8de1e011e5b8f5303a64b3cc11
This link redirects them to a secure page as follows

    protected void init(VaadinRequest request) {
        navigator = new Navigator(this, this);
        String token  = request.getParameter("token");
        if (Util.isNotEmpty(token)) {
            getUI().getCurrent().getSession().setAttribute(TOKEN, token);
            navigator.navigateTo("createPassword");
        }else{
            navigator.navigateTo("login");
        }
    }

Once the user is done creating the password, they are redirected to the login page by the code snippet

navigator.navigateTo("login");

and the resulting URI is

http://mysite/myapp/?token=91792a8de1e011e5b8f5303a64b3cc11#!login

And the parameter hangs around continuously (when I log into the application and navigate around)
How do I rewrite the URI to

http://mysite/myapp/#!login

Navigator uses uri fragment, which doesn’t send page load so the url doesn’t change. Use Page.getCurrent().setLocation(uri) until you have logged in the user and then use navigator after that.

@Johannes, Thanks but I already tried that and it resulted in

java.lang.IllegalArgumentException: Trying to navigate to an unknown state '' and an error view provider not present
    at com.vaadin.navigator.Navigator.navigateTo(Navigator.java:575)
    at com.vaadin.ui.UI.doInit(UI.java:687)
    at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:214)
    at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:74)
    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1409)
    at com.vaadin.cdi.server.VaadinCDIServletService.handleRequest(VaadinCDIServletService.java:92)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:364)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

I'm using the CDIViewProvider (added to the navigator) to manage my views, have no way of doing so with the Page.

[/code]
[/code]