[racket] WebServer memory and custom expiration page
Thank you.
Trying out:
(require web-server/servlet-env)
(serve/servlet start
#:launch-browser? #t
#:quit? #t
#:listen-ip #f
#:port 8081
#:log-file "log"
#:manager
(make-threshold-LRU-manager
(lambda (request)
(response/xexpr
`(html (head (title "Page has Expired."))
(body (p "Sorry, this page expired."
(a ((href "/xapps/"))
"Please go back."))))))
(* 1280 1024 1024))
#:extra-files-paths
(list (build-path (current-directory) "static"))
#:servlet-path "/xapps/")
Hope that slows down the expiration to a reasonable range.
On Thu, Apr 26, 2012 at 12:04 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> On Wed, Apr 25, 2012 at 3:58 PM, J G Cho <gcho at fundingmatters.com> wrote:
>> A couple of minor question about page expiring too fast.
>>
>> How does one assign more memory to WebServer (with State)? (I am
>> guessing this delays expiration. Please correct me if I am wrong.) I
>> read something about Continuation Managers but not clear how to create
>> one and how to use it with serve/servlet.
>
> Use the #:manager keyword to serve/servlet and pass it a different
> number than (* 128 1024 1024) to make-threshold-LRU-manager.
>
>> Also, when the page does expire, I'd like to provide a link to a place
>> where user can go back (instead of keep pressing back buttons many
>> times.) Do I edit some page under collects or pass a lambda to
>> serve/servlet (as in the recent thread about statless/stuffer)?
>
> A missing continuation is handled by the #:servlet-loading-responder
> keyword function.
>
> Jay
>
> --
> Jay McCarthy <jay at cs.byu.edu>
> Assistant Professor / Brigham Young University
> http://faculty.cs.byu.edu/~jay
>
> "The glory of God is Intelligence" - D&C 93