[plt-scheme] getting webserver URL arguments
If anyone could point me to an example of a plt servlet getting an arg
from the calling url (that is generated elsewhere - getting the
arguments from an http-get)
Stephen
On Apr 6, 2005 1:31 PM, Stephen DeGabrielle <spdegabrielle at gmail.com> wrote:
> Hi I added the line
> > (require (lib "servlet.ss" "web-server"))
> as suggested but I still get the errors:
> > Servlet exception: "reference to undefined identifier: extract-bindings"
> (at the command line- I start the server from a script- not the command line)
> In the browser I get;
> > The servlet terminated abnormally.
> > Please ask the author to fix the problem based on the details in the Web server's log file.
> Looking in the log file the relevant line is
> > (from "127.0.0.1" to "127.0.0.1" for "/servlets/hello.scm?name=22" at "Wednesday, April 6th, 2005 1:08:38pm")
>
> I call the servlet with http://localhost:81/servlets/hello.scm?name=22
>
> I started the web server at port 81 using the standard configuration
> that came with DrScheme.
> --code--
> (require (lib "web-server.ss" "web-server"))
> (require (lib "configuration.ss" "web-server"))
> (define webconfig (load-configuration "/Program
> Files/PLT/collects/web-server/configuration-table"))
> (define close-me (serve webconfig 81))
> --end code--
>
> I should note that I am using DrScheme v.209, where many on this list
> seem to be using the v299 (development) version.
> - I didn't think that would be a source of my problem - but I thought
> it might be worth a mention.
>
> Thanks for your kind help so far.
>
> Stephen De Gabrielle
>
> --code--
> (require (lib "unitsig.ss")
> (lib "servlet-sig.ss" "web-server"))
> (require (lib "servlet.ss" "web-server"))
>
> (unit/sig () (import servlet^)
>
> (define the-text "Hello, Web!")
>
> `(html (head (title ,the-text))
> (body ([bgcolor "white"])
> (p ,the-text)
> (p ,(extract-bindings (request-bindings initial-request) 'name))
> (p ,the-text)
> )))
> --end code--
>
> On Apr 6, 2005 2:02 AM, Jacob Matthews <jacobm[ at ]cs.uchicago.edu> wrote:
>
> > Ah -- you're not requiring the library that provides that procedure. If
> > you add
> >
> > (require (lib "servlet.ss" "web-server"))
> >
> > somewhere in the module it will work.
> >
> > -jacob
> >
> >
>
--
--
Stephen De Gabrielle
-- http://users.bigpond.com/spdegabrielle/automata