Re: Can Pretty Faces/Rewrite help me?

Splash Forums PrettyFaces Users Can Pretty Faces/Rewrite help me? Re: Can Pretty Faces/Rewrite help me?


Thanks for your reply.

I now understand why you are using request attributes. It’s just to keep the migration from Tiles simple, right? I’m don’t know Tiles very good, so this was confusing for me. :)

I think using PrettyFaces/Rewrite should work fine to virtualise the URLs. This way you could for example make the role of the user a part of the URL (like /administrator/users and /supervisor/users) and convert it into a query parameter or something else. PrettyFaces 3.x would be fine to inject the variable part of the URL into a request scoped bean or a query parameter. If you want to go with request attributes, Rewrite could surely do this.

I think in your case it definitely could make sense to use annotation based configuration to simplify the creation of a large number of rules. However, Rewrite is very modular. You could also build your own way of configuration. You could for example even build an extension of Rewrite that is able to read some custom data format for your rule definitions (perhaps some simplified XML syntax for your usecase). Or you could even parse your old Tiles configuration and build the corresponding rules from this. But as I said, I’m not a Tiles expert. This was just a thought. I just want to emphasize that extending Rewrite is very very simple. Feel free to post on the forums if you need some help on the API. Perhaps looking at the current code of PrettyFaces 4.0 gives a nice introduction into how simple it is to build custom annotations to configure Rewrite.

Unfortunately I have to note that Rewrite currently doesn’t have much documentation. This is caused mainly by the fact that the framework is still under heavy development. But the API is getting very very stable and we don’t assume that there are any more major changes to it. And I think that you will get answers to your questions very quickly if you post to the forums. :)