~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to doc/html-main/netcgi1/Netcgi_types.cgi_activation.html

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
 
<html>
3
 
<head>
4
 
<link rel="stylesheet" href="style.css" type="text/css">
5
 
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
6
 
<link rel="Start" href="index.html">
7
 
<link rel="previous" href="Netcgi_types.cgi_argument.html">
8
 
<link rel="Up" href="Netcgi_types.html">
9
 
<link title="Index of types" rel=Appendix href="index_types.html">
10
 
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
11
 
<link title="Index of values" rel=Appendix href="index_values.html">
12
 
<link title="Index of class methods" rel=Appendix href="index_methods.html">
13
 
<link title="Index of classes" rel=Appendix href="index_classes.html">
14
 
<link title="Index of class types" rel=Appendix href="index_class_types.html">
15
 
<link title="Index of modules" rel=Appendix href="index_modules.html">
16
 
<link title="Netcgi_env" rel="Chapter" href="Netcgi_env.html">
17
 
<link title="Netcgi_types" rel="Chapter" href="Netcgi_types.html">
18
 
<link title="Netcgi" rel="Chapter" href="Netcgi.html">
19
 
<link title="Netcgi_jserv" rel="Chapter" href="Netcgi_jserv.html">
20
 
<link title="Netcgi_jserv_ajp12" rel="Chapter" href="Netcgi_jserv_ajp12.html">
21
 
<link title="Netcgi_jserv_app" rel="Chapter" href="Netcgi_jserv_app.html">
22
 
<link title="Netcgi_fcgi_10" rel="Chapter" href="Netcgi_fcgi_10.html">
23
 
<link title="Netcgi_fcgi" rel="Chapter" href="Netcgi_fcgi.html">
24
 
<link title="Netcgi1_compat" rel="Chapter" href="Netcgi1_compat.html"><title>Ocamlnet 2 Reference Manual (netcgi1 add-on) : Netcgi_types.cgi_activation</title>
25
 
</head>
26
 
<body>
27
 
<div class="navbar"><a href="Netcgi_types.cgi_argument.html">Previous</a>
28
 
&nbsp;<a href="Netcgi_types.html">Up</a>
29
 
&nbsp;</div>
30
 
<center><h1>Class type <a href="type_Netcgi_types.cgi_activation.html">Netcgi_types.cgi_activation</a></h1></center>
31
 
<br>
32
 
<pre><span class="keyword">class type</span> <a name="TYPEcgi_activation"></a>cgi_activation = <code class="code">object</code> <a href="Netcgi_types.cgi_activation.html">..</a> <code class="code">end</code></pre>The common interface of CGI activation objects<br>
33
 
<hr width="100%">
34
 
<pre><span class="keyword">method</span> <a name="METHODenvironment"></a>environment : <code class="type"><a href="Netcgi_env.cgi_environment.html">Netcgi_env.cgi_environment</a></code></pre><div class="info">
35
 
The CGI environment object. This object is the "outer layer" of the
36
 
 activation object that connects it with real I/O channels.<br>
37
 
</div>
38
 
<pre><span class="keyword">method</span> <a name="METHODrequest_method"></a>request_method : <code class="type"><a href="Netcgi_types.html#TYPErequest_method">request_method</a></code></pre><div class="info">
39
 
The HTTP method<br>
40
 
</div>
41
 
<a name="2_Initialarguments"></a>
42
 
<h2>Initial arguments</h2>
43
 
<p>
44
 
 
45
 
 Initial arguments are the CGI arguments at the time the arguments
46
 
 were parsed from the environment.<pre><span class="keyword">method</span> <a name="METHODinitial_arguments"></a>initial_arguments : <code class="type">(string * <a href="Netcgi_types.cgi_argument.html">cgi_argument</a>) list</code></pre><div class="info">
47
 
The complete list of initial arguments<br>
48
 
</div>
49
 
<pre><span class="keyword">method</span> <a name="METHODinitial_argument"></a>initial_argument : <code class="type">string -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a></code></pre><div class="info">
50
 
Returns a certain initial argument, or raises <code class="code">Not_found</code><br>
51
 
</div>
52
 
