[plt-scheme] starting 2 servlets at the same time
You need to catch all URLs requests to use dispatch-rules like you
are. There are instructions for this on the serve/servlet page.
Roughly you want to add the #:servlet-regexp #rx"" keyword/value pair
to the call.
Jay
On Wed, Sep 23, 2009 at 4:08 PM, Vika Lapsar <vika.lapsar at gmail.com> wrote:
> I have done such servlet
>
> (define (start1 request)
> '(html
> (body "Servlet1")))
>
> (define (start2 request)
> '(html
> (body "Servlet2")))
>
> (define-values (servlet-dispatcher generator)
> (dispatch-rules
> [("") start1]
> [("servlet1" (string-arg)) start1]
> [("servlet2" (string-arg)) start2]
> [else start2]))
>
> (define (start req)
> (begin
> (display "request")
> (servlet-dispatcher req)))
>
> (serve/servlet start
> #:launch-browser? #t
> #:quit? #f
> #:listen-ip #f
> #:port 8000
> #:extra-files-paths
> (list (build-path my-path "htdocs"))
> #:servlet-path
> "/servlets/")
>
> So, when i start it I have seen "request" on REPL and response of start2.
> But when i try to type something different as URL in my browser I get
> "The file you were looking for was not found on this server." and no
> "request" entry on my REPL.
> Where I'm wrong?
>>
>>
>> 2009/9/23 Jay McCarthy <jay.mccarthy at gmail.com>
>>>
>>> No.
>>>
>>> Write one servlet and one serve/servlet call, but have that one
>>> servlet be implemented by your previous two servlets based on the url
>>> with dispatch-rules.
>>>
>>
>
>
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay
"The glory of God is Intelligence" - D&C 93