-
1. Re: Wildcard URLs in pages.xml?
lvdberg Oct 18, 2010 5:11 PM (in response to danielrowe)Hi,
maybe the Resteasy components can be helpful for you if it is your objective to just execute a single GET with a meaningful URL, which should return a specfic result.It works great althoufgh it is not really meant to return html-pages, but more to create
simple
webservices. Another posibility would be to use natural conversations. It's not exactly what you describe, but it gives arecognizable
URL.Leo
-
2. Re: Wildcard URLs in pages.xml?
danielrowe Oct 18, 2010 11:32 PM (in response to danielrowe)Thanks, Leo. That was enough to get me looking into URL rewriting, which I think will handle the issue. I'll try that out tomorrow...
-
3. Re: Wildcard URLs in pages.xml?
danielrowe Oct 19, 2010 2:11 PM (in response to danielrowe)Yes, urlrewrite is what I needed.
pages.xml:
<page view-id="/town.xhtml" action="#{TownManager.initTownInfo}">
</page>
urlrewrite.xml:
<urlrewrite>
<rule>
<from>^/town/(.*)</from>
<to>/town.seam?townname=$1</to>
</rule>
</urlrewrite> -
4. Re: Wildcard URLs in pages.xml?
cbensemann Oct 19, 2010 5:11 PM (in response to danielrowe)Did you know you can also specify your rewrite rules in your pages.xml?
<page view-id="/pages/person/viewPerson.xhtml" login-required="true"> <description>View a person</description> <begin-conversation join="true"/> <param name="personId" value="#{viewPersonController.personId}"/> <rewrite pattern="/pages/person/viewPerson-{cid}/{personId}"/> <rewrite pattern="/pages/person/viewPerson/{personId}"/> <rewrite pattern="/pages/person/viewPerson"/> </page>
So in this example the url /pages/person/viewPerson.seam will be rewritten as one of the three rules specified (they are evaluated top to bottom and the first matching rule is used.)
/pages/person/viewPerson-1/123 This is an example of the first rule where 1 is the conversation id parameter and 123 is the personId parameter.
/pages/person/viewPerson/123 When there is no conversation id (second rule)
/pages/person/viewPerson When there is no conversation id or personId (third rule)