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)

#21956

After thinking a bit more about this “catch all” requirement I’m not really sure any more if something like this is currently possible with PrettyFaces.

I think PrettyFaces identifies the mapping for an URL only using the <pattern> of the mappings (including the optional custom regular expressions for path parameters within the pattern). The validation happens at a much later time of the request processing (especially after the request has been forwarded to the viewId). The validation can currently only be used to abort processing of the request and prevent the execution of the URL action method and the page rendering.

To be more specific, this is the order of execution:

1. Identify the mapping for the URL using the patterns

2. Forward the request to the viewId of the matching mapping

3. Enter the JSF lifecycle

4. Process the validators for the path parameters

5. Inject the values of the path parameters

6. Execute the page action

7. Render the page

You see that the validation happens AFTER the request has been forwarded to the viewId of the mapping. Therefore there is currently no way to use some other mapping in case of a validation error because the the request has already been forwarded.

Thoughts on this?

Christian