url issue in vaadin

Hi all,

I recently bumped into this problem with Vaadin when it comes to deal with URLs. Imagine this situation:

  1. I have my main url. Let’s say http://localhost:8080/myapp/
  2. After accessing, as I have a viewprovider, the navigator goes to the default view (let’s say view A) → http://localhost:8080/myapp/!#viewA
  3. I have other buttons which navigate to other views http://localhost:8080/myapp/!#viewB, http://localhost:8080/myapp/!#viewC …and so on
  4. The problem is that I can type, apparently, anything in the url and it makes sense for Vaadin:
    5. If typing http://localhost:8080/myapp/ANYTHING!#viewA, the app goes to http://localhost:8080/myapp/ANYTHING!#viewA loading the right content (view A)
    6. If typing http://localhost:8080/myapp/!#viewAXXXX, the app goes to http://localhost:8080/myapp/!#viewA/XXX, loading again the right content (view A)
    7. If typing http://localhost:8080/myapp/!#viewBXXXX, the app goes to http://localhost:8080/myapp/!#viewA/XXX, loading again the content by defautl (view A)

Does it makes sense? It is the default behavior?? I would like to thrown an error page (commonly page not found) in case some weird pages are written…can anyone help me?


In fact, I’ve just checked that it happens the same thing on https://demo.vaadin.com/dashboard/#!dashboard, as you can type something like

https://demo.vaadin.com/dashboard/#!dasTESTINGhboard (renaming to https://demo.vaadin.com/dashboard/#!dashboard/hboard after loading the page)

And works in both cases…It’s a bit weird, isn’t it?


If you want to override that default behavior, I suppose you could at least try adding a FragmentChangedListener: https://vaadin.com/docs/v8/framework/advanced/advanced-urifu.html


Many thanks Olli, I’ll have a look!