Help in using image files in http server
Josef Fydl <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
I can not figure out, what I do wrong
my prolog:
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 6.6.1)
Copyright (c) 1990-2013 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
my program:
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_error)).
:- use_module(library(http/html_write)).
:- use_module(library(http/http_path)).
:- use_module(library(http/http_files)).
:- multifile http:location/3.
:- dynamic http:location/3.
:- multifile user:file_search_path/2.
:- dynamic user:file_search_path/2.
file_search_path('images', '/Users/joseffrydl/Desktop/proKatu/praveTed/images').
:- http_handler('/', display_main_page, []).
:- http_handler(images(.), serve_files_in_directory('images'),
[prefix, priority(-100)]).
port(8881).
start :-
port(Port),server(Port).
stop :-
port(Port),
http_stop_server(Port, []).
server(Port) :-
http_server(http_dispatch, [port(Port)]).
display_main_page(_Request) :- phrase(intro,TokenizedHtml,[]),
format('Content-type: text/html~n~n'),
print_html(TokenizedHtml).
intro -->
html([p(ol([li('select a path'),
li('this is test')
])),
\sep,
img(src='images/empilotmainlogo.png'), 'png after'
]).
my result:
http_alias `images' does not exist
In:
[23] throw(error(...,_G263))
[20] http_path:expand_location(images('.'),/,_G280,[]) at /opt/local/lib/swipl-6.6.1/library/http/http_path.pl:191
[19] http_path:absolute_location(images('.'),/,_G300,[]) at /opt/local/lib/swipl-6.6.1/library/http/http_path.pl:177
[18] http_path:http_absolute_location(images('.'),_G319,[]) at /opt/local/lib/swipl-6.6.1/library/http/http_path.pl:170
[17] http_dispatch:prefix_handler(_G337,user: ...,[...]) at /opt/local/lib/swipl-6.6.1/library/http/http_dispatch.pl:816
[16] '$bags':findall_loop(_G360,http_dispatch: ...,_G362,[]) at /opt/local/lib/swipl-6.6.1/boot/bags.pl:78
[15] setup_call_catcher_cleanup('$bags':'$new_findall_bag','$bags': ...,_G380,'$bags':'$destroy_findall_bag') at /opt/local/lib/swipl-6.6.1/boot/init.pl:310
[11] http_dispatch:path_tree(_G405) at /opt/local/lib/swipl-6.6.1/library/http/http_dispatch.pl:806
[10] http_dispatch:find_handler(/,_G421,_G422) at /opt/local/lib/swipl-6.6.1/library/http/http_dispatch.pl:510
[9] http_dispatch:http_dispatch([...|...]) at /opt/local/lib/swipl-6.6.1/library/http/http_dispatch.pl:317
[8] httpd_wrapper:call_handler(user:http_dispatch,1,[...|...]) at /opt/local/lib/swipl-6.6.1/library/http/http_wrapper.pl:259
[7] catch(httpd_wrapper: ...,error(...,...),httpd_wrapper:true) at /opt/local/lib/swipl-6.6.1/boot/init.pl:274
[6] httpd_wrapper:handler_with_output_to(user:http_dispatch,1,[...|...],current_output,error(...,...)) at /opt/local/lib/swipl-6.6.1/library/http/http_wrapper.pl:239
[5] httpd_wrapper:handler_with_output_to(user:http_dispatch,1,[...|...],<stream>(0x457e60),error(...,...)) at /opt/local/lib/swipl-6.6.1/library/http/http_wrapper.pl:249
[4] httpd_wrapper:http_wrapper(user:http_dispatch,<stream>(0x456aa0),<stream>(0x456b30),_G560,[...|...]) at /opt/local/lib/swipl-6.6.1/library/http/http_wrapper.pl:89
[3] thread_httpd:http_process(user:http_dispatch,<stream>(0x456aa0),<stream>(0x456b30),[...|...]) at /opt/local/lib/swipl-6.6.1/library/http/thread_httpd.pl:551
[2] catch(thread_httpd: ...,_G604,thread_httpd:true) at /opt/local/lib/swipl-6.6.1/boot/init.pl:274
[1] thread_httpd:http_worker([...|...]) at /opt/local/lib/swipl-6.6.1/library/http/thread_httpd.pl:382
[0] <meta call>
Thanks Josef Frydl
-------------- next part --------------
HTML attachment scrubbed and removed