Re: html support

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 08/14/2013 11:21 PM, Josef Frydl wrote:
>  eval_fragment(Request) :-
>         http_redirect(moved, '/',Request),

http_redirect/2 is implemented by means of throw/1 and thus won't come
back.  Anything
you call afterwards is not processed.  The tracer will tell you.  Hint:

	?- tpsy(eval_fragment/1).

>         http_read_data(Request, Data, []),

I'd use http_parameters/2 here.  http_read_data only reads POST request
data and
you do a GET, so this won't work.

>         portray_clause(Data),

Neither will printing.  Anything you print goes to the browser.  If you
want to print messages for debugging, use debug/3.

> 		byl_jsem,

Don't know what this does

> 		nb_getval(counter, C), CNew is C + 1, nb_setval(counter, CNew).

This won't fly too.  global variables are thread-specific and you have
no control
over which thread will handle the request.  If you want state, use the
http_session
library, which establishes as session with the browser and provides
predicates to
associate data with the predicates.

Please work through the tutorials to get the basics:

	http://www.pathwayslms.com/swipltuts/html/index.html
	http://www.swi-prolog.org/howto/http/

	Cheers --- Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.