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