► |  | 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.6 | Internal

3.6.1 | Timers
3.6.2 | Connection Manager
3.6.3 | Dispatching Server
3.6.4 | Serializable Closures
3.6.5 | Cache Table
3.6.6 | MIME Types
3.6.7 | Serialization Utilities
3.6.8 | URL Param
3.6.9 | Miscellaneous Utilities

► | 3.6.3 | Dispatching Server

3.6.3.1 | Dispatching Server Signatures
3.6.3.2 | Dispatching Server Unit
3.6.3.3 | Threads and Custodians

On this page:

3.6.3.1`` Dispatching Server Signatures
dispatch-server^
serve
serve-ports
dispatch-server-config^
port
listen-ip
max-waiting
initial-connection-timeout
read-request
dispatch
3.6.3.2`` Dispatching Server Unit
dispatch-server@
3.6.3.3`` Threads and Custodians

Version: 4.1.4
top← prev up next →

##### 3.6.3`` Dispatching Server

The Web Server is just a configuration of a dispatching server. This dispatching server component is useful on its own.

##### 3.6.3.1`` Dispatching Server Signatures

(require web-server/private/dispatch-server-sig)

The web-server/private/dispatch-server-sig library provides two signatures.

dispatch-server^ : signature

> The dispatch-server^ signature is an alias for web-server^.

> (serve) → (-> void)

> Runs the server and returns a procedure that shuts down the server.

> (serve-ports ip op) → void
> ip : input-port?
> op : output-port?

> Serves a single connection represented by the ports ip and op.

dispatch-server-config^ : signature

> port : port?

> Specifies the port to serve on.

> listen-ip : string?

> Passed to tcp-accept.

> max-waiting : integer?

> Passed to tcp-accept.

> initial-connection-timeout : integer?

> Specifies the initial timeout given to a connection.

> (read-request c p port-addresses) → any/c
> c : connection?
> p : port?

> port-addresses

> :

> (-> port? boolean?
> (or/c (values string? string?)
> (values string? (integer-in 1 65535)
> string? (integer-in 1 65535))))

> Defines the way the server reads requests off connections to be passed to dispatch.

> dispatch : dispatcher/c

> How to handle requests.

##### 3.6.3.2`` Dispatching Server Unit

(require web-server/private/dispatch-server-unit)

The web-server/private/dispatch-server-unit module provides the unit that actually implements a dispatching server.

dispatch-server@ :

(unit/c (tcp^ dispatch-server-config^)
(dispatch-server^))

Runs the dispatching server config in a very basic way, except that it uses Connection Manager to manage connections.

##### 3.6.3.3`` Threads and Custodians

The dispatching server runs in a dedicated thread. Every time a connection is initiated, a new thread is started to handle it. Connection threads are created inside a dedicated custodian that is a child of the server’s custodian. When the server is used to provide servlets, each servlet also receives a new custodian that is a child of the server’s custodian not the connection custodian.

top← prev up next →