From 4b9223e6e7be9713ac7c6c5cf0d4fee3fc1a3d56 Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 6 Oct 2009 15:30:44 +0000 Subject: [PATCH] Updating docs re SK svn: r16253 --- collects/web-server/scribblings/running.scrbl | 1 + .../web-server/scribblings/servlet-env.scrbl | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/collects/web-server/scribblings/running.scrbl b/collects/web-server/scribblings/running.scrbl index 8a42f26ad8..fbcac03c37 100644 --- a/collects/web-server/scribblings/running.scrbl +++ b/collects/web-server/scribblings/running.scrbl @@ -42,6 +42,7 @@ The following API is provided to customize the server instance: This instructs the Web server to serve static files, such as stylesheet and images, from @scheme[path]. } +If you want more control over specific parameters, keep reading about @schememodname[web-server/servlet-env]. @; ------------------------------------------------------------ @include-section["servlet-env.scrbl"] diff --git a/collects/web-server/scribblings/servlet-env.scrbl b/collects/web-server/scribblings/servlet-env.scrbl index 12165b6835..21da9d296f 100644 --- a/collects/web-server/scribblings/servlet-env.scrbl +++ b/collects/web-server/scribblings/servlet-env.scrbl @@ -18,9 +18,20 @@ @defmodule[web-server/servlet-env]{ -The @web-server provides a way to quickly configure and start a servlet. +The @web-server provides a way to quickly configure and start a servlet with more customizability than @schememodname[web-server/insta] provides. This is provided by the @schememodname[web-server/servlet-env] module. Here is a simple example of its use: +@schememod[ +scheme +(require web-server/servlet + web-server/servlet-env) -Here's a simple example: +(define (start request) + `(html (head (title "Hello world!")) + (body (p "Hey out there!")))) + +(serve/servlet start) +] + +Unlike the @schememodname[web-server/insta] language, @scheme[start] is not a special identifier, so we could just as well have written the example as: @schememod[ scheme (require web-server/servlet @@ -33,6 +44,8 @@ scheme (serve/servlet my-app) ] +Let's look at some of the customizations @scheme[serve/servlet] allows. + Suppose you'd like to change the port to something else, change the last line to: @schemeblock[ (serve/servlet my-app @@ -55,7 +68,7 @@ suppose you wanted it to be @filepath{http://localhost:8000/hello.ss}: Suppose you wanted it to capture top-level requests: @schemeblock[ (serve/servlet my-app - #:servlet-path "/") + #:servlet-regexp #rx"") ] Or, perhaps just some nice top-level name: @schemeblock[