Site URLs

Based on my reading so far, I am wondering whether or not the vaadin can take various URLs as conventional web sites. An e-commerce site, for example, I would like to let product page be directly access by a URL in a RESTful style such as Can this be done with vaadin?

Yes, it is possible to “deep-link” using either
. From these I would first choose try the URIHandler.

There are several options how to handle deep linking within Vaadin apps, but I’d say the most used and effective is to use the URIFragmentUtility, that’s used in
the Sampler
for example (see the string after the # mark in the addressbar).

Can the # mark be replaced by backward slash? RESTful URLs don’t use the # mark as a separator.

Can the # mark be replaced by a backward slash? RESTful URLs don’t use the # mark as a separator.

Isn’t the principal the important thing and not if you use # and & or / as the separator? :wink:

Anyhow, to answer your question, you can’t use / inside an application if I recall correctly. You could maybe define an different entry point to your application in the web.xml under /something or even deploy a totally different application under that path, but I can’t come up with a way to just route the parameters this way. Maybe someone else is able to.

I think here is a fundamental problem as well. As far as I see it, RESTful applications should be stateless, and hence only respond accordingly to URI passed over to it. Vaadin is by nature stateful and it needs a bit of rigging to transform it to a page like architecture.

Hmm… I just checked out the upcoming Directory (teaser on front page) and it seems to use an RESTful approach. The only difference to the standard REST approach was that the first / was replaced with a #. So instead of you would have I would guess that this is done by passing all the paratemeters as one (#view/id/5) to the URIHandler, which in turn splits it to pieces and takes corresponding actions.

Close enough?

If you really want URLs like app/foo you probably could overwrite Application.getWindow(String). That way you can create new Windows on demand. IMHO this is a bit heavyweight solution, and I’d recommed to use the URIFragmentUtility.