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&param2=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">&lt;<a href=3D"mailto:[email protected]" target=3D=
"_blank">[email protected]</a>&gt;</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 &quot;excess part&quot; of the path in cgi#environment#cgi_path_inf=
o, i.e.<br>
&quot;/some/path&quot;. 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">&gt; HI,<br>
&gt;<br>
&gt;<br>
&gt; As far I understand my use of NetCGI, it only allow GET/POST/... URLs<=
br>
&gt; with parameters like :<br>
&gt;<br>
&gt; /service_name?param1=3Done&amp;param2=3Dtwo<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; It&#39;s now usual, according to REST philosophy, to write URLs as<br>
&gt; follow :<br>
&gt;<br>
&gt; GET /table_name/17<br>
&gt;<br>
&gt; PUT /table_name/17<br>
&gt;<br>
&gt; and of course more complex URLs as :<br>
&gt;<br>
&gt; PUT /publishers/1/magazines/2/photos/3<br>
&gt;<br>
&gt;<br>
&gt; However there&#39;s ocaml&#39;s library to do that (aka<br>
&gt; <a href=3D"https://github.com/rgrinberg/opium" target=3D"_blank">https=
://github.com/rgrinberg/opium</a> which user cohttp based on<br>
&gt; Lwt/Async), NetCGI is so powerful and multicore ready that I would<br>
&gt; prefer to use it.<br>
&gt;<br>
&gt; With opium you can format your URLs as follow :<br>
&gt; let print_person =3D get &quot;/person/:name/:age&quot; ...<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; So, is there a way to do that with NetCGI ? Or, if I want to<br>
&gt; contribute by coding it, what, Gerd, would be the way you prefer to<br=
>
&gt; patch NetCGI ?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt;<br>
&gt; Pierre-Alexandre<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; ---------------------<br>
&gt; <a href=3D"https://twitter.com/#!/ontologiae/" target=3D"_blank">https=
://twitter.com/#!/ontologiae/</a><br>
&gt; <a href=3D"http://linuxfr.org/users/montaigne" target=3D"_blank">http:=
//linuxfr.org/users/montaigne</a><br>
&gt;<br>
</div></div>&gt; ----------------------------------------------------------=
--------------------<br>
&gt; Subversion Kills Productivity. Get off Subversion &amp; Make the Move =
to Perforce.<br>
&gt; With Perforce, you get hassle-free workflows. Merge that actually work=
s.<br>
&gt; Faster operations. Version large binaries. =C2=A0Built-in WAN optimiza=
tion and the<br>
&gt; freedom to use Git, Perforce or both. Make the move to Perforce.<br>
&gt; <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&amp;iu=3D/4140/ostg.clktrk</a><br>
&gt; _______________________________________________ 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==--