on macOS

server := ZnServer startDefaultOn: 9595.
server delegate: (
ZnStaticFileServerDelegate new
    directory: '/Users/sven/' asFileReference ;
    prefixFromString: 'files';
    yourself).
server logToTranscript.

FileLocator home / 'small.html' writeStreamDo: [ :out | 
        (ZnHtmlOutputStream on: out) 
                tag: #h1 with: #Small;
                tag: #p with: 'This is a small HTML document' ].
        
ZnClient new get: 'http://localhost:9595/files/small.html'.

ZnStaticFileServerDelegate does not automatically generate an index for a 
directory.

BTW, you do no really need to go via files, you can just serve resources 
directly.

> On 26 May 2018, at 10:28, Hilaire <hila...@drgeo.eu> wrote:
> 
> Hi,
> 
> On P7, I try to server files with ZnServer, but got trouble:
> 
> server := ZnServer startDefaultOn: 9595.
> server delegate: (
> ZnStaticFileServerDelegate new
>     directory: '/home/hilaire' asFileReference ;
>     prefixFromString: 'files';
>     yourself).
> server logToTranscript.
> server start.
> 
> The browser pointed at http://localhost:9595/files/ only print:
> 
> Not Found /files/
> 
> 
> The log reflects the not found:
> 
> 2018-05-26 10:21:06 378 128292 Started ZnManagingMultiThreadedServer HTTP 
> port 9595
> 2018-05-26 10:21:10 379 552905 Connection Accepted 127.0.0.1
> 2018-05-26 10:21:10 380 552905 Connection Accepted 127.0.0.1
> 2018-05-26 10:21:10 381 990536 Request Read a ZnRequest(GET /files/) 25ms
> 2018-05-26 10:21:10 382 990536 Request Handled a ZnRequest(GET /files/) 4ms
> 2018-05-26 10:21:10 383 990536 Response Written a ZnResponse(404 Not Found 
> text/plain;charset=utf-8 19B) 2ms
> 2018-05-26 10:21:10 384 990536 GET /files/ 404 19B 6ms
> 
> Any idea?
> 
> Hilaire
> 
> -- 
> Dr. Geo
> http://drgeo.eu
> 
> 
> 


Reply via email to