Servlet mapping woes


I’m having some trouble with my web.xml servlet mappings. Everything is fine if I use:



But if I change the first one to:


Then I get a “Communication problem” error message on my browser. Checking with a debugger shows that the my UriHandler is invoked properly and my UI component construction code executes. Nothing is different besides the url-pattern.

What I’m trying to do is create bookmarks to certain points in my application. Bookmarks that can be emailed/etc. to users so they will be guided directly to the correct functionality by the UriHandler. After all, even though we have a RIA framework, our users will still have browsers and type/click on links to enter the application.

Other post
talking about the same with some examples of how to fix or may have some ideas.

Thanks for the link. Now I know I can’t map the Vaadin servlet url as flexibly as an ordinary page. Normally this won’t be an issue as Vaadin operates on a single page anyway.

It would help if I could find a real web app somewhere that was built with Vaadin. I’ve only found Motonet and it circumvents the bookmark / url mapping situation by embedding Vaadin inside traditional pages. I was hoping we can do things the other way around in our project: use Vaadin for overall management and embed html/jsp when necessary. As an example a fancy company contact information page made by a graphics designer years ago should be maintained as an embedded jsp page.

But trying to provide back/forward/bookmark functionality with Vaadin seems to be very difficult. I don’t want to face the customer like this:

Customer: “So let’s have a look at the UI. Looks pretty good… Hey! As a new feature I want to be able to send an email to all the users who haven’t paid for their subscription yet. Just a basic message and a link to the payment page”

Me: “Sure, the link just isn’t possible”

Customer: “What do you mean? I’ve done this work for a decade. Here, I’ll show you, I just go to the payment section and copy&paste the URL…”

Me: “That’s just the main page URL, it won’t work”

Customer: “Why?”

Me: “We have this new framework that is application-centric, not page-centric”

Customer: “But then I can’t use this like I use every other web-app. And what about my 40 000 end users? This is a browser application, isn’t it? And the common features with browsers are back, forward, refresh and bookmark functions, right? My end users are quite accustomed to those and like them. I don’t care about technical details, I want usability!”

If there aren’t easy solutions to the problem, I’ll have to see if we can live without bookmarks. An “items requiring action” VerticalLayout on top of the main view might do the trick…

You can look at our main demo application, Sampler, for reference how to do proper bookmark / deep linking functionality within a Vaadin app.

Here’s an actual link that takes you straight to the Form example within Sampler:

Completely doable, and works across all browsers we support.


it is pretty easy to made a multi-page web application with Vaadin. You don’t have to tweak your web.xml settings for this, just follow any of two ways described in the link above or in Jouni’s last reply. Previous/Next/Bookmarking features will work fine then.


Thanks for the responses. It’s good to know you believe there’s a chance to get the bookmarks to work easily. I guess I should be using the ActiveLink components found in the demo application to “browse” around my application? Using normal Buttons to move around won’t be possible since they won’t change the browser url. Fortunately making an ActiveButton, etc. should be fairly straightforward.

I still have one problem, though. I haven’t been able to understand how the url, especially the anchor part is passed to the server in the demo application. I’ve tried using a UriHandler like this:

    public DownloadStream handleURI(URL context, String relativeUri) {
        System.err.println("context: "+context);
        System.err.println("ref: "+context.getRef());
        System.err.println("query: "+context.getQuery());
        System.err.println("relativeUri: " + relativeUri);
       // Redirection code here
        return null;

But for a URL
my output is:

context: http://localhost:8080/myapp/mypages/
ref: null
query: null

The output is the same for

So can you tell me how the anchor part can be read? I thought the getRef() should return it. I’ve had no luck trying to decipher this part from the demo application. My web xml mapping is:


Actually, the ActiveLink component is not necessary to enable bookmarking/deep-linking. All you should need is the
that’s contained in the default JAR.

Although it says it’s an experimental feature, I think it’s safe to say it has been properly tested with Sampler :slight_smile:

The ActiveLink component, on the other hand, provides addiotional features to the regular Link component, making it possible to track and react to link events. You can then do stuff like Google Analytics tracking. Pressing a link always send an event to the server as well, unlike with the regular Link component.

Very nice! The UriFagmentUtility is working well. And it’s a relief I can use ordinary components along with it. :grin:

Time to get busy with creating links…

…and by the way, I’m really impressed by a side-effect of Vaadin: Using the application seems a lot faster than with traditional JSP. Not having to reload pages all the time is really making a difference. As a simple comparison a common use-case is to have a list of items. Click one and you see the details. With JSP going to details generally means a new page request with the id of selected item as a parameter. Then you get a new reload if you go back to the list. With Vaadin this functionality is so much more user friendly. Just display the extra data next to / under your table. No need for reloads and the list is still visible.