This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about using the built-in web server


Hi Per,

Thanks for your help, as always.

> You could try:
>   kawa --http-auto-handler / . -e '(gnu.kawa.servlet.KawaHttpHandler:startServer 8888)' mycode.scm

This doesn't seem to work, as mycode.scm is still not executed, but putting

	(gnu.kawa.servlet.KawaHttpHandler:startServer 8888)

inside mycode.scm does work, or at least works to the extent that the
code in mycode.scm is run, and the server also responds to http
requests.

I did have one problem, however. I tried putting

	(gnu.kawa.servlet.KawaHttpHandler:addAutoHandler "/" ".")

in mycode.scm, before starting the server, rather than using the
--http-auto-handler command-line option. The server starts and is able
to handle requests. However, when I created a file test.scm,
containing

	#<p>Hello, <b>&(request-remote-host)</b>!</p>

and then loaded this file through the web browser, I get "unbound
location request-remote-host" on the server. I didn't have this
problem when using the http-auto-handler command-line option. I'm
assuming this has to do with which environment is accessible from
test.scm, and I suspect I may have similar problems when trying to
communicate between test.scm and mycode.scm.

> However, I'm guessing this may have threading issues.  You probably want to run
> the server in a separate thread.  Perhaps making use of HttpServer#setExecutor
> is needed, in which case we would need to make that calling from KawaHttpHandler.

I *think* I'm ok without this, as everything that I'm doing after
starting the webserver is in response to UI events, but I'll have to
do some testing to know for sure.

thanks,
Alex


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]