► |  | 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.9 | Miscellaneous Utilities

3.6.9.1 | Contracts
3.6.9.2 | Lists
3.6.9.3 | URLs
3.6.9.4 | Paths
3.6.9.5 | Exceptions
3.6.9.6 | Strings
3.6.9.7 | Bytes

On this page:

3.6.9.1`` Contracts
port-number?
path-element?
3.6.9.2`` Lists
list-prefix?
3.6.9.3`` URLs
url-replace-path
url-path->string
3.6.9.4`` Paths
explode-path*
path-without-base
directory-part
build-path-unless-absolute
strip-prefix-ups
3.6.9.5`` Exceptions
pretty-print-invalid-xexpr
network-error
exn->string
3.6.9.6`` Strings
lowercase-symbol!
read/ string
write/ string
3.6.9.7`` Bytes
read/ bytes
write/ bytes

Version: 4.1.4
top← prev up next →

##### 3.6.9`` Miscellaneous Utilities

(require web-server/private/util)

There are a number of other miscellaneous utilities the Web Server needs. They are provided by "private/util.ss".

##### 3.6.9.1`` Contracts

port-number? : contract?

Equivalent to (between/c 1 65535).

path-element? : contract?

Equivalent to (or/c path-string? (symbols 'up 'same)).

##### 3.6.9.2`` Lists

(list-prefix? l r) → boolean?
l : list?
r : list?

True if l is a prefix of r.

##### 3.6.9.3`` URLs

(url-replace-path proc u) → url?
proc : ((listof path/param?) . -> . (listof path/param?))
u : url?

Replaces the URL path of u with proc of the former path.

(url-path->string url-path) → string?
url-path : (listof path/param?)

Formats url-path as a string with "/" as a delimiter and no params.

##### 3.6.9.4`` Paths

(explode-path* p) → (listof path-element?)
p : path-string?

Like normalize-path, but does not resolve symlinks.

(path-without-base base p) → (listof path-element?)
base : path-string?
p : path-string?

Returns, as a list, the portion of p after base, assuming base is a prefix of p.

(directory-part p) → path?
p : path-string?

Returns the directory part of p, returning (current-directory) if it is relative.

(build-path-unless-absolute base p) → path?
base : path-string?
p : path-string?

Prepends base to p, unless p is absolute.

(strip-prefix-ups p) → (listof path-element?)
p : (listof path-element?)

Removes all the prefix ".."s from p.

##### 3.6.9.5`` Exceptions

(pretty-print-invalid-xexpr exn v) → void
exn : exn:invalid-xexpr?
v : any/c

Prints v as if it were almost an X-expression highlighting the error according to exn.

(network-error s fmt v ...) → void
s : symbol?
fmt : string?
v : any/c

Like error, but throws a exn:fail:network.

(exn->string exn) → string?
exn : (or/c exn? any/c)

Formats exn with (error-display-handler) as a string.

##### 3.6.9.6`` Strings

(lowercase-symbol! sb) → symbol?
sb : (or/c string? bytes?)

Returns sb as a lowercase symbol.

(read/string s) → serializable?
s : string?

reads a value from s and returns it.

(write/string v) → string?
v : serializable?

writes v to a string and returns it.

##### 3.6.9.7`` Bytes

(read/bytes b) → serializable?
b : bytes?

reads a value from b and returns it.

(write/bytes v) → bytes?
v : serializable?

writes v to a bytes and returns it.

top← prev up next →