>-----Message d'origine----- >De : Beginner [mailto:[EMAIL PROTECTED] >Envoyé : mardi, 27. novembre 2007 18:49 >À : [email protected] >Objet : REST > >Hi, > >I hope this isn't a dumb question. > >I want to try and create a small REST style installation and was >considering how to overcome the problem of urls in the form > >http://www.myfactory.com/parts/1234 > >The resource after /parts could in theory be any number but you would >not want to have a <Location> for each part that existed. Rather >you'd want the handler responsible for /parts to check your db and >return either content or 400. > >On the face of it this is the sort of thing mod_perl should excel at. >Does it? Can you intercept requests like this one above? Which API >methods should I be looking at? > >TIA, >Dp.
This is the sort of things that Catalyst would excel at, especially if you have several nesting levels (i.e. parts/1234/subpart/567/form). See Catalyst doc at http://search.cpan.org/~jrockway/Catalyst-Manual-5.701003/lib/Catalyst/Manual/Intro.pod. But if you don't need that complexity, you can easily do it in mod_perl : configure Apache with something like <LocationMatch "/parts/\d+$"> SetHandler modperl PerlResponseHandler My::Parts::Handler </LocationMatch> and then have your module My::Parts::Handler parse the URL and get to the part number. Good luck, L. Dami
