Adapt to recent changes in surflet-handler
This commit is contained in:
parent
3f3bf045de
commit
1f10457d52
|
@ -4,7 +4,8 @@
|
||||||
parse-html-forms ; PARSE-HTML-FORM-QUERY
|
parse-html-forms ; PARSE-HTML-FORM-QUERY
|
||||||
url ; HTTP-URL-SEARCH
|
url ; HTTP-URL-SEARCH
|
||||||
srfi-1 ; FILTER
|
srfi-1 ; FILTER
|
||||||
surflet-handler/surflet ; SEND/SUSPEND, SEND/FINISH
|
surflet-handler/surflets ; SEND/SUSPEND, SEND/FINISH
|
||||||
|
surflet-handler/responses ; MAKE-SURFLET-RESPONSE
|
||||||
scheme-with-scsh)
|
scheme-with-scsh)
|
||||||
(begin
|
(begin
|
||||||
|
|
||||||
|
@ -22,15 +23,11 @@
|
||||||
|
|
||||||
(define (make-get-number-page input-text title)
|
(define (make-get-number-page input-text title)
|
||||||
(lambda (new-url)
|
(lambda (new-url)
|
||||||
(make-response
|
(make-surflet-response
|
||||||
(status-code ok)
|
(status-code ok)
|
||||||
#f
|
|
||||||
(time)
|
|
||||||
"text/html"
|
"text/html"
|
||||||
'()
|
'()
|
||||||
(make-writer-body
|
(format #f "
|
||||||
(lambda (out options)
|
|
||||||
(format out "
|
|
||||||
<HTML>~a
|
<HTML>~a
|
||||||
<BODY>~a
|
<BODY>~a
|
||||||
<P>
|
<P>
|
||||||
|
@ -54,19 +51,14 @@
|
||||||
(format #f "<H2>~a</H2>" title))
|
(format #f "<H2>~a</H2>" title))
|
||||||
new-url
|
new-url
|
||||||
input-text
|
input-text
|
||||||
))
|
|
||||||
))))
|
))))
|
||||||
|
|
||||||
(define (make-result-page new-url)
|
(define (make-result-page new-url)
|
||||||
(make-response
|
(make-surflet-response
|
||||||
(status-code ok)
|
(status-code ok)
|
||||||
#f
|
|
||||||
(time)
|
|
||||||
"text/html"
|
"text/html"
|
||||||
'()
|
'()
|
||||||
(make-writer-body
|
(format #f "
|
||||||
(lambda (out options)
|
|
||||||
(format out "
|
|
||||||
<HTML>
|
<HTML>
|
||||||
<TITLE>Result</TITLE>
|
<TITLE>Result</TITLE>
|
||||||
<BODY>
|
<BODY>
|
||||||
|
@ -82,7 +74,6 @@
|
||||||
</HTML>"
|
</HTML>"
|
||||||
(number->string (+ (get-number1) (get-number2)))
|
(number->string (+ (get-number1) (get-number2)))
|
||||||
new-url)))
|
new-url)))
|
||||||
))
|
|
||||||
|
|
||||||
(define (get-number input-text . maybe-title)
|
(define (get-number input-text . maybe-title)
|
||||||
(let* ((title (if (pair? maybe-title) (car maybe-title) #f))
|
(let* ((title (if (pair? maybe-title) (car maybe-title) #f))
|
||||||
|
@ -105,9 +96,7 @@
|
||||||
(send/suspend make-result-page)
|
(send/suspend make-result-page)
|
||||||
;; This finishes the session and does a redirect to the root
|
;; This finishes the session and does a redirect to the root
|
||||||
;; page.
|
;; page.
|
||||||
(send/finish
|
(send-error (status-code moved-temp) #f "/" "/"))
|
||||||
(make-error-response (status-code moved-temp) req
|
|
||||||
"/" "/")))
|
|
||||||
|
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue