axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Axiom-developer] Re: Axiom HyperDoc Replacement


From: Bill Page
Subject: RE: [Axiom-developer] Re: Axiom HyperDoc Replacement
Date: Sat, 21 Apr 2007 07:14:14 -0400

On April 21, 2007 4:03 AM Martin Rubey wrote:
> 
> Sorry, yet another question: How do I have to modify foo
> 
> (defun foo (s)
>   (let* ((get (read s nil 'eof))
>          (fn (and (eq get 'get) (read s nil 'eof))))
>     (format t "Got ~S~%~%" fn)
>     (format s "HTTP/1.1 ~S~%~%" (if fn 200 403))
>     (format t "HTTP/1.1 ~S~%~%" (if fn 200 403))
>     (format t "~S~%~%" (SPADCALL fn *docfun*))
>     (format s "~S~%~%" (SPADCALL fn *docfun*))
>     (close s)))
> 
> to make the browser render the html in fn. I.e., so far I 
> just displayed strings, which were obtained by applying
> *docfun* to fn.

You got SPADCALL to work for you - Cool! To bad you have
to write this in Lisp, I would really like to get this
working from SPAD.

> But now, (SPADCALL fn *docfun*) will actually result in
> a path like binomial-COMBF.html, and I want the browser
> to display that page.

What you need to do is to send an HTTP 'Content-type:'
header as the first two lines of what is sent to the
browser. By default the browser is just treating all
output as text. Try this:

 (defun foo (s)
   (let* ((get (read s nil 'eof))
          (fn (and (eq get 'get) (read-line s nil 'eof))))
     (format s "HTTP/1.1 ~S~%" (if fn 200 403))
     (format s "Content-type: text/html~%~%")
     (format s "<a href='~S'>click here</a>~%" (SPADCALL fn *docfun*))
     (close s)))

You will need to include the same header when sending HTML
data from a file.

(Warning: I haven't actually tested it yet.)

Google for more HTTP references like this one:

http://www.jmarshall.com/easy/http

There are also lot of references to HTML such as the link

 <a href='url'> link </a>

generated in the example above. 

HTTP is the low level protocol for sending and receiving
data from a web server. HTML is the mark-up language in which
the data content usually encoded for web browsers.

The (format t ... ) are just for debugging to send some
output to the console so you can see what is happening on
the server.

> ...

Regards,
Bill Page.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]