► |  | 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

► | 3 | Extending the Web Server

3.1 | Configuration
3.2 | Setting Up Servlets
3.3 | Dispatchers
3.4 | Web Config Unit
3.5 | Web Server Unit
3.6 | Internal

▼ | 3.3 | Dispatchers

3.3.1 | General
3.3.2 | Mapping URLs to Paths
3.3.3 | Sequencing
3.3.4 | Timeouts
3.3.5 | Lifting Procedures
3.3.6 | Filtering Requests
3.3.7 | Procedure Invocation upon Request
3.3.8 | Logging
3.3.9 | Password Protection
3.3.10 | Virtual Hosts
3.3.11 | Serving Files
3.3.12 | Serving Servlets
3.3.13 | Statistics
3.3.14 | Limiting Requests

On this page:

url->servlet/ c
make-cached-url->servlet
make

Version: 4.1.4
top← prev up next →

##### 3.3.12`` Serving Servlets

(require web-server/dispatchers/dispatch-servlets)

The web-server/dispatchers/dispatch-servlets module defines a dispatcher constructor that runs servlets.

url->servlet/c : contract?

Equivalent to (-> url? servlet?)

(make-cached-url->servlet |  | url->path |
|  | path->serlvet) |

→

(-> void) |  | url->servlet/c

url->path : url->path/c
path->serlvet : path->servlet/c

The first return value flushes the cache. The second is a procedure that uses url->path to resolve the URL to a path, then uses path->servlet to resolve that path to a servlet, caching the results in an internal table.

(make |  | url->servlet |
| [ | #:responders-servlet-loading responders-servlet-loading |
|  | #:responders-servlet responders-servlet]) |

→ dispatcher/c
url->servlet : url->servlet/c

| responders-servlet-loading |  | : |  | (url? exn? . -> . response?)
|  |  | = |  | servlet-loading-responder

| responders-servlet |  | : |  | (url? exn? . -> . response?)
|  |  | = |  | servlet-error-responder

This dispatcher runs Scheme servlets, using url->servlet to resolve URLs to the underlying servlets. If servlets have errors loading, then responders-servlet-loading is used. Other errors are handled with responders-servlet. If a servlet raises calls next-dispatcher, then the signal is propagated by this dispatcher.

top← prev up next →