]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_actions.xml
add $Revision$ keyword
[apache] / docs / manual / mod / mod_actions.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $Revision: 1.17 $ -->
5
6 <!--
7  Copyright 2002-2004 The Apache Software Foundation
8
9  Licensed under the Apache License, Version 2.0 (the "License");
10  you may not use this file except in compliance with the License.
11  You may obtain a copy of the License at
12
13      http://www.apache.org/licenses/LICENSE-2.0
14
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20 -->
21
22 <modulesynopsis metafile="mod_actions.xml.meta">
23
24 <name>mod_actions</name> 
25
26 <description>This module provides for executing CGI scripts based on
27 media type or request method.</description>
28
29 <status>Base</status>
30 <sourcefile>mod_actions.c</sourcefile>
31 <identifier>actions_module</identifier>
32
33 <summary>
34     <p>This module has two directives. The <directive
35     module="mod_actions">Action</directive> directive lets you run CGI
36     scripts whenever a file of a certain MIME content type is requested. The
37     <directive module="mod_actions">Script</directive> directive lets
38     you run CGI scripts whenever a particular method is used in a
39     request. This makes it much easier to execute scripts that process
40     files.</p>
41 </summary>
42
43 <seealso><module>mod_cgi</module></seealso>
44 <seealso><a href="../howto/cgi.html">Dynamic Content with CGI</a></seealso>
45 <seealso><a href="../handler.html">Apache's Handler Use</a></seealso>
46
47 <directivesynopsis>
48 <name>Action</name>
49 <description>Activates a CGI script for a particular handler or
50 content-type</description>
51 <syntax>Action <var>action-type</var> <var>cgi-script</var> [virtual]</syntax>
52 <contextlist>
53 <context>server config</context><context>virtual host</context>
54 <context>directory</context><context>.htaccess</context>
55 </contextlist>
56 <override>FileInfo</override>
57 <compatibility>The <code>virtual</code> modifier and handler passing were
58 introduced in Apache 2.1</compatibility>
59
60 <usage>
61     <p>This directive adds an action, which will activate
62     <var>cgi-script</var> when <var>action-type</var> is triggered by the
63     request.  The <var>cgi-script</var> is the URL-path to a resource
64     that has been designated as a CGI script using <directive
65     module="mod_alias">ScriptAlias</directive> or <directive
66     module="mod_mime">AddHandler</directive>.  The
67     <var>action-type</var> can be either a <a
68     href="../handler.html">handler</a> or a MIME content type. It
69     sends the URL and file path of the requested document using the
70     standard CGI <code>PATH_INFO</code> and <code>PATH_TRANSLATED</code>
71     environment variables. The handler used for the particular request is
72     passed using the <code>REDIRECT_HANDLER</code> variable.</p>
73
74     <example><title>Examples</title>
75       # Requests for files of a particular MIME content type:<br />
76       Action image/gif /cgi-bin/images.cgi<br />
77       <br />
78       # Files of a particular file extension<br />
79       AddHandler my-file-type .xyz<br />
80       Action my-file-type /cgi-bin/program.cgi<br />
81     </example>
82
83     <p>In the first example, requests for files with a MIME content
84     type of <code>image/gif</code> will be handled by the
85     specified cgi script <code>/cgi-bin/images.cgi</code>.</p>
86
87     <p>In the second example, requests for files with a file extension of
88     <code>.xyz</code> are handled by the specified cgi script 
89     <code>/cgi-bin/program.cgi</code>.</p>
90
91     <p>The optional <code>virtual</code> modifier turns off the check
92     whether the requested file really exists. This is useful, for example,
93     if you want to use the <directive>Action</directive> directive in
94     virtual locations.</p>
95
96     <example><title>Example</title>
97       &lt;Location /news&gt;<br />
98       <indent>
99         SetHandler news-handler<br />
100         Action news-handler /cgi-bin/news.cgi virtual<br />
101       </indent>
102       &lt;/Location&gt;
103     </example>
104 </usage>
105
106 <seealso><directive module="mod_mime">AddHandler</directive></seealso>
107 </directivesynopsis>
108
109 <directivesynopsis>
110 <name>Script</name>
111 <description>Activates a CGI script for a particular request
112 method.</description>
113 <syntax>Script <var>method</var> <var>cgi-script</var></syntax>
114 <contextlist>
115 <context>server config</context><context>virtual host</context>
116 <context>directory</context></contextlist>
117 <usage>
118     <p>This directive adds an action, which will activate
119     <var>cgi-script</var> when a file is requested using the method of
120     <var>method</var>. The <var>cgi-script</var> is the URL-path to a
121     resource that has been designated as a CGI script using <directive
122     module="mod_alias">ScriptAlias</directive> or <directive
123     module="mod_mime">AddHandler</directive>.  The URL and
124     file path of the requested document is sent using the standard CGI
125     <code>PATH_INFO</code> and <code>PATH_TRANSLATED</code> environment 
126     variables.</p>
127
128     <note>
129       Any arbitrary method name may be used. <strong>Method names are
130       case-sensitive</strong>, so <code>Script PUT</code> and
131       <code>Script put</code> have two entirely different
132       effects.
133     </note>
134
135     <p>Note that the <directive>Script</directive> command defines default 
136     actions only. If a CGI script is called, or some other resource that is
137     capable of handling the requested method internally, it will do
138     so. Also note that <directive>Script</directive> with a method of 
139     <code>GET</code> will only be called if there are query arguments present
140     (<em>e.g.</em>, foo.html?hi). Otherwise, the request will
141     proceed normally.</p>
142
143     <example><title>Examples</title>
144       # For &lt;ISINDEX&gt;-style searching<br />
145       Script GET /cgi-bin/search<br />
146       <br />
147       # A CGI PUT handler<br />
148       Script PUT /~bob/put.cgi<br />
149     </example>
150 </usage>
151 </directivesynopsis>
152
153 </modulesynopsis>