Re: http://domain.com/{username} Short URLs or catchall (Facebook-style)

Splash Forums PrettyFaces Users http://domain.com/{username} Short URLs or catchall (Facebook-style) Re: http://domain.com/{username} Short URLs or catchall (Facebook-style)

#21959

@lincoln:

Yeah, you are right. I forgot about that. That’s possible too. But I don’t think this helps for the usecase ceefour describes, doesn’t it?

@ceefour:

I have one other idea but I’m not sure if this can work. You could try to use a custom rewrite processor like this:

<rewrite match="/.*" processor="com.example.MyProcessor" redirect="chain"/>

And this Processor implementation:

public class MyProcessor implements Processor {

public String processInbound(HttpServletRequest request, HttpServletResponse response, RewriteRule rule, String url) {

// parse slug name from the URL
String slug = parseUrl(url);

// if it is a known people slug, forward to the correct view
if( isPeopleSlug(slug) ) {
return "/people/"+slug;
}

// no slug, just continue processing
else {
return url;
}

}

}

But as I said. That’s just an idea. I don’t know if it works. And you should definitively use 3.3.3-SNAPSHOT if you want to try this because we recently fixed some interaction issues between URL mappings and rewrite rules.