1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
.TH mod_esi 3 "inets 5.0.9" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
mod_esi \- Erlang Server Interface
.SH DESCRIPTION
.LP
This module defines the API - Erlang Server Interface (ESI)\&. Which is a more efficient way of writing erlang scripts for your Inets web server than writing them as common CGI scripts\&.
.SH EXPORTS
.LP
.B
deliver(SessionID, Data) -> ok | {error, Reason}
.br
.RS
.TP
Types
SessionID = term()
.br
Data = string() | io_list()
.br
Reason = term()
.br
.RE
.RS
.LP
This function is \fIonly\fR intended to be used from functions called by the Erl Scheme interface to deliver parts of the content to the user\&.
.LP
Sends data from a Erl Scheme script back to the client\&. Note that if any HTTP-header fields should be added by the script they must be in the first call to deliver/2 and the data in the call must be a string\&. Do not assume anything about the data type of SessionID, the SessionID must be the value given as input to the esi call back function that you implemented\&.
.RE
.SH ESI CALLBACK FUNCTIONS
.SH EXPORTS
.LP
.B
Module:Function(SessionID, Env, Input)-> _
.br
.RS
.TP
Types
SessionID = term()
.br
Env = [EnvironmentDirectives] ++ ParsedHeader
.br
EnvironmentDirectives = {Key, Value}
.br
Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name\&. <v>Input = string()
.br
.RE
.RS
.LP
The \fIModule\fR must be found in the code path and export \fIFunction\fR with an arity of two\&. An erlScriptAlias must also be set up in the configuration file for the Web server\&.
.LP
If the HTTP request is a post request and a body is sent then content_length will be the length of the posted data\&. If get is used query_string will be the data after \fI?\fR in the url\&.
.LP
ParsedHeader is the HTTP request as a key value tuple list\&. The keys in parsed header will be the in lower case\&.
.LP
SessionID is a identifier the server use when \fIdeliver/2\fR is called, do not assume any-thing about the datatype\&.
.LP
Use this callback function to dynamicly generate dynamic web content\&. when a part of the page is generated send the data back to the client through \fIdeliver/2\fR\&. Note that the first chunk of data sent to the client must at least contain all HTTP header fields that the response will generate\&. If the first chunk not contains \fIEnd of HTTP header\fR that is \fI"\er\e \er\e "\fR the server will assume that no HTTP header fields will be generated\&.
.RE
.LP
.B
Module:Function(Env, Input)-> Response
.br
.RS
.TP
Types
Env = [EnvironmentDirectives] ++ ParsedHeader
.br
EnvironmentDirectives = {Key, Value}
.br
Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name\&. <v>Input = string()
.br
Response = string()
.br
.RE
.RS
.LP
This callback format consumes quite much memory since the whole response must be generated before it is sent to the user\&.This functions is deprecated and only keept for backwards compability\&. For new development Module:Function/3 should be used\&.
.RE
|