Version: 5.0

Web: Racket Web Applications

Jay McCarthy

This manual describes the Racket libraries for building Web applications.

Running Web Servlets describes how to run the servlets you’ve written.

Stateful Servlets and Stateless Servlets describe two ways to write Web applications. Stateful Servlets use the entire Racket language, but their continuations are stored in the Web server’s memory. Stateless Servlets use a slightly restricted Racket language, but their continuation can be stored by the Web client or on a Web server’s disk. If you can, you want to use Stateless Servlets for the improved scalability.

The HTTP: Hypertext Transfer Protocol section describes the common library function for manipulating HTTP requests and creating HTTP responses. In particular, this section covers cookies, authentication, and request bindings.

The final three sections (URL-Based Dispatch, Formlets: Functional Form Abstraction, and Templates: Separation of View) cover utility libraries that ease the creation of typical Web applications.

This manual closes with a frequently asked questions section: Troubleshooting and Tips.

    1 Running Web Servlets

      1.1 Instant Servlets

      1.2 Simple Single Servlet Servers

      1.3 Command-line Tools

    2 Stateful Servlets

      2.1 Example

      2.2 Common Contracts

      2.3 Web Interaction

      2.4 Web Cells

      2.5 Continuation Managers

        2.5.1 General

        2.5.2 No Continuations

        2.5.3 Timeouts

        2.5.4 LRU

    3 Stateless Servlets

      3.1 Example

      3.2 Serializable Continuations

      3.3 Native Interfaces

      3.4 Stateless Web Interaction

      3.5 Stateless Web Cells

      3.6 File Boxes

      3.7 Stateless Web Parameters

      3.8 Soft State

      3.9 Stuffers

        3.9.1 Basic Combinators

        3.9.2 Serialization

        3.9.3 Base64 Encoding

        3.9.4 GZip Compression

        3.9.5 Key/Value Storage

        3.9.6 Hash-addressed Storage

        3.9.7 HMAC-SHA1 Signing

        3.9.8 Helpers

      3.10 Usage Considerations

    4 HTTP: Hypertext Transfer Protocol

      4.1 Requests

      4.2 Bindings

      4.3 Responses

      4.4 Placing Cookies

      4.5 Extracting Cookies

      4.6 Redirect

      4.7 Basic Authentication

      4.8 Digest Authentication

    5 URL-Based Dispatch

      5.1 Using web-server/dispatch

      5.2 API Reference

      5.3 Built-in URL patterns

      5.4 Extending web-server/dispatch

    6 Formlets: Functional Form Abstraction

      6.1 Basic Formlet Usage

      6.2 Syntactic Shorthand

      6.3 Functional Usage

      6.4 Predefined Formlets

      6.5 Utilities

    7 Templates: Separation of View

      7.1 Static

      7.2 Dynamic

      7.3 Gotchas

      7.4 HTTP Responses

      7.5 API Details

      7.6 Conversion Example

    8 Troubleshooting and Tips

      8.1 Why are my templates not updating on the server when I change the file on disk?

      8.2 Why are templates compiled into programs?

      8.3 Why are my stateful servlets not updating on the server when I change the file on disk?

      8.4 After refreshing my stateful servlet, old captured continuations don’t change or old global effects are gone. Why?

      8.5 How are stateless servlets different from stateful servlets vis a vis refreshing?

      8.6 What special considerations are there for security with the Web Server?

      8.7 IE ignores my CSS or behaves strange in other ways

      8.8 How do I use templates “dynamically"?