Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

root/branches/cherrypy-2.x/docs/book/xml/builtinfilters.xml

Revision 1009 (checked in by dowski, 3 years ago)

Updated wsgiappfilter section of the book.

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <section xmlns:db="http://docbook.org/docbook-ng" xmlns:xi="http://www.w3.org/2001/XInclude"
3          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="builtinfilters">
4     <title>Builtin Filters</title>
5     <section id="baseurlfilter">
6         <title>baseurlfilter</title>
7         <para>The baseurlfilter changes the base url of a request. It is useful for running CherryPy
8         behind Apache with mod_rewrite.</para>
9         <para>The baseurlfilter has the following configuration options</para>
10         <itemizedlist>
11             <listitem>
12                 <para>base_url_filter.base_url</para>
13             </listitem>
14             <listitem>
15                 <para>base_url_filter.use_x_forwarded_host</para>
16             </listitem>
17         </itemizedlist>
18     </section>
19     <section id="cachefilter">
20         <title>cachefilter</title>
21         <para>The cachefilter stores responses in memory. If an identical request is subsequently
22         made, then the cached response is output without calling the page handler.</para>
23     </section>
24     <section id="decodingfilter">
25         <title>decodingfilter</title>
26         <para>The decoding filter can be configured to automatically decode incoming requests.</para>
27         <para>The decodingfilter has the following configuration options:</para>
28         <itemizedlist>
29             <listitem>
30                 <para>decoding_filter.encoding</para>
31             </listitem>
32         </itemizedlist>
33     </section>
34     <section id="encodingfilter">
35         <title>encodingfilter</title>
36         <para>The encodingfilter can be configured to automatically encode outgoing responses.</para>
37         <para>The encodingfilter has the following configuration options:</para>
38         <itemizedlist>
39             <listitem>
40                 <para>encoding_filter.encoding: Force all text responses to be encoded with this
41                 encoding.</para>
42             </listitem>
43             <listitem>
44                 <para>encoding_filter.default_encoding: Default all text responses to this encoding (if
45                 the user-agent does not request otherwise).</para>
46             </listitem>
47         </itemizedlist>
48     </section>
49     <section id="gzipfilter">
50         <title>gzipfilter</title>
51         <para>The gzipfilter will automatically gzip outgoing requests, if it is supported by the
52         client.</para>
53         <para>The gzipfilter does not have any configuration options.</para>
54     </section>
55     <section id="logdebuginfofilter">
56         <title>logdebuginfofilter</title>
57         <para>The logdebuinfofilter adds debug information to each page. The filter is automatically
58         turned on when "server.environment" is set to "development".</para>
59         <para>The logdebuginfofilter has the following configuration options:</para>
60         <itemizedlist>
61             <listitem>
62                 <para>log_debug_info_filter.mime_types, ['text/html']</para>
63             </listitem>
64             <listitem>
65                 <para>log_debug_info_filter.log_as_comment, False</para>
66             </listitem>
67             <listitem>
68                 <para>log_debug_info_filter.log_build_time, True</para>
69             </listitem>
70             <listitem>
71                 <para>log_debug_info_filter.log_page_size, True</para>
72             </listitem>
73         </itemizedlist>
74     </section>
75     <section id="nsgmlsfilter">
76         <title>nsgmlsfilter</title>
77         <para>The nsgmlsfilter parses and validates SGML responses.</para>
78     </section>
79     <section id="sessionauthfilter">
80         <title>sessionauthenticatefilter</title>
81         <para>The sessionauthenticatefilter provides simple form-based authentication and access
82         control.</para>
83     </section>
84     <section id="sessionfilter">
85         <title>sessionfilter</title>
86         <para> The Session Filter has its own section</para>
87     </section>
88     <section id="staticfilter">
89         <title>staticfilter</title>
90         <para>The static filter allows CherryPy to serve static files.</para>
91         <para>The staticfilter has the following configuration options:</para>
92         <itemizedlist>
93             <listitem>
94                 <para>static_filter.file</para>
95             </listitem>
96             <listitem>
97                 <para>static_filter.dir</para>
98             </listitem>
99             <listitem>
100                 <para>static_filter.root</para>
101             </listitem>
102         </itemizedlist>
103     </section>
104     <section id="tidyfilter">
105         <title>tidyfilter</title>
106         <para>The tidyfilter cleans up returned html by running the response through Tidy.</para>
107         <para>Note that we use the standalone Tidy tool rather than the python mxTidy module. This is
108         because this module doesn't seem to be stable and it crashes on some HTML pages (which means
109         that the server would also crash.)</para>
110         <para>The tidyfilter has the following configuration options:</para>
111         <itemizedlist>
112             <listitem>
113                 <para>tidy_filter.tmp_dir</para>
114             </listitem>
115             <listitem>
116                 <para>tidy_filter.strict_xml, False</para>
117             </listitem>
118             <listitem>
119                 <para>tidy_filter.tidy_path</para>
120             </listitem>
121         </itemizedlist>
122     </section>
123     <section id="virtualhostfilter">
124         <title>virtualhostfilter</title>
125         <para>The virtualhostfilter changes the ObjectPath based on the Host. Use this filter when
126         running multiple sites within one CP server.</para>
127         <para>The virtualhostfilter has the following configuration options:</para>
128         <itemizedlist>
129             <listitem>
130                 <para>virtual_host_filter.prefix, '/'</para>
131             </listitem>
132         </itemizedlist>
133     </section>
134     <section id="wsgiappfilter">
135         <title>wsgiappfilter</title>
136         <para>The wsgiappfilter allows the application developer or deployer to mount
137         WSGI-compatible applications and middleware to locations on the CherryPy
138         object tree.</para>
139         <para>Applications can be added to the tree by using the
140             cherrypy.lib.cptools.WSGIApp convenience class to directly mount applications to the
141             CherryPy tree.  You can also add an instance of the filter to a class's _cp_filters
142             list.
143         </para>
144         <para>The cherrypy.lib.cptools.WSGIApp and WSGIAppFilter class contsructors takes the
145             following parameters:
146         </para>
147         <itemizedlist>
148             <listitem>
149                 <para>wsgi_app (required) - the WSGI application callable.</para>
150             </listitem>
151             <listitem>
152                 <para>env_update - a optional dictionary of parameters used to update the WSGI environment.</para>
153             </listitem>
154         </itemizedlist>
155     </section>
156     <section id="xmlrpcfilter">
157         <title>xmlrpcfilter</title>
158         <para>The xmlrpcfilter converts XMLRPC to the CherryPy2 object system and vice-versa.</para>
159         <para>PLEASE NOTE: before_request_body: Unmarshalls the posted data to a methodname and
160         parameters. - These are stored in cherrypy.request.rpcMethod and .rpcParams - The method is
161         also stored in cherrypy.request.path, so CP2 will find the right method to call for you,
162         based on the root's position. before_finalize: Marshalls cherrypy.response.body to xmlrpc. -
163         Until resolved: cherrypy.response.body must be a python source string; this string is
164         'eval'ed to return the results. This will be resolved in the future. - Content-Type and
165         Content-Length are set according to the new (marshalled) data</para>
166         <para>The xmlrpcfilter does not have any configuration options.</para>
167     </section>
168 </section>
Note: See TracBrowser for help on using the browser.

Hosted by WebFaction

Log in as guest/cpguest to create tickets