Request Dictionary

Overview

Each request to the HTTP server mod sets up a request dictionary. Its life time is limited only to this one request processing time and after that it is cleaned up. The module which provides an API to it is wparts, however it was introduced only to improve the handling of dictionary values. It was the developers decision to break the framework idea of calling the request dictionary through the wpart application and work directly with eptic — it gives some advantages in specific situations.

Usage

In general, it is possible to set {Key, Value} and later get those values from the dictionary (they will be stored under the Key). Presented below is a list of functions operating on the request dictionary.

Request dictionary API

Wpart API

The API of the dictionary covers three functions: fset/2, finsert/2, fget/1. Although fset takes only two arguments {Key, Value}, though it is possible to create deeper structures. To separate parent node from leaves in the Key, a : (colon) is used. The wpart API uses only string as keys, thanks to that it is possible to call the dictionary from the View application level (wpart:lookup look for spec in Manual).

How to put values into the dictionary?

How to get values from dict?

If there is more than one value stored in a key, the function returns a list of all values.

Low level calls API

Setting values:

Recovering values:

Special cases

The dictionary is also used by the framework. E.g. POST messages from the browser go to it. Each message on the framework side is passed by request to the dictionary and starts with a double underscore. Because of backward compatibility issues, some of them still are not. Below is the list of restricted keys.

key

description

__https

bool()

__controller

current controller

post

POST variables

get

GET variables

__not_validated

record from form which failed validation

__error

reason of validation failure

__types

dynamic feed for types addressed to wpart_derived

__edit

default or initial values for derived to fill up form

session

session talks to session table in ETS via e session which synchronize them

__path

hold URL of the current request

__primary_key

identifies values during an update

__cookies

list of tuples: {CookieName, CookieVal} related to the service

__ip

client's IP address, a four element tuple of integers {A, B, C, D}

RequestDictionary (last edited 2009-03-08 05:03:34 by mwillson)