Nice URLs

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Nice URLs

Henrik Pettersen
All,

I would like to implement nicer URLs, that are easily bookmarkable,
for pages that requires POSTs to render.

E.g. if I have this URL:
http://myserver/myapplication/user/1234

I want the application to:
1. Get the user record with id 1234
2. Render the user page, with the data from the retrieved record

More on URL design:
http://www.pixelcharmer.com/fieldnotes/archives/process_designing/2003/000285.html

I think this has to be implemented in the pageflow controller, with
some nifty regular expressions and URL rewriting, but not sure where
to start.

Has anyone attempted this before? Any sample code to share?

Also, as a 'feature request', it would be very convenient if Orbeon
Forms had some syntactic shortcuts (or templates) for this :-)

Thanks!

Sincerely,
Henrik Pettersen
http://www.acl.icnet.uk/lab/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Nice URLs

Ryan Puddephatt
Henrik,
        <page id="ops-test-page" path-info="/ops-test/([^\/]+)/([^\/]+)"
                matcher="oxf:perl5-matcher"
                view="/pages/ops-test/${2}.${1}"/>

This URL is similar to what you need, it matches anything with
/ops-test/blah/blah. It then looks in the directory oxf:/pages/ops-test for
a file with a name of the second param and extension of the first param.
Obviously this could be a static file that processes all calls

You can use <setvalue ref="" matcher="1"/> to store the values in an
instance which can be provided by default-submission attribute

Something like

        <page id="ops-test-page" path-info="/some-url/([^\/]+)/([^\/]+)"
                matcher="oxf:perl5-matcher"
                default-submission="oxf:/user-instance.xml"
                view="/pages/load-user-data.xpl">
                <setvalue ref="/instance/user" matcher="1"/>
                <setvalye ref="/instance/id" matcher="2"/>
        </page>

With your default instance being something along the lines of

<instance>
  <user/>
  <id/>
</instance>

Hope this helps

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: Henrik Pettersen [mailto:[hidden email]]
>Sent: 19 January 2007 00:08
>To: [hidden email]
>Subject: [ops-users] Nice URLs
>
>All,
>
>I would like to implement nicer URLs, that are easily
>bookmarkable, for pages that requires POSTs to render.
>
>E.g. if I have this URL:
>http://myserver/myapplication/user/1234
>
>I want the application to:
>1. Get the user record with id 1234
>2. Render the user page, with the data from the retrieved record
>
>More on URL design:
>http://www.pixelcharmer.com/fieldnotes/archives/process_designi
>ng/2003/000285.html
>
>I think this has to be implemented in the pageflow controller,
>with some nifty regular expressions and URL rewriting, but not
>sure where to start.
>
>Has anyone attempted this before? Any sample code to share?
>
>Also, as a 'feature request', it would be very convenient if
>Orbeon Forms had some syntactic shortcuts (or templates) for this :-)
>
>Thanks!
>
>Sincerely,
>Henrik Pettersen
>http://www.acl.icnet.uk/lab/
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Nice URLs

Henrik Pettersen
Ryan,

Fantastic! This is one for the FAQ, I think....

I'll let you know how I get on.

Thanks!

Henrik

On 1/19/07, Ryan Puddephatt <[hidden email]> wrote:

> Henrik,
>         <page id="ops-test-page" path-info="/ops-test/([^\/]+)/([^\/]+)"
>                 matcher="oxf:perl5-matcher"
>                 view="/pages/ops-test/${2}.${1}"/>
>
> This URL is similar to what you need, it matches anything with
> /ops-test/blah/blah. It then looks in the directory oxf:/pages/ops-test for
> a file with a name of the second param and extension of the first param.
> Obviously this could be a static file that processes all calls
>
> You can use <setvalue ref="" matcher="1"/> to store the values in an
> instance which can be provided by default-submission attribute
>
> Something like
>
>         <page id="ops-test-page" path-info="/some-url/([^\/]+)/([^\/]+)"
>                 matcher="oxf:perl5-matcher"
>                 default-submission="oxf:/user-instance.xml"
>                 view="/pages/load-user-data.xpl">
>                 <setvalue ref="/instance/user" matcher="1"/>
>                 <setvalye ref="/instance/id" matcher="2"/>
>         </page>
>
> With your default instance being something along the lines of
>
> <instance>
>   <user/>
>   <id/>
> </instance>
>
> Hope this helps
>
> Ryan Puddephatt
> Software Engineer
>
> Teleflex Group - IT UK
> 1 Michaelson Square
> Livingston
> West Lothian
> Scotland
> EH54 7DP
>
> e> [hidden email]
> t> +44(0)1506 407 110
> f> +44(0)1506 407 108
>
>
>
> >-----Original Message-----
> >From: Henrik Pettersen [mailto:[hidden email]]
> >Sent: 19 January 2007 00:08
> >To: [hidden email]
> >Subject: [ops-users] Nice URLs
> >
> >All,
> >
> >I would like to implement nicer URLs, that are easily
> >bookmarkable, for pages that requires POSTs to render.
> >
> >E.g. if I have this URL:
> >http://myserver/myapplication/user/1234
> >
> >I want the application to:
> >1. Get the user record with id 1234
> >2. Render the user page, with the data from the retrieved record
> >
> >More on URL design:
> >http://www.pixelcharmer.com/fieldnotes/archives/process_designi
> >ng/2003/000285.html
> >
> >I think this has to be implemented in the pageflow controller,
> >with some nifty regular expressions and URL rewriting, but not
> >sure where to start.
> >
> >Has anyone attempted this before? Any sample code to share?
> >
> >Also, as a 'feature request', it would be very convenient if
> >Orbeon Forms had some syntactic shortcuts (or templates) for this :-)
> >
> >Thanks!
> >
> >Sincerely,
> >Henrik Pettersen
> >http://www.acl.icnet.uk/lab/
> >
> >
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws