This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
generating HTTP (or MIME) headers without being a servlet
- From: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- To: kawa at sources dot redhat dot com
- Date: Fri, 17 May 2002 16:36:43 +0200
- Subject: generating HTTP (or MIME) headers without being a servlet
Hi,
I'm still trying to produce stand-alone MIME or HTTP headers, without being run as a servlet.
What Per recently documented helps - partially:
> In either case, the result of evaluating the top-level expressions
>becomes the HTTP response that the servlet sends back to the browser.
>The result is typically an HTML/XML element code object; Kawa will
>automatically format the result as appropriate for the type. The
>initial result values may be special "response header values", as
>created by the `response-header' function. Kawa will use the response
>header values to set various required and optional fields of the HTTP
>response.
I tried out a file brltest.brl:
[(begin (require 'http)
(response-header "foo" "bAr"))
]
<body>
[(define foo 123)]
Hi there [foo]
</body>
[(display "hello World!")]
D:\hoehle\Code>java -classpath h:/sspace/archive/kawa-1.6.98.jar kawa.repl -C br
ltest.brl
(compiling brltest.brl)
D:\hoehle\Code>java -classpath h:/sspace/archive/kawa-1.6.98.jar;. kawa.repl
#|kawa:1|# (load "brltest")
hello World!
#|kawa:2|# (define a ((make <brltest>)))
hello World!
#|kawa:13|# (require 'xml)
#|kawa:14|# (as-xml a)
<body>
Hi there
foo="bAr"
</body>
#|kawa:15|# a
<body>
Hi there
foo: bAr
</body>
It's interesting how I once get "foo=..." (attribute syntax), useful for HTML/XML,
and once " foo=...", which is almost right, except that I don't know where that leading space comes from. Something is still missing.
I believe the response-header etc. functions are useful even without a servlet. That's why I'm trying to make use of them.
It's unclear yet whether the response-header results must be "the initial result values", i.e. all come first, or whether response-header can be called anywhere amid body generation (implies complete buffering of output somewhere).
Maybe I should just use BRL for the body, and generate headers by hand altogether?
Regards,
Jorg Hohle.