[plt-scheme] Using web-server/servlet-env to host a root level servlet
There is not an easy way to do this. Here's a hacky way:
1) Remove the filter:make around (let-values in servlet-env
2) Change (build-path servlets-root servlet-path) to (build-path servlets-root)
3) Pass "" as #:servlet-path
Another way is to make a custom dispatcher that rewrites the URLs that
come in to contain the ".ss" file. For example:
(define (rewrite regex inner-dispatcher)
(lambda (conn req)
(inner-dispatcher conn (make-request ... (string->url
(regexp-replace (url->string (request-url req)) regex)) ...))))
and make that the top-level dispatcher (perhaps using
web-server/run.ss as a base)
Jay
On Tue, Sep 16, 2008 at 6:59 PM, Rob Hunter <rob.hunter at gmail.com> wrote:
> Hi,
>
> I'm trying out the web server code described here
> (http://docs.plt-scheme.org/web-server/servlet-env_ss.html), but I
> can't figure out how to make my servlet hosted at the root level. For
> example, the program
>
> (require web-server/servlet-env)
>
> (serve/servlet
> (lambda (req) "hiya")
> #:servlet-path (string->path "foo.ss"))
>
> gives my a page at http://localhost:8000/foo.ss, but changing the path
> to "" or "." doesn't work. Any suggestions?
>
> Thanks,
> Rob
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://jay.teammccarthy.org
"The glory of God is Intelligence" - D&C 93