Damien,
On 20 Feb 2012, at 16:00, Damien Cassou wrote:
> Hi Sven,
>
> On Mon, Feb 20, 2012 at 3:08 PM, Sven Van Caekenberghe <
[hidden email]> wrote:
>> In well under a minute, you can browse
http://localhost:1701 and all this with less than 20Mb being downloaded.
>
> I don't get it. What is this server serving exactly? Where are the served files?
>
> --
> Damien Cassou
>
http://damiencassou.seasidehosting.st>
> "Lambdas are relegated to relative obscurity until Java makes them
> popular by not having them." James Iry
Glad you asked ;-)
It is an HTTP server, not necessarily a static file server (but it could be an elementary one, given proper configuration, see ZnStaticFileServerDelegate).
What you see, is what ZnServer exposes by default, as implemented by ZnDefaultServerDelegate, which is just some friendly welcome page (like when you install an unconfigured Apache) combined with somewhat hidden test functionality. From the class comment:
---
I am ZnDefaultServerDelegate.
I function as a delegate for ZnServer, implementing #handleRequest:
I implement responses to the following prefixes:
/echo - an echo text of request information for debugging purposes
/dw-bench - a dynamic html page for benchmarking purposes
/unicode - a unicode test page
/random - a random string (/random/32 for a specific size)
/bytes - bytes according to a pattern (/bytes/32 for a specific size)
/favicon.ico - a Zn favicon
/status - a server status page
/help - lists all page prefixes
/ - an html welcome page
Without any matches, I respond with a page not found.
Part of Zinc HTTP Components.
---
Sven
PS:
Other interesting delegates are ZnDispatcherDelegate as well as ZnMonticelloServerDelegate.
The pages at
http://zn.stfx.eu and in particular
http://zn.stfx.eu/help serve this live, with the following config:
ZnServer startDefaultOn: 8080.
!
| staticFileServer |
(staticFileServer := ZnStaticFileServerDelegate new)
prefixFromString: 'zn';
directory: (FileDirectory on: '/home/ubuntu/zn').
ZnServer default delegate prefixMap
at: 'zn'
put: [ :request | staticFileServer handleRequest: request ];
at: 'redirect-to-zn'
put: [ :request | ZnResponse redirect: '/zn/index.html' ];
at: '/'
put: 'redirect-to-zn'.