<pre><span class="keyword">method</span> <a name="METHODinitial_argument_value"></a>initial_argument_value : <code class="type">?default:string -> string -> string</code></pre><div class="info">
53
 
Returns the value of the initial argument as string. If the
54
 
 argument does not exist, the <code class="code">default</code> is returned. The
55
 
 <code class="code">default</code> defaults to <code class="code">""</code>.<br>
56
 
</div>
57
 
<pre><span class="keyword">method</span> <a name="METHODinitial_multiple_argument"></a>initial_multiple_argument : <code class="type">string -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> list</code></pre><div class="info">
58
 
Returns a certain initial argument that occurs several times in
59
 
 the set of arguments<br>
60
 
</div>
61
 
<a name="2_Currentarguments"></a>
62
 
<h2>Current arguments</h2>
63
 
<p>
64
 
 
65
 
 The current arguments can be modified, but they are initialized
66
 
 to the initial arguments at object creation time:<pre><span class="keyword">method</span> <a name="METHODarguments"></a>arguments : <code class="type">(string * <a href="Netcgi_types.cgi_argument.html">cgi_argument</a>) list</code></pre><div class="info">
67
 
The complete list of current arguments<br>
68
 
</div>
69
 
<pre><span class="keyword">method</span> <a name="METHODargument"></a>argument : <code class="type">string -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a></code></pre><div class="info">
70
 
Returns a certain current argument, or raises <code class="code">Not_found</code><br>
71
 
</div>
72
 
<pre><span class="keyword">method</span> <a name="METHODargument_value"></a>argument_value : <code class="type">?default:string -> string -> string</code></pre><div class="info">
73
 
Returns the value of the current argument as string. If the
74
 
 argument does not exist, the <code class="code">default</code> is returned. The
75
 
 <code class="code">default</code> defaults to <code class="code">""</code>.<br>
76
 
</div>
77
 
<pre><span class="keyword">method</span> <a name="METHODmultiple_argument"></a>multiple_argument : <code class="type">string -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> list</code></pre><div class="info">
78
 
Returns a certain current argument that occurs several times in
79
 
 the set of arguments<br>
80
 
</div>
81
 
<a name="2_Modifythesetofcurrentarguments"></a>
82
 
<h2>Modify the set of current arguments</h2><pre><span class="keyword">method</span> <a name="METHODset_arguments"></a>set_arguments : <code class="type">?fin:bool -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> list -> unit</code></pre><div class="info">
83
 
Replaces the set of current arguments with a new set.
84
 
<br>
85
 
</div>
86
 
<div class="param_info"><code class="code">fin</code> : If <code class="code">true</code>, the default, the arguments of the old set
87
 
   that are not member of the new set are finalized</div>
88
 
<pre><span class="keyword">method</span> <a name="METHODupdate_argument"></a>update_argument : <code class="type">?fin:bool -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> -> unit</code></pre><div class="info">
89
 
The passed argument replaces the current argument
90
 
    (or multiple argument) with the same name; if there is no such
91
 
    argument, the passed argument is added to the list of current args
92
 
<br>
93
 
</div>
94
 
<div class="param_info"><code class="code">fin</code> : If <code class="code">true</code>, the default, the replaced arguments are
95
 
    finalized (unless they happen to be the same as the new argument)</div>
96
 
<pre><span class="keyword">method</span> <a name="METHODupdate_multiple_argument"></a>update_multiple_argument : <code class="type">?fin:bool -> <a href="Netcgi_types.cgi_argument.html">cgi_argument</a> list -> unit</code></pre><div class="info">
97
 
The passed arguments must all have the same name. They replace
98
 
 the current argument (or multiple argument) with the same name;
99
 
 if there is no such argument, the passed arguments are added to
100
 
 the set of current arguments.
101
 
<br>
102
 
</div>
103
 
<div class="param_info"><code class="code">fin</code> : If <code class="code">true</code>, the default, the replaced arguments are
104
 
    finalized (unless they happen to be the same as the new arguments)</div>
105
 
<pre><span class="keyword">method</span> <a name="METHODdelete_argument"></a>delete_argument : <code class="type">?fin:bool -> string -> unit</code></pre><div class="info">
106
 
Deletes all arguments with the passed name.
107
 
