Filtering URL with vaadin

Hello!

In my web.xml, I have two application servlets, one mapping to /* and another to /edit/* !

However, everything goes through servlet mapped by /. Ok! /edit/ matches /* that makes sense…

But how can I overcome this?

I have already tried to implement a filter class on the url-pattern /* so that I could redirect according to the url itself

But when I get the requested url inside my filter class, I got names like UIDL… and so I can’t evaluate which is the url the user has typed.

Any idea would be appreciated…

PS:. I really need this kind of mapping:
/* → servlet 1
/edit/* → servlet2

Regards

Carlos

Sorry, I just realized my problem is a bit different… (nothing like a sleeping night)

The point is not that /edit/* is being redirect to the same url-pattern as /* but there is a security-constraint tag that redirects /edit/* to /Login.jsp which matches to /* then…

Ideas about how to solve this are still wellcome :slight_smile:

Carlos

FYI

I did manage to solve this using UrlRewriteFilter third library… now it’s working :slight_smile:

Sounds like the root problem is that a call to /Login.jsp matches your /* pattern, right? Simple solution: add a servlet and mapping for that JSP file. E.g.

    <servlet>
        <servlet-name>Login</servlet-name>
        <jsp-file>/Login.jsp</jsp-file>
    </servlet>

and

    <servlet-mapping>
        <servlet-name>Login</servlet-name>
        <url-pattern>/Login.jsp</url-pattern>
    </servlet-mapping>

I’ve done a bunch of this kind of thing recently. I promise I’ll write a blog about it and share here “real soon.” What’s cool about the above is that you can actually use it with “hidden” JSP files, for instance ones under WEB-INF/jsps that a servlet forwards to. What’s not cool is that X JSPs need X declarations and X mappings (as far as I can tell).

Cheers,
Bobby