[racket] Racket web servlets, doctype and planet libraries

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Oct 4 17:59:35 EDT 2010

On Sat, Oct 2, 2010 at 3:20 PM, Markku Rontu <markku.rontu at iki.fi> wrote:
> Hello everybody,
>
> I was trying to make some servlets recently and ran into two problems. First
> it was not clear in the documentation how the doctype should be declared for
> random servlets? I didn't want to make a html template based servlet to
> include the doctype. I'd rather create the main parts of the (x)html  pages
> with xexprs in Racket code. What do I need to do?

I would use make-xexpr-response

http://docs.racket-lang.org/web-server/http.html#(def._((lib._web-server/http/response-structs..rkt)._make-xexpr-response))

and maybe add the byte string doc-type you want to the result body.
Maybe I could add an option for a byte pre-amble to the body that
comes in the response. Would that be more useful?

Jay

>
> I did find in the Schematics cookbook the dherman/xhtml package that seems
> to do what I want but it doesn't seem to work in Racket. Perhaps the library
> isn't updated to Racket? The error I get after requiring it is:
> "C:\...AppData\Roaming\Racket\planet\300\5.0.1\cache\dherman\xhtml.plt\1\2\main.rkt"
> (The system cannot find the file specified.; errno=2)
>
> Correct report since the directory does not contain main.rkt but only
> info.ss and xhtml.ss.
>
> I think I got this same error with another lib earlier but skirted around
> the problem. So is this lib not up to date and if it's not what I can do to
> help get them ported?
>
> Thanks,
> -Markku
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.