<br>
108
 
</div>
109
 
<div class="param_info"><code class="code">fin</code> : If <code class="code">true</code>, the default, the deleted arguments are
110
 
  finalized</div>
111
 
<a name="2_SelfreferencingURL"></a>
112
 
<h2>Self-referencing URL</h2><pre><span class="keyword">method</span> <a name="METHODurl"></a>url : <code class="type">?protocol:<a href="Netcgi_env.html#TYPEprotocol">Netcgi_env.protocol</a> -><br>       ?with_authority:<a href="Netcgi_types.html#TYPEother_url_spec">other_url_spec</a> -><br>       ?with_script_name:<a href="Netcgi_types.html#TYPEother_url_spec">other_url_spec</a> -><br>       ?with_path_info:<a href="Netcgi_types.html#TYPEother_url_spec">other_url_spec</a> -><br>       ?with_query_string:<a href="Netcgi_types.html#TYPEquery_string_spec">query_string_spec</a> -> unit -> string</code></pre><div class="info">
113
 
Returns the URL of the current CGI activation.
114
 
<p>
115
 
<ul>
116
 
<li><code class="code">protocol</code>: The URL scheme. By default, the URL scheme is used
117
 
   that is described in the environment</li>
118
 
<li><code class="code">with_authority</code>: Whether to include authority part of the URL, and
119
 
   if yes, from which source. Default: <code class="code">`Env</code></li>
120
 
<li><code class="code">with_script_name</code>: Whether to include the part of the URL path
121
 
   identifying the CGI script, and if yes, from which source.
122
 
   Default: <code class="code">`Env</code></li>
123
 
<li><code class="code">with_path_info</code>: Whether to include the rest of the URL path
124
 
   exceeding the script name, and if yes, from which source.
125
 
   Default: <code class="code">`Env</code></li>
126
 
<li><code class="code">with_query_string</code>: Whether to include the query string,
127
 
   and if yes, which one. Default: <code class="code">`None</code>, i.e. no query string</li>
128
 
</ul>
129
 
<br>
130
 
</div>
131
 
<a name="2_GeneratingOutput"></a>
132
 
<h2>Generating Output</h2><pre><span class="keyword">method</span> <a name="METHODoutput"></a>output : <code class="type">Netchannels.trans_out_obj_channel</code></pre><div class="info">
133
 
The output channel to which the generated content is intended to
134
 
 be written.
135
 
<p>
136
 
 
137
 
 The output channel may have transactional semantics, and because of
138
 
 this, it is an <code class="code">trans_out_obj_channel</code>. Implementations are free
139
 
 to support transactions or not.
140
 
<p>
141
 
 
142
 
 After all data have been written, the method <code class="code">commit_work</code> must be
143
 
 called, even if there is no support for transactions.
144
 
<p>
145
 
 
146
 
 Simple Example:
147
 
<p>
148
 
 
149
 
 <pre><code class="code"> cgi # output # output_string "Hello world!\n";
150
 
 cgi # output # commit_work()
151
 
 </code></pre>
152
 
<p>
153
 
 
154
 
 Example for an error handler and a transaction buffer:
155
 
 If an error happens, it is possible to roll the channel back, and
156
 
 to write the error message.
157
 
 <pre><code class="code"> try
158
 
   cgi # set_header ... ();
159
 
   cgi # output # output_string "Hello World!"; ...
160
 
   cgi # output # commit_work();
161
 
 with
162
 
   err -&gt;
163
 
     cgi # output # rollback_work();
164
 
     cgi # set_header ... ();
165
 
     cgi # output # output_string "Software error!"; ...
166
 
     cgi # output # commit_work();
167
 
 </code></pre><br>
168
 
</div>
169
 
<pre><span class="keyword">method</span> <a name="METHODset_header"></a>set_header : <code class="type">?status:<a href="Netcgi_types.html#TYPEstatus">status</a> -><br>       ?content_type:string -><br>       ?cache:<a href="Netcgi_types.html#TYPEcache_control">cache_control</a> -><br>       ?filename:string -><br>       ?language:string -><br>       ?script_type:string -><br>       ?style_type:string -><br>       ?set_cookie:<a href="Netcgi_types.html#TYPEcgi_cookie">cgi_cookie</a> list -><br>       ?fields:(string * string list) list -> unit -> unit</code></pre><div class="info">
170
 
