Apllying one URL mapping for all urls

Splash Forums PrettyFaces Users Apllying one URL mapping for all urls

This topic contains 2 replies, has 2 voices, and was last updated by  Anonymous 4 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19485

    Anonymous

    Hello,

    In order to rewrite an URL, we just need to remove ‘.jsf’ extension. SO instead of appending so many url-mappins in pretty-config, we thought that it could be possible to use only one url-mapping that does the whole thing.

    Here is the basic mapping:

    <url-mapping id=”contact”>

    <pattern value=”/company/contact” />

    <view-id value=”/company/contact.jsf” />

    </url-mapping>

    We need to apply the same thing to all other urls so that /company/something.jsf becomes /company/something.

    Thought about a REGEX & a parameter name but couldn’t figure how to.

    COuld please guide us.

    Thanks

    #23398

    Unfortunately this is currently not possible with PrettyFaces. The recommended way is to create one mapping for each mapping.

    If you really want to simplify the configuration, you could have a look at Rewrite, which is the successor of PrettyFaces.

    Rewrite

    You can have a look at the example to get an idea how Rewrite works:

    Rewrite Examples

    You could implement your usecase with something like:

    .addRule( Join.path("/company/{p}").to("/company/{p}.jsf").where("p").matches("[a-z]+") )

    #23399

    Anonymous

    Thanks Christian,

    That’s the information we needed to know.

    Regards

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Comments are closed.