Re: URL with parameters in NetCGI
Pierre-Alexandre Voye <[email protected]> Fri, 7 Mar 2014 15:11:18 +0100
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <CANnJ5Gfb5WQXQRVf96LmggYMKhwMbKuNYhAastHvg_+9NQw-Rw@mail.gmail.com> |
--===============5794719137681387015== Content-Type: multipart/alternative; boundary=001a11c148360e146304f404d50d --001a11c148360e146304f404d50d Content-Type: text/plain; charset=UTF-8 Great ! So I can do that ! On second thought, I think it would be great to be able to define theses patterns in the conf file. Where could I patch this ? 2014-03-05 13:09 GMT+01:00 Gerd Stolpmann <[email protected]>: > Hi, > > accessing the path is already possible. For example, if you bind the cgi > to /service_name, and enter /service_name/some/path in the browser, you > get the "excess part" of the path in cgi#environment#cgi_path_info, i.e. > "/some/path". This should work for all cgi connectors in the same way > (this behavior is part of the CGI standard). You could then split the > path into components and process as you like. > > Does this help? > > Gerd > > Am Dienstag, den 04.03.2014, 16:18 +0100 schrieb Pierre-Alexandre Voye: > > HI, > > > > > > As far I understand my use of NetCGI, it only allow GET/POST/... URLs > > with parameters like : > > > > /service_name?param1=one¶m2=two > > > > > > > > > > It's now usual, according to REST philosophy, to write URLs as > > follow : > > > > GET /table_name/17 > > > > PUT /table_name/17 > > > > and of course more complex URLs as : > > > > PUT /publishers/1/magazines/2/photos/3 > > > > > > However there's ocaml's library to do that (aka > > https://github.com/rgrinberg/opium which user cohttp based on > > Lwt/Async), NetCGI is so powerful and multicore ready that I would > > prefer to use it. > > > > With opium you can format your URLs as follow : > > let print_person = get "/person/:name/:age" ... > > > > > > > > > > So, is there a way to do that with NetCGI ? Or, if I want to > > contribute by coding it, what, Gerd, would be the way you prefer to > > patch NetCGI ? > > > > > > > > Regards, > > > > > > Pierre-Alexandre > > > > > > > > > > > > -- > > --------------------- > > https://twitter.com/#!/ontologiae/ > > http://linuxfr.org/users/montaigne > > > > > ------------------------------------------------------------------------------ > > Subversion Kills Productivity. Get off Subversion & Make the Move to > Perforce. > > With Perforce, you get hassle-free workflows. Merge that actually works. > > Faster operations. Version large binaries. Built-in WAN optimization > and the > > freedom to use Git, Perforce or both. Make the move to Perforce. > > > http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk > > _______________________________________________ Ocamlnet-devel mailing > list [email protected] > https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel > > -- > ------------------------------------------------------------ > Gerd Stolpmann, Darmstadt, Germany [email protected] > My OCaml site: http://www.camlcity.org > Contact details: http://www.camlcity.org/contact.html > Company homepage: http://www.gerd-stolpmann.de > ------------------------------------------------------------ > > -- --------------------- https://twitter.com/#!/ontologiae/ http://linuxfr.org/users/montaigne --001a11c148360e146304f404d50d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div>Great ! So I can do that !<br></div>On second th= ought, I think it would be great to be able to define theses patterns in th= e conf file.<br></div>Where could I patch this ?<br></div><div class=3D"gma= il_extra"> <br><br><div class=3D"gmail_quote">2014-03-05 13:09 GMT+01:00 Gerd Stolpman= n <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D= "_blank">[email protected]</a>></span>:<br><blockquote class=3D"gma= il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef= t:1ex"> Hi,<br> <br> accessing the path is already possible. For example, if you bind the cgi<br= > to /service_name, and enter /service_name/some/path in the browser, you<br> get the "excess part" of the path in cgi#environment#cgi_path_inf= o, i.e.<br> "/some/path". This should work for all cgi connectors in the same= way<br> (this behavior is part of the CGI standard). You could then split the<br> path into components and process as you like.<br> <br> Does this help?<br> <br> Gerd<br> <br> Am Dienstag, den 04.03.2014, 16:18 +0100 schrieb Pierre-Alexandre Voye:<br> <div><div class=3D"h5">> HI,<br> ><br> ><br> > As far I understand my use of NetCGI, it only allow GET/POST/... URLs<= br> > with parameters like :<br> ><br> > /service_name?param1=3Done&param2=3Dtwo<br> ><br> ><br> ><br> ><br> > It's now usual, according to REST philosophy, to write URLs as<br> > follow :<br> ><br> > GET /table_name/17<br> ><br> > PUT /table_name/17<br> ><br> > and of course more complex URLs as :<br> ><br> > PUT /publishers/1/magazines/2/photos/3<br> ><br> ><br> > However there's ocaml's library to do that (aka<br> > <a href=3D"https://github.com/rgrinberg/opium" target=3D"_blank">https= ://github.com/rgrinberg/opium</a> which user cohttp based on<br> > Lwt/Async), NetCGI is so powerful and multicore ready that I would<br> > prefer to use it.<br> ><br> > With opium you can format your URLs as follow :<br> > let print_person =3D get "/person/:name/:age" ...<br> ><br> ><br> ><br> ><br> > So, is there a way to do that with NetCGI ? Or, if I want to<br> > contribute by coding it, what, Gerd, would be the way you prefer to<br= > > patch NetCGI ?<br> ><br> ><br> ><br> > Regards,<br> ><br> ><br> > Pierre-Alexandre<br> ><br> ><br> ><br> ><br> ><br> > --<br> > ---------------------<br> > <a href=3D"https://twitter.com/#!/ontologiae/" target=3D"_blank">https= ://twitter.com/#!/ontologiae/</a><br> > <a href=3D"http://linuxfr.org/users/montaigne" target=3D"_blank">http:= //linuxfr.org/users/montaigne</a><br> ><br> </div></div>> ----------------------------------------------------------= --------------------<br> > Subversion Kills Productivity. Get off Subversion & Make the Move = to Perforce.<br> > With Perforce, you get hassle-free workflows. Merge that actually work= s.<br> > Faster operations. Version large binaries. =C2=A0Built-in WAN optimiza= tion and the<br> > freedom to use Git, Perforce or both. Make the move to Perforce.<br> > <a href=3D"http://pubads.g.doubleclick.net/gampad/clk?id=3D122218951&a= mp;iu=3D/4140/ostg.clktrk" target=3D"_blank">http://pubads.g.doubleclick.ne= t/gampad/clk?id=3D122218951&iu=3D/4140/ostg.clktrk</a><br> > _______________________________________________ Ocamlnet-devel mailing= list <a href=3D"mailto:[email protected]">Ocamlnet-deve= [email protected]</a> <a href=3D"https://lists.sourceforge.net/lists/= listinfo/ocamlnet-devel" target=3D"_blank">https://lists.sourceforge.net/li= sts/listinfo/ocamlnet-devel</a><br> <span class=3D"HOEnZb"><font color=3D"#888888"><br> --<br> ------------------------------------------------------------<br> Gerd Stolpmann, Darmstadt, Germany =C2=A0 =C2=A0<a href=3D"mailto:gerd@gerd= -stolpmann.de">[email protected]</a><br> My OCaml site: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"http://www.caml= city.org" target=3D"_blank">http://www.camlcity.org</a><br> Contact details: =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"http://www.camlcity.= org/contact.html" target=3D"_blank">http://www.camlcity.org/contact.html</a= ><br> Company homepage: =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://www.gerd-stolpmann= .de" target=3D"_blank">http://www.gerd-stolpmann.de</a><br> ------------------------------------------------------------<br> <br> </font></span></blockquote></div><br><br clear=3D"all"><br>-- <br>---------= ------------<br><a href=3D"https://twitter.com/#%21/ontologiae/" target=3D"= _blank">https://twitter.com/#!/ontologiae/</a><br><a href=3D"http://linuxfr= .org/users/montaigne" target=3D"_blank">http://linuxfr.org/users/montaigne<= /a><br> </div> --001a11c148360e146304f404d50d-- --===============5794719137681387015== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk --===============5794719137681387015== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel --===============5794719137681387015==--