Web cells are stored on the server associated with the continuation tree. When you use 'dispatch-rules', you are relying only on the information in the URL to give context, so it is totally disconnected from the continuation tree.
When I first made Web cells, I wrote something that would insert their values into all URLs that were generated, so that if you made the URL "/foobar" then it would be transformed to "/foobar;cell1=value1" and then when it came back these pieces would be re-introduced to the Web cells of the new continuation root. The code has probably rotted: https://github.com/jeapostrophe/url-param But if this sounds useful, I'm willing to revive it for you. Jay On Tue, Nov 27, 2012 at 7:00 AM, Helmut Dobretzberger <[email protected]> wrote: > Hey, > > I'd like to have pretty urls in my web-application, but I ran into a problem > when using web-cells. > > I use a web-cell, and I shadow the content within the response/xexpr. > I link to a second function, which only shows the content of the web-cell. > If I generate this link using embed/url, everything is fine. > But if I use a pretty url, the content of the web-cell is lost. > > I understand the reason, I think - within the send/suspend/dispatch, the > continuation is saved, so the generated link restores the continuation, > including the web-cell content. > And that doesn't happen with pretty urls, right? > > But is there a way to use a pretty url, so that the content of the web-cell > is not lost? > > > A running, not really useful example, which demonstrates the problem: > > #lang racket > > (require web-server/servlet) > (require xml) > > (define my-cell (make-web-cell 0)) > > (define (start initial-request) > (send/suspend/dispatch > (lambda (embed/url) > (response/xexpr > `(html > ,(begin (web-cell-shadow my-cell 1) > (number->string (web-cell-ref my-cell))) > (br) > (a ([href "/foobar"]) "Foo") ;;pretty url > (br) > (a ([href ,(embed/url start2)]) "Start")))))) ;; generated url > > > (define (start2 request) > (response/xexpr > `(html ,(number->string (web-cell-ref my-cell))))) > ;; returns 0 if called via "foobar" and 1 if called with (embed/url > start2) > > (require web-server/servlet-env) > > (define-values (start-dispatch simple-app-url) > [dispatch-rules > [("") start] > [("foobar") start2]]) > > ;; Startet das Servlet. > (serve/servlet start-dispatch > #:port 8080 > #:listen-ip #f > #:launch-browser? #t > #:servlet-path "/" > #:servlet-regexp #rx"") > > > -- > Helmut > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users -- Jay McCarthy <[email protected]> Assistant Professor / Brigham Young University http://faculty.cs.byu.edu/~jay "The glory of God is Intelligence" - D&C 93 ____________________ Racket Users list: http://lists.racket-lang.org/users

