► |  | Web Server: PLT HTTP Server

1 | Running the Web Server
2 | Writing Servlets
3 | Extending the Web Server
4 | Troubleshooting and Tips
5 | Acknowledgements
| Index

► | 2 | Writing Servlets

2.1 | Defining a Servlet
2.2 | APIs
2.3 | Common Contracts
2.4 | HTTP
2.5 | Web Interaction
2.6 | Stateless Web Interaction
2.7 | Web Cells
2.8 | File Boxes
2.9 | Stateless Web Parameters
2.10 | Formlets
2.11 | Templates
2.12 | Continuation Managers

▼ | 2.1 | Defining a Servlet

2.1.1 | Version 1 Servlets
2.1.2 | Version 2 Servlets
2.1.3 | Stateless Servlets

On this page:

interface-version
timeout
start

Version: 4.1.4
top← prev up next →

##### 2.1.1`` Version 1 Servlets

interface-version : (one-of/c 'v1)

This indicates that the servlet is a version one servlet.

timeout : integer?

This number is used as the continuation-timeout argument to a timeout-based continuation manager used for this servlet. (See Timeouts.) (i.e., you do not have a choice of the manager for this servlet and will be given a timeout-based manager.)

(start initial-request) → response?
initial-request : request?

This function is called when an instance of this servlet is started. The argument is the HTTP request that initiated the instance.

An example version 1 module:

#lang scheme
(define interface-version 'v1)
(define timeout (* 60 60 24))
(define (start req)
`(html (head (title "Hello World!"))
(body (h1 "Hi Mom!"))))

These servlets should use the web-server/servlet API.

top← prev up next →