Sets the header.
171
 
<p>
172
 
 
173
 
 When the output channel supports transactions, it is possible to
174
 
 set the header until the channel is commited for the first time.
175
 
 When there is no support for transactions, the header must be
176
 
 set before the first byte of output is written.
177
 
<p>
178
 
 
179
 
 If <code class="code">set_header</code> is called several times, <i>all</i> of the header fields
180
 
 are overwritten.
181
 
<p>
182
 
<ul>
183
 
<li><code class="code">status</code>: Sets the HTTP status of the reply. Defaults to "no status",
184
 
   but the server normally complements an <code class="code">`Ok</code> status in this case</li>
185
 
<li><code class="code">content_type</code>: Sets the content type. Defaults to "text/html" if the
186
 
   content type is not yet set.</li>
187
 
<li><code class="code">cache</code>: Sets the cache behavior for replies to GET requests. The
188
 
   default is <code class="code">`Unspecified</code>. <b>It is strongly recommended to specify
189
 
   the caching behaviour!!!</b> You are on the safe side with <code class="code">`No_cache</code>,
190
 
   forcing every page to be regenerated. If your data do not change
191
 
   frequently, <code class="code">`Max_age n</code> tells the caches to store the data at most
192
 
   <code class="code">n</code> seconds.</li>
193
 
<li><code class="code">filename</code>: Sets the filename associated with the page. This filename
194
 
   is taken for the "save as..." dialog. Default: no filename.
195
 
   Note: It is bad practice if the filename contains problematic characters
196
 
   (backslash, double quote, space), or the names of directories</li>
197
 
<li><code class="code">script_type</code>: Sets the language of the script tag (for HTML replies).
198
 
   It is recommended to use this field if there are <code class="code">ONXXX</code> attributes
199
 
   containing scripts before the first <code class="code">&lt;SCRIPT&gt;</code> element, because you
200
 
   cannot specify the script language for the <code class="code">ONXXX</code> attributes otherwise.
201
 
   <code class="code">script_type</code> must be a media type, e.g. "text/javascript".
202
 
   Default: no language is specified.</li>
203
 
<li><code class="code">style_type</code>: Sets the language of the style tag (for HTML replies).
204
 
   It is recommended to use this field if there are <code class="code">STYLE</code> attributes
205
 
   containing scripts before the first <code class="code">&lt;STYLE&gt;</code> element, because you
206
 
   cannot specify the style language for the <code class="code">STYLE</code> attributes otherwise.
207
 
   <code class="code">style_type</code> must be a media type, e.g. "text/css". 
208
 
   Default: no language is specified.</li>
209
 
<li><code class="code">set_cookie</code>: Sets a number of cookies.
210
 
   Default: <code class="code">[]</code>
211
 
   You can query the cookies using <code class="code">environment#cookies</code>.</li>
212
 
<li><code class="code">fields</code>: Sets other fields of the header.</li>
213
 
</ul>
214
 
<br>
215
 
</div>
216
 
<pre><span class="keyword">method</span> <a name="METHODset_redirection_header"></a>set_redirection_header : <code class="type">string -> unit</code></pre><div class="info">
217
 
Sets the header such that a redirection to the specified URL
218
 
 is performed. If the URL begins with "http:" the redirection directive is
219
 
 passed back to the client, and the client will repeat the request for
220
 
 the new location. If the URL begins with "/", the server performs the
221
 
 redirection, and it is invisible for the client.<br>
222
 
</div>
223
 
<a name="2_CleaningUp"></a>
224
 
<h2>Cleaning Up</h2><pre><span class="keyword">method</span> <a name="METHODfinalize"></a>finalize : <code class="type">unit -> unit</code></pre><div class="info">
225
 
This method calls <code class="code">finalize</code> for every CGI argument to ensure that
226
 
 all files are deleted.
227
 
 It does not close the in/out channels, however.
228
 
 This method is not registered in the garbage collector, and it is
229
 
 a bad idea to do so.<br>
230
 
</div>
231
 
</body></html>
 
 
b'\\ No newline at end of file'