<br><div class="gmail_quote">On Thu, Aug 6, 2009 at 9:02 PM, Jay McCarthy <span dir="ltr">&lt;<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If you call next-dispatcher, the &quot;current&quot; request will be delivered<br>
to the next dispatcher (such as the static file handler.) If you want<br>
a different one, you could create your own dispatcher with a similar<br>
for that uses a different request (maybe I should do that...?) Another<br>
option is to return a redirect response.</blockquote><div><br>It seems that I am not understanding dispatcher well enough to use it - can (next-dispatcher) be called from within a servlet?  I am getting the following error:<br>
<br><div style="margin-left: 40px;">(file &quot;C:\\Local\\PLT4.1.3\\collects\\web-server\\dispatchers\\dispatch-servlets.ss&quot;) broke the contract   (-&gt; url? exn? response?) on servlet-error-responder; expected &lt;exn?&gt;, given: #&lt;exn:dispatcher&gt;<br>
</div> <br>What I did was basically test to see if this is a path I wanted to handle, and throw exn:dispatcher... is there another way of using it?<br><br><div style="margin-left: 40px;">(define (start request)<br>  (let ((path-list (map path/param-path (url-path (request-uri request)))))<br>
    (cond ((equal? path-list &#39;(&quot;test&quot;))<br>           `(p &quot;this is a test resopnse&quot;))<br>          (else ;; let web-server handle the path.<br>           (next-dispatcher)))))<br></div><br>The servlet is run through serve/servlet.<br>
<br>;; web.ss<br>#lang scheme/base<br><br>(require web-server/servlet<br>         web-server/servlet-env<br>         &quot;servlet1.ss&quot;<br>         )<br>;; why did the current-directory get reset?<br>(thread (lambda ()<br>
          (serve/servlet start #:port 8800<br>                         #:servlet-path &quot;/&quot;<br>                         #:launch-browser? #f<br>                         #:listen-ip #f<br>                         #:servlet-namespace &#39;( &quot;servlet1.ss&quot;)<br>
                         #:servlets-root (current-directory)<br>                         #:servlet-regexp #px&quot;.*&quot;<br>                         #:server-root-path (current-directory)<br>                         #:extra-files-paths (map string-&gt;path &#39;(&quot;c:\\data\\ajax&quot;))<br>
                         )))<br><br>;; servlet1.ss<br>#lang scheme/base<br>(require (only-in web-server/servlet current-servlet-continuation-expiration-handler)<br>         web-server/managers/lru<br>         web-server/http/request-structs<br>
         web-server/dispatchers/dispatch<br>         net/url<br>         )<br><br>(define interface-version &#39;v2)<br><br>(define manager<br>  (create-LRU-manager current-servlet-continuation-expiration-handler<br>                      60<br>
                      3600<br>                      (lambda () #t)<br>                      #:initial-count 1 <br>                      #:inform-p (lambda _ (void))))<br><br>(define (start request)<br>  (let ((path-list (map path/param-path (url-path (request-uri request)))))<br>
    (cond ((equal? path-list &#39;(&quot;test&quot;))<br>           `(p &quot;this is a test resopnse&quot;))<br>          (else <br>           (next-dispatcher)))))<br><br>(provide (all-defined-out))<br><br><br><br><br></div>
</div>