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

On this page:

file-box?
file-box
file-unbox
file-box-set?
file-box-set!

Version: 4.1.4
top← prev up next →

#### 2.8`` File Boxes

(require web-server/lang/file-box)

As mentioned earlier, it is dangerous to rely on the store in Web Language servlets, due to the deployment scenarios available to them. "lang/file-box.ss" provides a simple API to replace boxes in a safe way.

(file-box? v) → boolean?
v : any/c

Checks if v is a file-box.

(file-box p v) → file-box?
p : path-string?
v : serializable?

Creates a file-box that is stored at p, with the default contents of v.

(file-unbox fb) → serializable?
fb : file-box?

Returns the value inside fb

(file-box-set? fb) → boolean?
fb : file-box?

Returns #t if fb contains a value.

(file-box-set! fb v) → void
fb : file-box?
v : serializable?

Saves v in the file represented by fb.

Warning: If you plan on using a load-balancer, make sure your file-boxes are on a shared medium.

top← prev up next →