View | Details | Raw Unified | Return to bug 55383
Collapse All | Expand All

(-)webapps/docs/appdev/deployment.xml (-5 / +3 lines)
Lines 156-162 Link Here
156
in Chapter 13 of the Servlet API Specification, version 2.3.  Over time, it
156
in Chapter 13 of the Servlet API Specification, version 2.3.  Over time, it
157
is expected that development tools will be provided that create and edit the
157
is expected that development tools will be provided that create and edit the
158
deployment descriptor for you.  In the meantime, to provide a starting point,
158
deployment descriptor for you.  In the meantime, to provide a starting point,
159
a <a href="web.xml.txt" target="_new">basic web.xml file</a>
159
a <a href="web.xml.txt" target="_blank">basic web.xml file</a>
160
is provided.  This file includes comments that describe the purpose of each
160
is provided.  This file includes comments that describe the purpose of each
161
included element.</p>
161
included element.</p>
162
162
Lines 186-198 Link Here
186
186
187
<section name="Deployment With Tomcat">
187
<section name="Deployment With Tomcat">
188
188
189
    <blockquote><em>
189
    <p><em>The description below uses the variable name $CATALINA_BASE to refer the
190
    <p>The description below uses the variable name $CATALINA_BASE to refer the
191
    base directory against which most relative paths are resolved. If you have
190
    base directory against which most relative paths are resolved. If you have
192
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
191
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
193
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
192
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
194
    the directory into which you have installed Tomcat.</p>
193
    the directory into which you have installed Tomcat.</em></p>
195
    </em></blockquote>
196
194
197
<p>In order to be executed, a web application must be deployed on
195
<p>In order to be executed, a web application must be deployed on
198
a servlet container.  This is true even during development.
196
a servlet container.  This is true even during development.
(-)webapps/docs/appdev/index.xml (-1 / +1 lines)
Lines 65-71 Link Here
65
<li><a href="processes.html"><strong>Development Processes</strong></a> -
65
<li><a href="processes.html"><strong>Development Processes</strong></a> -
66
    Provides brief descriptions of typical development processes
66
    Provides brief descriptions of typical development processes
67
    utilizing the recommended deployment and source organizations.</li>
67
    utilizing the recommended deployment and source organizations.</li>
68
<li><a href="sample/" target="_new"><strong>Example Application</strong></a> -
68
<li><a href="sample/" target="_blank"><strong>Example Application</strong></a> -
69
    This directory contains a very simple, but functionally complete,
69
    This directory contains a very simple, but functionally complete,
70
    "Hello, World" application built according to the principles
70
    "Hello, World" application built according to the principles
71
    described in this manual.  You can use this application to
71
    described in this manual.  You can use this application to
(-)webapps/docs/appdev/installation.xml (-2 / +2 lines)
Lines 39-45 Link Here
39
39
40
<subsection name="JDK">
40
<subsection name="JDK">
41
41
42
<p>Tomcat 7.0 was designed to run on Java SE 6.
42
<p>Tomcat 8.0 was designed to run on Java SE 7.
43
</p>
43
</p>
44
44
45
<p>Compatible JDKs for many platforms (or links to where they can be found)
45
<p>Compatible JDKs for many platforms (or links to where they can be found)
Lines 53-59 Link Here
53
<p>Binary downloads of the <strong>Tomcat</strong> server are available from
53
<p>Binary downloads of the <strong>Tomcat</strong> server are available from
54
<a href="http://tomcat.apache.org/">http://tomcat.apache.org/</a>.
54
<a href="http://tomcat.apache.org/">http://tomcat.apache.org/</a>.
55
This manual assumes you are using the most recent release
55
This manual assumes you are using the most recent release
56
of Tomcat 7.  Detailed instructions for downloading and installing
56
of Tomcat 8.  Detailed instructions for downloading and installing
57
Tomcat are available <a href="../setup.html">here</a>.</p>
57
Tomcat are available <a href="../setup.html">here</a>.</p>
58
58
59
<p>In the remainder of this manual, example shell scripts assume that you have
59
<p>In the remainder of this manual, example shell scripts assume that you have
(-)webapps/docs/appdev/introduction.xml (-5 / +5 lines)
Lines 47-53 Link Here
47
47
48
<p>The discussion in this manual is aimed at developers who will be using
48
<p>The discussion in this manual is aimed at developers who will be using
49
a text editor along with command line tools to develop and debug their
49
a text editor along with command line tools to develop and debug their
50
applications.  As such, the recommendations are fairly generic -- but you
50
applications.  As such, the recommendations are fairly generic &#x2013; but you
51
should easily be able to apply them in either a Windows-based or Unix-based
51
should easily be able to apply them in either a Windows-based or Unix-based
52
development environment.  If you are utilizing an Integrated Development
52
development environment.  If you are utilizing an Integrated Development
53
Environment (IDE) tool, you will need to adapt the advice given here to
53
Environment (IDE) tool, you will need to adapt the advice given here to
Lines 62-68 Link Here
62
information, documentation, and software that is useful in developing
62
information, documentation, and software that is useful in developing
63
web applications with Tomcat.</p>
63
web applications with Tomcat.</p>
64
<ul>
64
<ul>
65
<li><a href="http://jcp.org/aboutJava/communityprocess/mrel/jsr245/index2.html">http://jcp.org/aboutJava/communityprocess/mrel/jsr245/index2.html</a> -
65
<li><p><a href="http://jcp.org/aboutJava/communityprocess/mrel/jsr245/index2.html">http://jcp.org/aboutJava/communityprocess/mrel/jsr245/index2.html</a> -
66
    <i>JavaServer Pages (JSP) Specification, Version 2.3</i>.  Describes
66
    <i>JavaServer Pages (JSP) Specification, Version 2.3</i>.  Describes
67
    the programming environment provided by standard implementations
67
    the programming environment provided by standard implementations
68
    of the JavaServer Pages (JSP) technology.  In conjunction with
68
    of the JavaServer Pages (JSP) technology.  In conjunction with
Lines 71-78 Link Here
71
    information on scripting (Chapter 9), tag extensions (Chapter 7),
71
    information on scripting (Chapter 9), tag extensions (Chapter 7),
72
    and packaging JSP pages (Appendix A) is useful.  The Javadoc
72
    and packaging JSP pages (Appendix A) is useful.  The Javadoc
73
    API Documentation is included in the specification, and with the
73
    API Documentation is included in the specification, and with the
74
    Tomcat download.<br/><br/></li>
74
    Tomcat download.</p></li>
75
<li><a href="http://jcp.org/aboutJava/communityprocess/final/jsr340/index.html">http://jcp.org/aboutJava/communityprocess/final/jsr340/index.html</a> -
75
<li><p><a href="http://jcp.org/aboutJava/communityprocess/final/jsr340/index.html">http://jcp.org/aboutJava/communityprocess/final/jsr340/index.html</a> -
76
    <i>Servlet API Specification, Version 3.1</i>.  Describes the
76
    <i>Servlet API Specification, Version 3.1</i>.  Describes the
77
    programming environment that must be provided by all servlet
77
    programming environment that must be provided by all servlet
78
    containers conforming to this specification.  In particular, you
78
    containers conforming to this specification.  In particular, you
Lines 82-88 Link Here
82
    security (Chapter 13), and the syntax of the <code>web.xml</code>
82
    security (Chapter 13), and the syntax of the <code>web.xml</code>
83
    Web Application Deployment Descriptor (Chapter 14).  The Javadoc
83
    Web Application Deployment Descriptor (Chapter 14).  The Javadoc
84
    API Documentation is included in the specification, and with the
84
    API Documentation is included in the specification, and with the
85
    Tomcat download.<br/><br/></li>
85
    Tomcat download.</p></li>
86
</ul>
86
</ul>
87
87
88
</section>
88
</section>
(-)webapps/docs/appdev/processes.xml (-66 / +52 lines)
Lines 56-67 Link Here
56
<em>Manager</em> web application, you need to perform the following tasks
56
<em>Manager</em> web application, you need to perform the following tasks
57
once (no matter how many web applications you plan to develop).</p>
57
once (no matter how many web applications you plan to develop).</p>
58
<ul>
58
<ul>
59
<li><em>Configure the Ant custom tasks</em>.  The implementation code for the
59
<li><p><em>Configure the Ant custom tasks</em>.  The implementation code for the
60
    Ant custom tasks is in a JAR file named
60
    Ant custom tasks is in a JAR file named
61
    <code>$CATALINA_HOME/lib/catalina-ant.jar</code>, which must be
61
    <code>$CATALINA_HOME/lib/catalina-ant.jar</code>, which must be
62
    copied in to the <code>lib</code> directory of your Ant installation.
62
    copied in to the <code>lib</code> directory of your Ant installation.
63
    <br/><br/></li>
63
    </p></li>
64
<li><em>Define one or more Tomcat users</em>.  The <em>Manager</em> web
64
<li><p><em>Define one or more Tomcat users</em>.  The <em>Manager</em> web
65
    application runs under a security constraint that requires a user to be
65
    application runs under a security constraint that requires a user to be
66
    logged in, and have the security role <code>manager-script</code> assigned
66
    logged in, and have the security role <code>manager-script</code> assigned
67
    to him or her.  How such users are defined depends on which Realm you have
67
    to him or her.  How such users are defined depends on which Realm you have
Lines 69-75 Link Here
69
    <a href="../realm-howto.html">Realm Configuration HOW-TO</a> for more
69
    <a href="../realm-howto.html">Realm Configuration HOW-TO</a> for more
70
    information.  You may define any number of users (with any username
70
    information.  You may define any number of users (with any username
71
    and password that you like) with the <code>manager-script</code> role.
71
    and password that you like) with the <code>manager-script</code> role.
72
    <br/><br/></li>
72
    </p></li>
73
</ul>
73
</ul>
74
74
75
</subsection>
75
</subsection>
Lines 87-95 Link Here
87
repository.  This might be done by a series of commands like this, where
87
repository.  This might be done by a series of commands like this, where
88
<code>{project}</code> is the name under which your project should be
88
<code>{project}</code> is the name under which your project should be
89
stored in the CVS repository, and {username} is your login username:</p>
89
stored in the CVS repository, and {username} is your login username:</p>
90
<source>
90
<source><![CDATA[cd {my home directory}
91
cd {my home directory}
91
mkdir myapp <-- Assumed "project source directory"
92
mkdir myapp &lt;-- Assumed "project source directory"
93
cd myapp
92
cd myapp
94
mkdir docs
93
mkdir docs
95
mkdir src
94
mkdir src
Lines 96-111 Link Here
96
mkdir web
95
mkdir web
97
mkdir web/WEB-INF
96
mkdir web/WEB-INF
98
cvs import -m "Initial Project Creation" {project} \
97
cvs import -m "Initial Project Creation" {project} \
99
    {username} start
98
    {username} start]]></source>
100
</source>
101
99
102
<p>Now, to verify that it was created correctly in CVS, we will perform a
100
<p>Now, to verify that it was created correctly in CVS, we will perform a
103
checkout of the new project:</p>
101
checkout of the new project:</p>
104
<source>
102
<source><![CDATA[cd ..
105
cd ..
106
mv myapp myapp.bu
103
mv myapp myapp.bu
107
cvs checkout {project}
104
cvs checkout {project}]]></source>
108
</source>
109
105
110
<p>Next, you will need to create and check in an initial version of the
106
<p>Next, you will need to create and check in an initial version of the
111
<code>build.xml</code> script to be used for development.  For getting
107
<code>build.xml</code> script to be used for development.  For getting
Lines 112-124 Link Here
112
started quickly and easily, base your <code>build.xml</code> on the
108
started quickly and easily, base your <code>build.xml</code> on the
113
<a href="build.xml.txt">basic build.xml file</a>, included with this manual,
109
<a href="build.xml.txt">basic build.xml file</a>, included with this manual,
114
or code it from scratch.</p>
110
or code it from scratch.</p>
115
<source>
111
<source><![CDATA[cd {my home directory}
116
cd {my home directory}
117
cd myapp
112
cd myapp
118
emacs build.xml     &lt;-- if you want a real editor :-)
113
emacs build.xml     <-- if you want a real editor :-)
119
cvs add build.xml
114
cvs add build.xml
120
cvs commit
115
cvs commit]]></source>
121
</source>
122
116
123
<p>Until you perform the CVS commit, your changes are local to your own
117
<p>Until you perform the CVS commit, your changes are local to your own
124
development directory.  Committing makes those changes visible to other
118
development directory.  Committing makes those changes visible to other
Lines 132-139 Link Here
132
need to define the <code>catalina.home</code> property defining where
126
need to define the <code>catalina.home</code> property defining where
133
Tomcat is installed, and the manager application username and password.
127
Tomcat is installed, and the manager application username and password.
134
You might end up with something like this:</p>
128
You might end up with something like this:</p>
135
<source>
129
<source><![CDATA[# Context path to install this application on
136
# Context path to install this application on
137
app.path=/hello
130
app.path=/hello
138
131
139
# Tomcat 7 installation directory
132
# Tomcat 7 installation directory
Lines 141-148 Link Here
141
134
142
# Manager webapp username and password
135
# Manager webapp username and password
143
manager.username=myusername
136
manager.username=myusername
144
manager.password=mypassword
137
manager.password=mypassword]]></source>
145
</source>
146
138
147
<p>In general, you will <strong>not</strong> want to check the
139
<p>In general, you will <strong>not</strong> want to check the
148
<code>build.properties</code> file in to the CVS repository, because it
140
<code>build.properties</code> file in to the CVS repository, because it
Lines 151-163 Link Here
151
<p>Now, create the initial version of the web application deployment
143
<p>Now, create the initial version of the web application deployment
152
descriptor.  You can base <code>web.xml</code> on the
144
descriptor.  You can base <code>web.xml</code> on the
153
<a href="web.xml.txt">basic web.xml file</a>, or code it from scratch.</p>
145
<a href="web.xml.txt">basic web.xml file</a>, or code it from scratch.</p>
154
<source>
146
<source><![CDATA[cd {my home directory}
155
cd {my home directory}
156
cd myapp/web/WEB-INF
147
cd myapp/web/WEB-INF
157
emacs web.xml
148
emacs web.xml
158
cvs add web.xml
149
cvs add web.xml
159
cvs commit
150
cvs commit]]></source>
160
</source>
161
151
162
Note that this is only an example web.xml file.  The full definition
152
Note that this is only an example web.xml file.  The full definition
163
of the deployment descriptor file is in the
153
of the deployment descriptor file is in the
Lines 176-199 Link Here
176
166
177
<p>Whenever you wish to refresh your development directory to reflect the
167
<p>Whenever you wish to refresh your development directory to reflect the
178
work performed by other developers, you will ask CVS to do it for you:</p>
168
work performed by other developers, you will ask CVS to do it for you:</p>
179
<source>
169
<source><![CDATA[cd {my home directory}
180
cd {my home directory}
181
cd myapp
170
cd myapp
182
cvs update -dP
171
cvs update -dP]]></source>
183
</source>
184
172
185
<p>To create a new file, go to the appropriate directory, create the file,
173
<p>To create a new file, go to the appropriate directory, create the file,
186
and register it with CVS.  When you are satisfied with it's contents (after
174
and register it with CVS.  When you are satisfied with it's contents (after
187
building and testing is successful), commit the new file to the repository.
175
building and testing is successful), commit the new file to the repository.
188
For example, to create a new JSP page:</p>
176
For example, to create a new JSP page:</p>
189
<source>
177
<source><![CDATA[cd {my home directory}
190
cd {my home directory}
178
cd myapp/web        <-- Ultimate destination is document root
191
cd myapp/web        &lt;-- Ultimate destination is document root
192
emacs mypage.jsp
179
emacs mypage.jsp
193
cvs add mypage.jsp
180
cvs add mypage.jsp
194
... build and test the application ...
181
... build and test the application ...
195
cvs commit
182
cvs commit]]></source>
196
</source>
197
183
198
<p>Java source code that is defined in packages must be organized in a
184
<p>Java source code that is defined in packages must be organized in a
199
directory hierarchy (under the <strong>src/</strong> subdirectory) that
185
directory hierarchy (under the <strong>src/</strong> subdirectory) that
Lines 216-226 Link Here
216
<p>When you are ready to compile the application, issue the following
202
<p>When you are ready to compile the application, issue the following
217
commands (generally, you will want a shell window open that is set to
203
commands (generally, you will want a shell window open that is set to
218
the project source directory, so that only the last command is needed):</p>
204
the project source directory, so that only the last command is needed):</p>
219
<source>
205
<source><![CDATA[cd {my home directory}
220
cd {my home directory}
206
cd myapp        <-- Normally leave a window open here
221
cd myapp        &lt;-- Normally leave a window open here
207
ant]]></source>
222
ant
223
</source>
224
208
225
<p>The Ant tool will be execute the default "compile" target in your
209
<p>The Ant tool will be execute the default "compile" target in your
226
<code>build.xml</code> file, which will compile any new or updated Java
210
<code>build.xml</code> file, which will compile any new or updated Java
Lines 228-238 Link Here
228
it will cause everything to be recompiled.</p>
212
it will cause everything to be recompiled.</p>
229
213
230
<p>To force the recompilation of your entire application, do this instead:</p>
214
<p>To force the recompilation of your entire application, do this instead:</p>
231
<source>
215
<source><![CDATA[cd {my home directory}
232
cd {my home directory}
233
cd myapp
216
cd myapp
234
ant all
217
ant all]]></source>
235
</source>
236
218
237
<p>This is a very good habit immediately before checking in changes, to
219
<p>This is a very good habit immediately before checking in changes, to
238
make sure that you have not introduced any subtle problems that Javac's
220
make sure that you have not introduced any subtle problems that Javac's
Lines 248-283 Link Here
248
the sample <code>build.xml</code> script.  Using these commands might follow
230
the sample <code>build.xml</code> script.  Using these commands might follow
249
a pattern like this:</p>
231
a pattern like this:</p>
250
<ul>
232
<ul>
251
<li><em>Start Tomcat if needed</em>.  If Tomcat is not already running,
233
<li><p><em>Start Tomcat if needed</em>.  If Tomcat is not already running,
252
    you will need to start it in the usual way.
234
    you will need to start it in the usual way.
253
    <br/><br/></li>
235
    </p></li>
254
<li><em>Compile your application</em>.  Use the <code>ant compile</code>
236
<li><p><em>Compile your application</em>.  Use the <code>ant compile</code>
255
    command (or just <code>ant</code>, since this is the default).  Make
237
    command (or just <code>ant</code>, since this is the default).  Make
256
    sure that there are no compilation errors.
238
    sure that there are no compilation errors.
257
    <br/><br/></li>
239
    </p></li>
258
<li><em>Install the application</em>.  Use the <code>ant install</code>
240
<li><p><em>Install the application</em>.  Use the <code>ant install</code>
259
    command.  This tells Tomcat to immediately start running your app on
241
    command.  This tells Tomcat to immediately start running your app on
260
    the context path defined in the <code>app.path</code> build property.
242
    the context path defined in the <code>app.path</code> build property.
261
    Tomcat does <strong>NOT</strong> have to be restarted for this to
243
    Tomcat does <strong>NOT</strong> have to be restarted for this to
262
    take effect.<br/><br/></li>
244
    take effect.
263
<li><em>Test the application</em>.  Using your browser or other testing
245
    </p></li>
246
<li><p><em>Test the application</em>.  Using your browser or other testing
264
    tools, test the functionality of your application.
247
    tools, test the functionality of your application.
265
    <br/><br/></li>
248
    </p></li>
266
<li><em>Modify and rebuild as needed</em>.  As you discover that changes
249
<li><p><em>Modify and rebuild as needed</em>.  As you discover that changes
267
    are required, make those changes in the original <strong>source</strong>
250
    are required, make those changes in the original <strong>source</strong>
268
    files, not in the output build directory, and re-issue the
251
    files, not in the output build directory, and re-issue the
269
    <code>ant compile</code> command.  This ensures that your changes will
252
    <code>ant compile</code> command.  This ensures that your changes will
270
    be available to be saved (via <code>cvs commit</code>) later on --
253
    be available to be saved (via <code>cvs commit</code>) later on --
271
    the output build directory is deleted and recreated as necessary.
254
    the output build directory is deleted and recreated as necessary.
272
    <br/><br/></li>
255
    </p></li>
273
<li><em>Reload the application</em>.  Tomcat will recognize changes in
256
<li><p><em>Reload the application</em>.  Tomcat will recognize changes in
274
    JSP pages automatically, but it will continue to use the old versions
257
    JSP pages automatically, but it will continue to use the old versions
275
    of any servlet or JavaBean classes until the application is reloaded.
258
    of any servlet or JavaBean classes until the application is reloaded.
276
    You can trigger this by executing the <code>ant reload</code> command.
259
    You can trigger this by executing the <code>ant reload</code> command.
277
    <br/><br/></li>
260
    </p></li>
278
<li><em>Remove the application when you re done</em>.  When you are through
261
<li><p><em>Remove the application when you are done</em>.  When you are through
279
    working on this application, you can remove it from live execution by
262
    working on this application, you can remove it from live execution by
280
    running the <code>ant remove</code> command.</li>
263
    running the <code>ant remove</code> command.
264
    </p></li>
281
</ul>
265
</ul>
282
266
283
<p>Do not forget to commit your changes to the source code repository when
267
<p>Do not forget to commit your changes to the source code repository when
Lines 293-312 Link Here
293
of your web application that can be deployed on the production server.  The
277
of your web application that can be deployed on the production server.  The
294
following general steps are required:</p>
278
following general steps are required:</p>
295
<ul>
279
<ul>
296
<li>Issue the command <code>ant all</code> from the project source
280
<li><p>Issue the command <code>ant all</code> from the project source
297
    directory, to rebuild everything from scratch one last time.
281
    directory, to rebuild everything from scratch one last time.
298
    <br/><br/></li>
282
    </p></li>
299
<li>Use the <code>cvs tag</code> command to create an identifier for
283
<li><p>Use the <code>cvs tag</code> command to create an identifier for
300
    all of the source files utilized to create this release.  This allows
284
    all of the source files utilized to create this release.  This allows
301
    you to reliably reconstruct a release (from sources) at a later
285
    you to reliably reconstruct a release (from sources) at a later
302
    time.</li>
286
    time.
303
<li>Issue the command <code>ant dist</code> to create a distributable
287
    </p></li>
288
<li><p>Issue the command <code>ant dist</code> to create a distributable
304
    web application archive (WAR) file, as well as a JAR file containing
289
    web application archive (WAR) file, as well as a JAR file containing
305
    the corresponding source code.
290
    the corresponding source code.
306
    <br/><br/></li>
291
    </p></li>
307
<li>Package the contents of the <code>dist</code> directory using the
292
<li><p>Package the contents of the <code>dist</code> directory using the
308
    <strong>tar</strong> or <strong>zip</strong> utility, according to
293
    <strong>tar</strong> or <strong>zip</strong> utility, according to
309
    the standard release procedures used by your organization.</li>
294
    the standard release procedures used by your organization.
295
    </p></li>
310
</ul>
296
</ul>
311
297
312
</subsection>
298
</subsection>
(-)webapps/docs/appdev/source.xml (-17 / +11 lines)
Lines 35-47 Link Here
35
35
36
<section name="Directory Structure">
36
<section name="Directory Structure">
37
37
38
    <blockquote><em>
38
    <p><em>The description below uses the variable name $CATALINA_BASE to refer the
39
    <p>The description below uses the variable name $CATALINA_BASE to refer the
40
    base directory against which most relative paths are resolved. If you have
39
    base directory against which most relative paths are resolved. If you have
41
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
40
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
42
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
41
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
43
    the directory into which you have installed Tomcat.</p>
42
    the directory into which you have installed Tomcat.</em></p>
44
    </em></blockquote>
45
43
46
<p>A key recommendation of this manual is to separate the directory
44
<p>A key recommendation of this manual is to separate the directory
47
hierarchy containing your source code (described in this section) from
45
hierarchy containing your source code (described in this section) from
Lines 49-64 Link Here
49
(described in the preceding section).  Maintaining this separation has
47
(described in the preceding section).  Maintaining this separation has
50
the following advantages:</p>
48
the following advantages:</p>
51
<ul>
49
<ul>
52
<li>The contents of the source directories can be more easily administered,
50
<li><p>The contents of the source directories can be more easily administered,
53
    moved, and backed up if the "executable" version of the application
51
    moved, and backed up if the "executable" version of the application
54
    is not intermixed.
52
    is not intermixed.
55
    <br/><br/></li>
53
    </p></li>
56
<li>Source code control is easier to manage on directories that contain
54
<li><p>Source code control is easier to manage on directories that contain
57
    only source files.
55
    only source files.
58
    <br/><br/></li>
56
    </p></li>
59
<li>The files that make up an installable distribution of your
57
<li><p>The files that make up an installable distribution of your
60
    application are much easier to select when the deployment
58
    application are much easier to select when the deployment
61
    hierarchy is separate.</li>
59
    hierarchy is separate.</p></li>
62
</ul>
60
</ul>
63
61
64
<p>As we will see, the <code>ant</code> development tool makes the creation
62
<p>As we will see, the <code>ant</code> development tool makes the creation
Lines 181-191 Link Here
181
easy way to tell CVS to ignore these directories is to create a file named
179
easy way to tell CVS to ignore these directories is to create a file named
182
<code>.cvsignore</code> (note the leading period) in your top-level source
180
<code>.cvsignore</code> (note the leading period) in your top-level source
183
directory, with the following contents:</p>
181
directory, with the following contents:</p>
184
<source>
182
<source>build
185
build
186
dist
183
dist
187
build.properties
184
build.properties</source>
188
</source>
189
185
190
<p>The reason for mentioning <code>build.properties</code> here will be
186
<p>The reason for mentioning <code>build.properties</code> here will be
191
explained in the <a href="processes.html">Processes</a> section.</p>
187
explained in the <a href="processes.html">Processes</a> section.</p>
Lines 244-252 Link Here
244
the targets that are designed for use by the developer, versus those targets
240
the targets that are designed for use by the developer, versus those targets
245
used internally.  To ask Ant to display the project documentation, change to
241
used internally.  To ask Ant to display the project documentation, change to
246
the directory containing the <code>build.xml</code> file and type:</p>
242
the directory containing the <code>build.xml</code> file and type:</p>
247
<source>
243
<source>ant -projecthelp</source>
248
ant -projecthelp
249
</source>
250
244
251
<p>To give you a head start, a <a href="build.xml.txt">basic build.xml file</a>
245
<p>To give you a head start, a <a href="build.xml.txt">basic build.xml file</a>
252
is provided that you can customize and install in the project source directory
246
is provided that you can customize and install in the project source directory
(-)webapps/docs/architecture/startup.xml (-1 / +1 lines)
Lines 35-46 Link Here
35
<p>
35
<p>
36
This page describes how the Tomcat server starts up.  There are several
36
This page describes how the Tomcat server starts up.  There are several
37
different ways to start tomcat, including:
37
different ways to start tomcat, including:
38
</p>
38
<ul>
39
<ul>
39
  <li>From the command line.</li>
40
  <li>From the command line.</li>
40
  <li>From a Java program as an embedded server.</li>
41
  <li>From a Java program as an embedded server.</li>
41
  <li>Automatically as a Windows service.</li>
42
  <li>Automatically as a Windows service.</li>
42
</ul>
43
</ul>
43
</p>
44
44
45
<subsection name="description">
45
<subsection name="description">
46
<p>
46
<p>
(-)webapps/docs/config/ajp.xml (-18 / +66 lines)
Lines 49-55 Link Here
49
  the <code>jvmRoute</code> attribute of the
49
  the <code>jvmRoute</code> attribute of the
50
  <a href="engine.html">Engine</a>.</p>
50
  <a href="engine.html">Engine</a>.</p>
51
51
52
  <p>The native connectors supported with this Tomcat release are:
52
  <p>The native connectors supported with this Tomcat release are:</p>
53
    <ul>
53
    <ul>
54
      <li>JK 1.2.x with any of the supported servers. See
54
      <li>JK 1.2.x with any of the supported servers. See
55
      <a href="http://tomcat.apache.org/connectors-doc/">the JK docs</a>
55
      <a href="http://tomcat.apache.org/connectors-doc/">the JK docs</a>
Lines 59-65 Link Here
59
      <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html">the
59
      <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html">the
60
      httpd docs</a> for details.</li>
60
      httpd docs</a> for details.</li>
61
    </ul>
61
    </ul>
62
  </p>
63
62
64
  <p><b>Other native connectors supporting AJP may work, but are no longer
63
  <p><b>Other native connectors supporting AJP may work, but are no longer
65
  supported.</b></p>
64
  supported.</b></p>
Lines 178-184 Link Here
178
        <code>org.apache.coyote.ajp.AjpAprProtocol</code>
177
        <code>org.apache.coyote.ajp.AjpAprProtocol</code>
179
        - the APR/native connector.<br/>
178
        - the APR/native connector.<br/>
180
        Custom implementations may also be used.<br/>
179
        Custom implementations may also be used.<br/>
181
        Take a look at our <a href="#Connector Comparison">Connector
180
        Take a look at our <a href="#Connector_Comparison">Connector
182
        Comparison</a> chart.
181
        Comparison</a> chart.
183
      </p>
182
      </p>
184
    </attribute>
183
    </attribute>
Lines 187-193 Link Here
187
      <p>If this <strong>Connector</strong> is being used in a proxy
186
      <p>If this <strong>Connector</strong> is being used in a proxy
188
      configuration, configure this attribute to specify the server name
187
      configuration, configure this attribute to specify the server name
189
      to be returned for calls to <code>request.getServerName()</code>.
188
      to be returned for calls to <code>request.getServerName()</code>.
190
      See <a href="#Proxy Support">Proxy Support</a> for more
189
      See <a href="#Proxy_Support">Proxy Support</a> for more
191
      information.</p>
190
      information.</p>
192
    </attribute>
191
    </attribute>
193
192
Lines 195-201 Link Here
195
      <p>If this <strong>Connector</strong> is being used in a proxy
194
      <p>If this <strong>Connector</strong> is being used in a proxy
196
      configuration, configure this attribute to specify the server port
195
      configuration, configure this attribute to specify the server port
197
      to be returned for calls to <code>request.getServerPort()</code>.
196
      to be returned for calls to <code>request.getServerPort()</code>.
198
      See <a href="#Proxy Support">Proxy Support</a> for more
197
      See <a href="#Proxy_Support">Proxy Support</a> for more
199
      information.</p>
198
      information.</p>
200
    </attribute>
199
    </attribute>
201
200
Lines 667-686 Link Here
667
  <subsection name="Connector Comparison">
666
  <subsection name="Connector Comparison">
668
667
669
    <p>Below is a small chart that shows how the connectors differentiate.</p>
668
    <p>Below is a small chart that shows how the connectors differentiate.</p>
670
    <source>
671
                       Java Blocking Connector   Java Nio Blocking Connector   APR/native Connector
672
                                 BIO                         NIO                       APR
673
    Classname                AjpProtocol               AjpNioProtocol           AjpAprProtocol
674
    Tomcat Version           3.x onwards                 7.x onwards              5.5.x onwards
675
    Support Polling              NO                          YES                       YES
676
    Polling Size                 N/A                   maxConnections             maxConnections
677
    Read Request Headers      Blocking                  Sim Blocking                   Blocking
678
    Read Request Body         Blocking                  Sim Blocking                   Blocking
679
    Write Response            Blocking                  Sim Blocking                   Blocking
680
    Wait for next Request     Blocking                  Non Blocking               Non Blocking
681
    Max Connections        maxConnections              maxConnections             maxConnections
682
669
683
    </source>
670
    <table class="defaultTable" style="text-align: center;">
671
      <tr>
672
        <th />
673
        <th>Java Blocking Connector<br />BIO</th>
674
        <th>Java Nio Blocking Connector<br />NIO</th>
675
        <th>APR/native Connector<br />APR</th>
676
      </tr>
677
      <tr>
678
        <th style="text-align: left;">Classname</th>
679
        <td><code class="noHighlight">AjpProtocol</code></td>
680
        <td><code class="noHighlight">AjpNioProtocol</code></td>
681
        <td><code class="noHighlight">AjpAprProtocol</code></td>
682
      </tr>
683
      <tr>
684
        <th style="text-align: left;">Tomcat Version</th>
685
        <td>3.x onwards</td>
686
        <td>7.x onwards</td>
687
        <td>5.5.x onwards</td>
688
      </tr>
689
      <tr>
690
        <th style="text-align: left;">Support Polling</th>
691
        <td>NO</td>
692
        <td>YES</td>
693
        <td>YES</td>
694
      </tr>
695
      <tr>
696
        <th style="text-align: left;">Polling Size</th>
697
        <td>N/A</td>
698
        <td><code class="noHighlight">maxConnections</code></td>
699
        <td><code class="noHighlight">maxConnections</code></td>
700
      </tr>
701
      <tr>
702
        <th style="text-align: left;">Read Request Headers</th>
703
        <td>Blocking</td>
704
        <td>Sim Blocking</td>
705
        <td>Blocking</td>
706
      </tr>
707
      <tr>
708
        <th style="text-align: left;">Read Request Body</th>
709
        <td>Blocking</td>
710
        <td>Sim Blocking</td>
711
        <td>Blocking</td>
712
      </tr>
713
      <tr>
714
        <th style="text-align: left;">Write Response</th>
715
        <td>Blocking</td>
716
        <td>Sim Blocking</td>
717
        <td>Blocking</td>
718
      </tr>
719
      <tr>
720
        <th style="text-align: left;">Wait for next Request</th>
721
        <td>Blocking</td>
722
        <td>Non Blocking</td>
723
        <td>Non Blocking</td>
724
      </tr>
725
      <tr>
726
        <th style="text-align: left;">Max Connections</th>
727
        <td><code class="noHighlight">maxConnections</code></td>
728
        <td><code class="noHighlight">maxConnections</code></td>
729
        <td><code class="noHighlight">maxConnections</code></td>
730
      </tr>
731
    </table>
684
732
685
  </subsection>
733
  </subsection>
686
734
(-)webapps/docs/config/cluster-interceptor.xml (-15 / +9 lines)
Lines 41-47 Link Here
41
</section>
41
</section>
42
42
43
<section name="Available Interceptors">
43
<section name="Available Interceptors">
44
 <p>
45
   <ul>
44
   <ul>
46
    <li><code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</code></li>
45
    <li><code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</code></li>
47
    <li><code>org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor</code></li>
46
    <li><code>org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor</code></li>
Lines 57-63 Link Here
57
    <li><code>org.apache.catalina.tribes.group.interceptors.GzipInterceptor</code></li>
56
    <li><code>org.apache.catalina.tribes.group.interceptors.GzipInterceptor</code></li>
58
    <li><code>org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor</code></li>
57
    <li><code>org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor</code></li>
59
   </ul>
58
   </ul>
60
 </p>
61
</section>
59
</section>
62
60
63
<section name="Static Membership">
61
<section name="Static Membership">
Lines 67-85 Link Here
67
   underneath the <code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</code> interceptor.
65
   underneath the <code>org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</code> interceptor.
68
   Inside the <code>StaticMembershipInterceptor</code> you can add the static members you wish to have.
66
   Inside the <code>StaticMembershipInterceptor</code> you can add the static members you wish to have.
69
   The <code>TcpFailureDetector</code> will do a health check on the static members,and also monitor them for crashes
67
   The <code>TcpFailureDetector</code> will do a health check on the static members,and also monitor them for crashes
70
   so they will have the same level of notification mechanism as the members that are automatically discovered.
68
   so they will have the same level of notification mechanism as the members that are automatically discovered.</p>
71
   <source>
69
   <source><![CDATA[     <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
72
     &lt;Interceptor className=&quot;org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor&quot;&gt;
70
       <Member className="org.apache.catalina.tribes.membership.StaticMember"
73
       &lt;Member className=&quot;org.apache.catalina.tribes.membership.StaticMember&quot;
71
                  port="5678"
74
                  port=&quot;5678&quot;
72
                  securePort="-1"
75
                  securePort=&quot;-1&quot;
73
                  host="tomcat01.mydomain.com"
76
                  host=&quot;tomcat01.mydomain.com&quot;
74
                  domain="staging-cluster"
77
                  domain=&quot;staging-cluster&quot;
75
                  uniqueId="{0,1,2,3,4,5,6,7,8,9}"/>
78
                  uniqueId=&quot;{0,1,2,3,4,5,6,7,8,9}&quot;/&gt;
76
     </Interceptor>]]></source>
79
     &lt;/Interceptor&gt;
80
81
   </source>
82
  </p>
83
</section>
77
</section>
84
78
85
<section name="Attributes">
79
<section name="Attributes">
(-)webapps/docs/config/cluster-membership.xml (-1 / +1 lines)
Lines 98-104 Link Here
98
      a give time. The default value is <code>3000</code> ms. This means, that if a heartbeat is not received from a
98
      a give time. The default value is <code>3000</code> ms. This means, that if a heartbeat is not received from a
99
      member in that timeframe, the membership component will notify the cluster of this.<br/>
99
      member in that timeframe, the membership component will notify the cluster of this.<br/>
100
      On a high latency network you may wish to increase this value, to protect against false positives.<br/>
100
      On a high latency network you may wish to increase this value, to protect against false positives.<br/>
101
      Apache Tribes also provides a <a href="cluster-interceptor.html#tcpfailuredetector"><code>TcpFailureDetector</code></a> that will
101
      Apache Tribes also provides a <a href="cluster-interceptor.html#org.apache.catalina.tribes.group.interceptors.TcpFailureDetector_Attributes"><code>TcpFailureDetector</code></a> that will
102
      verify a timeout using a TCP connection when a heartbeat timeout has occurred. This protects against false positives.
102
      verify a timeout using a TCP connection when a heartbeat timeout has occurred. This protects against false positives.
103
      </p>
103
      </p>
104
    </attribute>
104
    </attribute>
(-)webapps/docs/config/cluster-sender.xml (-1 / +1 lines)
Lines 147-153 Link Here
147
      <attribute name="soTrafficClass" required="false">
147
      <attribute name="soTrafficClass" required="false">
148
       Sets the traffic class level for the socket, the value is between 0 and 255.
148
       Sets the traffic class level for the socket, the value is between 0 and 255.
149
       Default value is <code>int soTrafficClass = 0x04 | 0x08 | 0x010;</code>
149
       Default value is <code>int soTrafficClass = 0x04 | 0x08 | 0x010;</code>
150
       Different values are defined in <a href="http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#setTrafficClass(int)">
150
       Different values are defined in <a href="http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setTrafficClass(int)">
151
       java.net.Socket#setTrafficClass(int)</a>.
151
       java.net.Socket#setTrafficClass(int)</a>.
152
      </attribute>
152
      </attribute>
153
      <attribute name="tcpNoDelay" required="false">
153
      <attribute name="tcpNoDelay" required="false">
(-)webapps/docs/config/cluster.xml (-15 / +15 lines)
Lines 55-62 Link Here
55
</section>
55
</section>
56
<section name="Context Attribute Replication">
56
<section name="Context Attribute Replication">
57
  <p>To configure context attribute replication, simply do this by swapping out the context implementation
57
  <p>To configure context attribute replication, simply do this by swapping out the context implementation
58
  used for your application context.
58
  used for your application context.</p>
59
    <source>&lt;Context className=&quot;org.apache.catalina.ha.context.ReplicatedContext&quot;/&gt;</source>
59
  <source>&lt;Context className=&quot;org.apache.catalina.ha.context.ReplicatedContext&quot;/&gt;</source>
60
  <p>
60
    This context extends the Tomcat <code><a href="context.html">StandardContext</a></code>
61
    This context extends the Tomcat <code><a href="context.html">StandardContext</a></code>
61
    so all the options from the <a href="context.html">base implementation</a> are valid.
62
    so all the options from the <a href="context.html">base implementation</a> are valid.
62
  </p>
63
  </p>
Lines 64-70 Link Here
64
<section name="Nested Components">
65
<section name="Nested Components">
65
  <p><b><a href="cluster-manager.html">Manager</a>:</b> <br/>
66
  <p><b><a href="cluster-manager.html">Manager</a>:</b> <br/>
66
    The session manager element identifies what kind of session manager is used in this cluster implementation.
67
    The session manager element identifies what kind of session manager is used in this cluster implementation.
67
    This manager configuration is identical to the one you would use in a regular <code><a href="context.html#Nested%20xComponents">&lt;Context&gt;</a></code> configuration.
68
    This manager configuration is identical to the one you would use in a regular <code><a href="context.html#Nested_Components">&lt;Context&gt;</a></code> configuration.
68
    <br/>The default value is the <code>org.apache.catalina.ha.session.DeltaManager</code> that is closely coupled with
69
    <br/>The default value is the <code>org.apache.catalina.ha.session.DeltaManager</code> that is closely coupled with
69
    the <code>SimpleTcpCluster</code> implementation. Other managers like the <code>org.apache.catalina.ha.session.BackupManager</code>
70
    the <code>SimpleTcpCluster</code> implementation. Other managers like the <code>org.apache.catalina.ha.session.BackupManager</code>
70
    are/could be loosely coupled and don't rely on the <code>SimpleTcpCluster</code> for its data replication.
71
    are/could be loosely coupled and don't rely on the <code>SimpleTcpCluster</code> for its data replication.
Lines 113-126 Link Here
113
    <attribute name="channelSendOptions" required="true">
114
    <attribute name="channelSendOptions" required="true">
114
      <p>The Tribes channel send options, default is <code>8</code>.<br/>
115
      <p>The Tribes channel send options, default is <code>8</code>.<br/>
115
         This option is used to set the flag that all messages sent through the
116
         This option is used to set the flag that all messages sent through the
116
         SimpleTcpCluster uses. The flag decides how the messages are sent, and is a simple logical OR.<br/>
117
         SimpleTcpCluster uses. The flag decides how the messages are sent, and is a simple logical OR.</p>
117
118
118
      <source>
119
      <source>int options = Channel.SEND_OPTIONS_ASYNCHRONOUS |
119
        int options= Channel.SEND_OPTIONS_ASYNCHRONOUS |
120
              Channel.SEND_OPTIONS_SYNCHRONIZED_ACK |
120
                     Channel.SEND_OPTIONS_SYNCHRONIZED_ACK |
121
              Channel.SEND_OPTIONS_USE_ACK;</source>
121
                     Channel.SEND_OPTIONS_USE_ACK;
122
      <p>Some of the values are:<br/>
122
      </source>
123
      Some of the values are:<br/>
124
      <code>Channel.SEND_OPTIONS_SYNCHRONIZED_ACK = 0x0004</code><br/>
123
      <code>Channel.SEND_OPTIONS_SYNCHRONIZED_ACK = 0x0004</code><br/>
125
      <code>Channel.SEND_OPTIONS_ASYNCHRONOUS = 0x0008</code><br/>
124
      <code>Channel.SEND_OPTIONS_ASYNCHRONOUS = 0x0008</code><br/>
126
      <code>Channel.SEND_OPTIONS_USE_ACK = 0x0002</code><br/>
125
      <code>Channel.SEND_OPTIONS_USE_ACK = 0x0002</code><br/>
Lines 134-144 Link Here
134
      <p>Sets the start and stop flags for the &lt;Channel&gt; object used by the cluster.
133
      <p>Sets the start and stop flags for the &lt;Channel&gt; object used by the cluster.
135
         The default is <code>Channel.DEFAULT</code> which starts all the channel services, such as
134
         The default is <code>Channel.DEFAULT</code> which starts all the channel services, such as
136
         sender, receiver, multicast sender and multicast receiver.
135
         sender, receiver, multicast sender and multicast receiver.
137
         The following flags are available today:
136
         The following flags are available today:</p>
138
         <source>
137
         <source>Channel.DEFAULT = Channel.SND_RX_SEQ (1) |
139
           Channel.DEFAULT = Channel.SND_RX_SEQ (1)| Channel.SND_TX_SEQ (2)| Channel.MBR_RX_SEQ (4)| Channel.MBR_TX_SEQ (8);
138
                  Channel.SND_TX_SEQ (2) |
140
         </source>
139
                  Channel.MBR_RX_SEQ (4) |
141
         To start a channel without multicasting, you would want to use the value <code>Channel.SND_RX_SEQ | Channel.SND_TX_SEQ</code>
140
                  Channel.MBR_TX_SEQ (8);</source>
141
         <p>To start a channel without multicasting, you would want to use the value <code>Channel.SND_RX_SEQ | Channel.SND_TX_SEQ</code>
142
         that equals to <code>3</code>.
142
         that equals to <code>3</code>.
143
      </p>
143
      </p>
144
    </attribute>
144
    </attribute>
(-)webapps/docs/config/context.xml (-96 / +74 lines)
Lines 35-47 Link Here
35
35
36
<section name="Introduction">
36
<section name="Introduction">
37
37
38
    <blockquote><p><em>
38
    <p><em>
39
    The description below uses the variable name $CATALINA_BASE to refer the
39
    The description below uses the variable name $CATALINA_BASE to refer the
40
    base directory against which most relative paths are resolved. If you have
40
    base directory against which most relative paths are resolved. If you have
41
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
41
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
42
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
42
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
43
    the directory into which you have installed Tomcat.
43
    the directory into which you have installed Tomcat.
44
    </em></p></blockquote>
44
    </em></p>
45
45
46
  <p>The <strong>Context</strong> element represents a <em>web
46
  <p>The <strong>Context</strong> element represents a <em>web
47
  application</em>, which is run within a particular virtual host.
47
  application</em>, which is run within a particular virtual host.
Lines 800-816 Link Here
800
    <a href="host.html">Host</a>, or <a href="context.html">Context</a>
800
    <a href="host.html">Host</a>, or <a href="context.html">Context</a>
801
    by nesting a <a href="valve.html">Valve</a> element like this:</p>
801
    by nesting a <a href="valve.html">Valve</a> element like this:</p>
802
802
803
<source>
803
<source><![CDATA[<Context>
804
&lt;Context&gt;
805
  ...
804
  ...
806
  &lt;Valve className="org.apache.catalina.valves.AccessLogValve"
805
  <Valve className="org.apache.catalina.valves.AccessLogValve"
807
         prefix="localhost_access_log." suffix=".txt"
806
         prefix="localhost_access_log." suffix=".txt"
808
         pattern="common"/&gt;
807
         pattern="common"/>
809
  ...
808
  ...
810
&lt;/Context&gt;
809
</Context>]]></source>
811
</source>
812
810
813
    <p>See <a href="valve.html#Access Log Valve">Access Log Valve</a>
811
    <p>See <a href="valve.html#Access_Log_Valve">Access Log Valve</a>
814
    for more information on the configuration attributes that are
812
    for more information on the configuration attributes that are
815
    supported.</p>
813
    supported.</p>
816
814
Lines 854-877 Link Here
854
    web application as servlet context initialization parameters by nesting
852
    web application as servlet context initialization parameters by nesting
855
    <code>&lt;Parameter&gt;</code> elements inside this element.  For
853
    <code>&lt;Parameter&gt;</code> elements inside this element.  For
856
    example, you can create an initialization parameter like this:</p>
854
    example, you can create an initialization parameter like this:</p>
857
<source>
855
<source><![CDATA[<Context>
858
&lt;Context&gt;
859
  ...
856
  ...
860
  &lt;Parameter name="companyName" value="My Company, Incorporated"
857
  <Parameter name="companyName" value="My Company, Incorporated"
861
         override="false"/&gt;
858
         override="false"/>
862
  ...
859
  ...
863
&lt;/Context&gt;
860
</Context>]]></source>
864
</source>
865
861
866
    <p>This is equivalent to the inclusion of the following element in the
862
    <p>This is equivalent to the inclusion of the following element in the
867
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):
863
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):
868
    </p>
864
    </p>
869
<source>
865
<source><![CDATA[<context-param>
870
&lt;context-param&gt;
866
  <param-name>companyName</param-name>
871
  &lt;param-name&gt;companyName&lt;/param-name&gt;
867
  <param-value>My Company, Incorporated</param-value>
872
  &lt;param-value&gt;My Company, Incorporated&lt;/param-value&gt;
868
</context-param>]]></source>
873
&lt;/context-param&gt;
874
</source>
875
    <p>but does <em>not</em> require modification of the deployment descriptor
869
    <p>but does <em>not</em> require modification of the deployment descriptor
876
    to customize this value.</p>
870
    to customize this value.</p>
877
871
Lines 913-937 Link Here
913
    web application as environment entry resources, by nesting
907
    web application as environment entry resources, by nesting
914
    <code>&lt;Environment&gt;</code> entries inside this element.  For
908
    <code>&lt;Environment&gt;</code> entries inside this element.  For
915
    example, you can create an environment entry like this:</p>
909
    example, you can create an environment entry like this:</p>
916
<source>
910
<source><![CDATA[<Context>
917
&lt;Context&gt;
918
  ...
911
  ...
919
  &lt;Environment name="maxExemptions" value="10"
912
  <Environment name="maxExemptions" value="10"
920
         type="java.lang.Integer" override="false"/&gt;
913
         type="java.lang.Integer" override="false"/>
921
  ...
914
  ...
922
&lt;/Context&gt;
915
</Context>]]></source>
923
</source>
924
916
925
    <p>This is equivalent to the inclusion of the following element in the
917
    <p>This is equivalent to the inclusion of the following element in the
926
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):
918
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):
927
    </p>
919
    </p>
928
<source>
920
<source><![CDATA[<env-entry>
929
&lt;env-entry&gt;
921
  <env-entry-name>maxExemptions</env-entry-name>
930
  &lt;env-entry-name&gt;maxExemptions&lt;/env-entry-name&gt;
922
  <env-entry-value>10</env-entry-value>
931
  &lt;env-entry-value&gt;10&lt;/env-entry-value&gt;
923
  <env-entry-type>java.lang.Integer</env-entry-type>
932
  &lt;env-entry-type&gt;java.lang.Integer&lt;/env-entry-type&gt;
924
</env-entry>]]></source>
933
&lt;/env-entry&gt;
934
</source>
935
    <p>but does <em>not</em> require modification of the deployment descriptor
925
    <p>but does <em>not</em> require modification of the deployment descriptor
936
    to customize this value.</p>
926
    to customize this value.</p>
937
927
Lines 986-998 Link Here
986
    It will be notified about the occurrence of the corresponding
976
    It will be notified about the occurrence of the corresponding
987
    lifecycle events.  Configuration of such a listener looks like this:</p>
977
    lifecycle events.  Configuration of such a listener looks like this:</p>
988
978
989
<source>
979
<source><![CDATA[<Context>
990
&lt;Context&gt;
991
  ...
980
  ...
992
  &lt;Listener className="com.mycompany.mypackage.MyListener" ... &gt;
981
  <Listener className="com.mycompany.mypackage.MyListener" ... >
993
  ...
982
  ...
994
&lt;/Context&gt;
983
</Context>]]></source>
995
</source>
996
984
997
    <p>Note that a Listener can have any number of additional properties
985
    <p>Note that a Listener can have any number of additional properties
998
    that may be configured from this element.  Attribute names are matched
986
    that may be configured from this element.  Attribute names are matched
Lines 1014-1032 Link Here
1014
    not accepted will be rejected with an HTTP "Forbidden" error.
1002
    not accepted will be rejected with an HTTP "Forbidden" error.
1015
    Example filter declarations:</p>
1003
    Example filter declarations:</p>
1016
1004
1017
<source>
1005
<source><![CDATA[<Context>
1018
&lt;Context&gt;
1019
  ...
1006
  ...
1020
  &lt;Valve className="org.apache.catalina.valves.RemoteHostValve"
1007
  <Valve className="org.apache.catalina.valves.RemoteHostValve"
1021
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/&gt;
1008
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/>
1022
  &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
1009
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
1023
         deny="192\.168\.1\.\d+"/&gt;
1010
         deny="192\.168\.1\.\d+"/>
1024
  ...
1011
  ...
1025
&lt;/Context&gt;
1012
</Context>]]></source>
1026
</source>
1027
1013
1028
    <p>See <a href="valve.html#Remote Address Filter">Remote Address Filter</a>
1014
    <p>See <a href="valve.html#Remote_Address_Filter">Remote Address Filter</a>
1029
    and <a href="valve.html#Remote Host Filter">Remote Host Filter</a> for
1015
    and <a href="valve.html#Remote_Host_Filter">Remote Host Filter</a> for
1030
    more information about the configuration options that are supported.</p>
1016
    more information about the configuration options that are supported.</p>
1031
1017
1032
  </subsection>
1018
  </subsection>
Lines 1043-1068 Link Here
1043
    already), and the properties used to configure that object factory.</p>
1029
    already), and the properties used to configure that object factory.</p>
1044
1030
1045
    <p>For example, you can create a resource definition like this:</p>
1031
    <p>For example, you can create a resource definition like this:</p>
1046
<source>
1032
<source><![CDATA[<Context>
1047
&lt;Context&gt;
1048
  ...
1033
  ...
1049
  &lt;Resource name="jdbc/EmployeeDB" auth="Container"
1034
  <Resource name="jdbc/EmployeeDB" auth="Container"
1050
            type="javax.sql.DataSource"
1035
            type="javax.sql.DataSource"
1051
     description="Employees Database for HR Applications"/&gt;
1036
     description="Employees Database for HR Applications"/>
1052
  ...
1037
  ...
1053
&lt;/Context&gt;
1038
</Context>]]></source>
1054
</source>
1055
1039
1056
    <p>This is equivalent to the inclusion of the following element in the
1040
    <p>This is equivalent to the inclusion of the following element in the
1057
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p>
1041
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p>
1058
<source>
1042
<source><![CDATA[<resource-ref>
1059
&lt;resource-ref&gt;
1043
  <description>Employees Database for HR Applications</description>
1060
  &lt;description&gt;Employees Database for HR Applications&lt;/description&gt;
1044
  <res-ref-name>jdbc/EmployeeDB</res-ref-name>
1061
  &lt;res-ref-name&gt;jdbc/EmployeeDB&lt;/res-ref-name&gt;
1045
  <res-ref-type>javax.sql.DataSource</res-ref-type>
1062
  &lt;res-ref-type&gt;javax.sql.DataSource&lt;/res-ref-type&gt;
1046
  <res-auth>Container</res-auth>
1063
  &lt;res-auth&gt;Container&lt;/res-auth&gt;
1047
</resource-ref>]]></source>
1064
&lt;/resource-ref&gt;
1065
</source>
1066
1048
1067
    <p>but does <em>not</em> require modification of the deployment
1049
    <p>but does <em>not</em> require modification of the deployment
1068
    descriptor to customize this value.</p>
1050
    descriptor to customize this value.</p>
Lines 1142-1156 Link Here
1142
     resource.</p>
1124
     resource.</p>
1143
1125
1144
    <p>For example, you can create a resource link like this:</p>
1126
    <p>For example, you can create a resource link like this:</p>
1145
<source>
1127
<source><![CDATA[<Context>
1146
&lt;Context&gt;
1147
  ...
1128
  ...
1148
  &lt;ResourceLink name="linkToGlobalResource"
1129
  <ResourceLink name="linkToGlobalResource"
1149
            global="simpleValue"
1130
            global="simpleValue"
1150
            type="java.lang.Integer"
1131
            type="java.lang.Integer"
1151
  ...
1132
  ...
1152
&lt;/Context&gt;
1133
</Context>]]></source>
1153
</source>
1154
1134
1155
    <p>The valid attributes for a <code>&lt;ResourceLink&gt;</code> element
1135
    <p>The valid attributes for a <code>&lt;ResourceLink&gt;</code> element
1156
    are as follows:</p>
1136
    are as follows:</p>
Lines 1182-1189 Link Here
1182
       two additional attributes to allow a shared data source to be used with different credentials.
1162
       two additional attributes to allow a shared data source to be used with different credentials.
1183
       When these two additional attributes are used in combination with the <code>javax.sql.DataSource</code>
1163
       When these two additional attributes are used in combination with the <code>javax.sql.DataSource</code>
1184
       type, different contexts can share a global data source with different credentials.
1164
       type, different contexts can share a global data source with different credentials.
1185
       Under the hood, what happens is that a call to <a href="http://docs.oracle.com/javase/6/docs/api/javax/sql/DataSource.html#getConnection()"><code>getConnection()</code></a>
1165
       Under the hood, what happens is that a call to <a href="http://docs.oracle.com/javase/7/docs/api/javax/sql/DataSource.html#getConnection()"><code>getConnection()</code></a>
1186
       is simply translated to a call <a href="http://docs.oracle.com/javase/6/docs/api/javax/sql/DataSource.html#getConnection(java.lang.String,%20java.lang.String)">
1166
       is simply translated to a call <a href="http://docs.oracle.com/javase/7/docs/api/javax/sql/DataSource.html#getConnection(java.lang.String,%20java.lang.String)">
1187
       <code>getConnection(username, password)</code></a> on the global data source. This is an easy way to get code to be transparent to what schemas are being used,
1167
       <code>getConnection(username, password)</code></a> on the global data source. This is an easy way to get code to be transparent to what schemas are being used,
1188
       yet be able to control connections (or pools) in the global configuration.
1168
       yet be able to control connections (or pools) in the global configuration.
1189
    </p>
1169
    </p>
Lines 1212-1251 Link Here
1212
but by default this support is disabled and can be enabled by
1192
but by default this support is disabled and can be enabled by
1213
<code>alternateUsernameAllowed</code> attribute. See its documentation
1193
<code>alternateUsernameAllowed</code> attribute. See its documentation
1214
for details.</p>
1194
for details.</p>
1215
<source>
1195
<source><![CDATA[<GlobalNamingResources>
1216
&lt;GlobalNamingResources&gt;
1217
  ...
1196
  ...
1218
  &lt;Resource name=&quot;sharedDataSource&quot;
1197
  <Resource name="sharedDataSource"
1219
            global=&quot;sharedDataSource&quot;
1198
            global="sharedDataSource"
1220
            type=&quot;javax.sql.DataSource&quot;
1199
            type="javax.sql.DataSource"
1221
            factory=&quot;org.apache.tomcat.jdbc.pool.DataSourceFactory&quot;
1200
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
1222
            alternateUsernameAllowed=&quot;true&quot;
1201
            alternateUsernameAllowed="true"
1223
            username=&quot;bar&quot;
1202
            username="bar"
1224
            password=&quot;barpass&quot;
1203
            password="barpass"
1225
            ...
1204
            ...
1226
  ...
1205
  ...
1227
&lt;/GlobalNamingResources&gt;
1206
</GlobalNamingResources>
1228
1207
1229
&lt;Context path=&quot;/foo&quot;...&gt;
1208
<Context path="/foo"...>
1230
  ...
1209
  ...
1231
  &lt;ResourceLink
1210
  <ResourceLink
1232
            name=&quot;appDataSource&quot;
1211
            name="appDataSource"
1233
            global=&quot;sharedDataSource&quot;
1212
            global="sharedDataSource"
1234
            type=&quot;javax.sql.DataSource&quot;
1213
            type="javax.sql.DataSource"
1235
            factory=&quot;org.apache.naming.factory.DataSourceLinkFactory&quot;
1214
            factory="org.apache.naming.factory.DataSourceLinkFactory"
1236
            username=&quot;foo&quot;
1215
            username="foo"
1237
            password=&quot;foopass&quot;
1216
            password="foopass"
1238
  ...
1217
  ...
1239
&lt;/Context&gt;
1218
</Context>
1240
&lt;Context path=&quot;/bar&quot;...&gt;
1219
<Context path="/bar"...>
1241
  ...
1220
  ...
1242
  &lt;ResourceLink
1221
  <ResourceLink
1243
            name=&quot;appDataSource&quot;
1222
            name="appDataSource"
1244
            global=&quot;sharedDataSource&quot;
1223
            global="sharedDataSource"
1245
            type=&quot;javax.sql.DataSource&quot;
1224
            type="javax.sql.DataSource"
1246
  ...
1225
  ...
1247
&lt;/Context&gt;
1226
</Context>]]></source>
1248
</source>
1249
    <p>When a request for <code>getConnection()</code> is made in the
1227
    <p>When a request for <code>getConnection()</code> is made in the
1250
       <code>/foo</code> context, the request is translated into
1228
       <code>/foo</code> context, the request is translated into
1251
       <code>getConnection(&quot;foo&quot;,&quot;foopass&quot;)</code>,
1229
       <code>getConnection(&quot;foo&quot;,&quot;foopass&quot;)</code>,
(-)webapps/docs/config/engine.xml (-22 / +16 lines)
Lines 186-202 Link Here
186
    <a href="host.html">Host</a>, or <a href="context.html">Context</a>
186
    <a href="host.html">Host</a>, or <a href="context.html">Context</a>
187
    by nesting a <a href="valve.html">Valve</a> element like this:</p>
187
    by nesting a <a href="valve.html">Valve</a> element like this:</p>
188
188
189
<source>
189
<source><![CDATA[<Engine name="Standalone" ...>
190
&lt;Engine name="Standalone" ...&gt;
191
  ...
190
  ...
192
  &lt;Valve className="org.apache.catalina.valves.AccessLogValve"
191
  <Valve className="org.apache.catalina.valves.AccessLogValve"
193
         prefix="catalina_access_log." suffix=".txt"
192
         prefix="catalina_access_log." suffix=".txt"
194
         pattern="common"/&gt;
193
         pattern="common"/>
195
  ...
194
  ...
196
&lt;/Engine&gt;
195
</Engine>]]></source>
197
</source>
198
196
199
    <p>See <a href="valve.html#Access Log Valve">Access Log Valve</a>
197
    <p>See <a href="valve.html#Access_Log_Valve">Access Log Valve</a>
200
    for more information on the configuration attributes that are
198
    for more information on the configuration attributes that are
201
    supported.</p>
199
    supported.</p>
202
200
Lines 213-225 Link Here
213
    it will be notified about the occurrence of the corresponding
211
    it will be notified about the occurrence of the corresponding
214
    lifecycle events.  Configuration of such a listener looks like this:</p>
212
    lifecycle events.  Configuration of such a listener looks like this:</p>
215
213
216
<source>
214
<source><![CDATA[<Engine name="Standalone" ...>
217
&lt;Engine name="Standalone" ...&gt;
218
  ...
215
  ...
219
  &lt;Listener className="com.mycompany.mypackage.MyListener" ... &gt;
216
  <Listener className="com.mycompany.mypackage.MyListener" ... >
220
  ...
217
  ...
221
&lt;/Engine&gt;
218
</Engine>]]></source>
222
</source>
223
219
224
    <p>Note that a Listener can have any number of additional properties
220
    <p>Note that a Listener can have any number of additional properties
225
    that may be configured from this element.  Attribute names are matched
221
    that may be configured from this element.  Attribute names are matched
Lines 241-259 Link Here
241
    not accepted will be rejected with an HTTP "Forbidden" error.
237
    not accepted will be rejected with an HTTP "Forbidden" error.
242
    Example filter declarations:</p>
238
    Example filter declarations:</p>
243
239
244
<source>
240
<source><![CDATA[<Engine name="Standalone" ...>
245
&lt;Engine name="Standalone" ...&gt;
246
  ...
241
  ...
247
  &lt;Valve className="org.apache.catalina.valves.RemoteHostValve"
242
  <Valve className="org.apache.catalina.valves.RemoteHostValve"
248
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/&gt;
243
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/>
249
  &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
244
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
250
         deny="192\.168\.1\.\d+"/&gt;
245
         deny="192\.168\.1\.\d+"/>
251
  ...
246
  ...
252
&lt;/Engine&gt;
247
</Engine>]]></source>
253
</source>
254
248
255
  <p>See <a href="valve.html#Remote Address Filter">Remote Address Filter</a>
249
  <p>See <a href="valve.html#Remote_Address_Filter">Remote Address Filter</a>
256
  and <a href="valve.html#Remote Host Filter">Remote Host Filter</a> for
250
  and <a href="valve.html#Remote_Host_Filter">Remote Host Filter</a> for
257
  more information about the configuration options that are supported.</p>
251
  more information about the configuration options that are supported.</p>
258
252
259
  </subsection>
253
  </subsection>
(-)webapps/docs/config/filter.xml (-310 / +273 lines)
Lines 40-52 Link Here
40
  web applications by configuring them in the application's
40
  web applications by configuring them in the application's
41
  <code>WEB-INF/web.xml</code>. Each filter is described below.</p>
41
  <code>WEB-INF/web.xml</code>. Each filter is described below.</p>
42
42
43
    <blockquote><em>
43
    <p><em>This description uses the variable name $CATALINA_BASE to refer the
44
    <p>This description uses the variable name $CATALINA_BASE to refer the
45
    base directory against which most relative paths are resolved. If you have
44
    base directory against which most relative paths are resolved. If you have
46
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
45
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
47
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
46
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
48
    the directory into which you have installed Tomcat.</p>
47
    the directory into which you have installed Tomcat.</em></p>
49
    </em></blockquote>
50
48
51
</section>
49
</section>
52
50
Lines 110-125 Link Here
110
    <a href="../images/cors-flowchart.png">flowchart</a> that
108
    <a href="../images/cors-flowchart.png">flowchart</a> that
111
    demonstrates request processing by this filter is available.</p>
109
    demonstrates request processing by this filter is available.</p>
112
    <p>The minimal configuration required to use this filter is:</p>
110
    <p>The minimal configuration required to use this filter is:</p>
113
    <source>
111
    <source><![CDATA[<filter>
114
&lt;filter&gt;
112
  <filter-name>CorsFilter</filter-name>
115
  &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
113
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
116
  &lt;filter-class&gt;org.apache.catalina.filters.CorsFilter&lt;/filter-class&gt;
114
</filter>
117
&lt;/filter&gt;
115
<filter-mapping>
118
&lt;filter-mapping&gt;
116
  <filter-name>CorsFilter</filter-name>
119
  &lt;filter-name>CorsFilter&lt;/filter-name&gt;
117
  <url-pattern>/*</url-pattern>
120
  &lt;url-pattern>/*&lt;/url-pattern&gt;
118
</filter-mapping>]]></source>
121
&lt;/filter-mapping&gt;
122
    </source>
123
  </subsection>
119
  </subsection>
124
  <subsection name="Filter Class Name">
120
  <subsection name="Filter Class Name">
125
    <p>The filter class name for the CORS Filter is
121
    <p>The filter class name for the CORS Filter is
Lines 185-224 Link Here
185
    </attributes>
181
    </attributes>
186
    <p>Here's an example of a more advanced configuration, that overrides
182
    <p>Here's an example of a more advanced configuration, that overrides
187
    defaults:</p>
183
    defaults:</p>
188
    <source>
184
    <source><![CDATA[<filter>
189
&lt;filter&gt;
185
  <filter-name>CorsFilter</filter-name>
190
  &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
186
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
191
  &lt;filter-class&gt;org.apache.catalina.filters.CorsFilter&lt;/filter-class&gt;
187
  <init-param>
192
  &lt;init-param&gt;
188
    <param-name>cors.allowed.origins</param-name>
193
    &lt;param-name&gt;cors.allowed.origins&lt;/param-name&gt;
189
    <param-value>*</param-value>
194
    &lt;param-value&gt;*&lt;/param-value&gt;
190
  </init-param>
195
  &lt;/init-param&gt;
191
  <init-param>
196
  &lt;init-param&gt;
192
    <param-name>cors.allowed.methods</param-name>
197
    &lt;param-name&gt;cors.allowed.methods&lt;/param-name&gt;
193
    <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
198
    &lt;param-value&gt;GET,POST,HEAD,OPTIONS,PUT&lt;/param-value&gt;
194
  </init-param>
199
  &lt;/init-param&gt;
195
  <init-param>
200
  &lt;init-param&gt;
196
    <param-name>cors.allowed.headers</param-name>
201
    &lt;param-name&gt;cors.allowed.headers&lt;/param-name&gt;
197
    <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
202
    &lt;param-value&gt;Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers&lt;/param-value&gt;
198
  </init-param>
203
  &lt;/init-param&gt;
199
  <init-param>
204
  &lt;init-param&gt;
200
    <param-name>cors.exposed.headers</param-name>
205
    &lt;param-name&gt;cors.exposed.headers&lt;/param-name&gt;
201
    <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
206
    &lt;param-value&gt;Access-Control-Allow-Origin,Access-Control-Allow-Credentials&lt;/param-value&gt;
202
  </init-param>
207
  &lt;/init-param&gt;
203
  <init-param>
208
  &lt;init-param&gt;
204
    <param-name>cors.support.credentials</param-name>
209
    &lt;param-name&gt;cors.support.credentials&lt;/param-name&gt;
205
    <param-value>true</param-value>
210
    &lt;param-value&gt;true&lt;/param-value&gt;
206
  </init-param>
211
  &lt;/init-param&gt;
207
  <init-param>
212
  &lt;init-param&gt;
208
    <param-name>cors.preflight.maxage</param-name>
213
    &lt;param-name&gt;cors.preflight.maxage&lt;/param-name&gt;
209
    <param-value>10</param-value>
214
    &lt;param-value&gt;10&lt;/param-value&gt;
210
  </init-param>
215
  &lt;/init-param&gt;
211
</filter>
216
&lt;/filter&gt;
212
<filter-mapping>
217
&lt;filter-mapping&gt;
213
  <filter-name>CorsFilter</filter-name>
218
  &lt;filter-name&gt;CorsFilter&lt;/filter-name&gt;
214
  <url-pattern>/*</url-pattern>
219
  &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
215
</filter-mapping>]]></source>
220
&lt;/filter-mapping&gt;
221
    </source>
222
  </subsection>
216
  </subsection>
223
  <subsection name="CORS Filter and HttpServletRequest attributes">
217
  <subsection name="CORS Filter and HttpServletRequest attributes">
224
    <p>CORS Filter adds information about the request, in HttpServletRequest
218
    <p>CORS Filter adds information about the request, in HttpServletRequest
Lines 353-384 Link Here
353
    headers to images, css and javascript.
347
    headers to images, css and javascript.
354
    </p>
348
    </p>
355
349
356
    <source>
350
    <source><![CDATA[<filter>
357
&lt;filter&gt;
351
 <filter-name>ExpiresFilter</filter-name>
358
 &lt;filter-name&gt;ExpiresFilter&lt;/filter-name&gt;
352
 <filter-class>org.apache.catalina.filters.ExpiresFilter</filter-class>
359
 &lt;filter-class&gt;org.apache.catalina.filters.ExpiresFilter&lt;/filter-class&gt;
353
 <init-param>
360
 &lt;init-param&gt;
354
    <param-name>ExpiresByType image</param-name>
361
    &lt;param-name&gt;ExpiresByType image&lt;/param-name&gt;
355
    <param-value>access plus 10 minutes</param-value>
362
    &lt;param-value&gt;access plus 10 minutes&lt;/param-value&gt;
356
 </init-param>
363
 &lt;/init-param&gt;
357
 <init-param>
364
 &lt;init-param&gt;
358
    <param-name>ExpiresByType text/css</param-name>
365
    &lt;param-name&gt;ExpiresByType text/css&lt;/param-name&gt;
359
    <param-value>access plus 10 minutes</param-value>
366
    &lt;param-value&gt;access plus 10 minutes&lt;/param-value&gt;
360
 </init-param>
367
 &lt;/init-param&gt;
361
 <init-param>
368
 &lt;init-param&gt;
362
    <param-name>ExpiresByType application/javascript</param-name>
369
    &lt;param-name&gt;ExpiresByType application/javascript&lt;/param-name&gt;
363
    <param-value>access plus 10 minutes</param-value>
370
    &lt;param-value&gt;access plus 10 minutes&lt;/param-value&gt;
364
 </init-param>
371
 &lt;/init-param&gt;
365
</filter>
372
&lt;/filter&gt;
373
...
366
...
374
&lt;filter-mapping&gt;
367
<filter-mapping>
375
 &lt;filter-name&gt;ExpiresFilter&lt;/filter-name&gt;
368
 <filter-name>ExpiresFilter</filter-name>
376
 &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
369
 <url-pattern>/*</url-pattern>
377
 &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
370
 <dispatcher>REQUEST</dispatcher>
378
&lt;/filter-mapping&gt;
371
</filter-mapping>]]></source>
379
372
380
    </source>
381
382
  </subsection>
373
  </subsection>
383
374
384
  <subsection name="Alternate Syntax">
375
  <subsection name="Alternate Syntax">
Lines 387-420 Link Here
387
    defined in a more readable syntax of the form:
378
    defined in a more readable syntax of the form:
388
    </p>
379
    </p>
389
380
390
    <source>
381
    <source><![CDATA[<init-param>
391
&lt;init-param&gt;
382
 <param-name>ExpiresDefault</param-name>
392
 &lt;param-name&gt;ExpiresDefault&lt;/param-name&gt;
383
 <param-value><base> [plus] {<num>   <type>}*</param-value>
393
 &lt;param-value&gt;&lt;base&gt; [plus] {&lt;num&gt;   &lt;type&gt;}*&lt;/param-value&gt;
384
</init-param>
394
&lt;/init-param&gt;
395
385
396
&lt;init-param&gt;
386
<init-param>
397
 &lt;param-name&gt;ExpiresByType type&lt;/param-name&gt;
387
 <param-name>ExpiresByType type</param-name>
398
 &lt;param-value&gt;&lt;base&gt; [plus]   {&lt;num&gt; &lt;type&gt;}*&lt;/param-value&gt;
388
 <param-value><base> [plus]   {<num> <type>}*</param-value>
399
&lt;/init-param&gt;
389
</init-param>
400
390
401
&lt;init-param&gt;
391
<init-param>
402
 &lt;param-name&gt;ExpiresByType type;encoding&lt;/param-name&gt;
392
 <param-name>ExpiresByType type;encoding</param-name>
403
 &lt;param-value&gt;&lt;base&gt; [plus]   {&lt;num&gt; &lt;type&gt;}*&lt;/param-value&gt;
393
 <param-value><base> [plus]   {<num> <type>}*</param-value>
404
&lt;/init-param&gt;
394
</init-param>]]></source>
405
    </source>
406
    <p>
395
    <p>
407
    where <code>&lt;base&gt;</code> is one of:
396
    where <code>&lt;base&gt;</code> is one of:
397
    </p>
408
    <ul>
398
    <ul>
409
    <li><code>access</code></li>
399
    <li><code>access</code></li>
410
    <li><code>now</code> (equivalent to &#x27;<code>access</code>&#x27;)</li>
400
    <li><code>now</code> (equivalent to &#x27;<code>access</code>&#x27;)</li>
411
    <li><code>modification</code></li>
401
    <li><code>modification</code></li>
412
    </ul>
402
    </ul>
413
    </p>
403
414
    <p>
404
    <p>
415
    The <code>plus</code> keyword is optional. <code>&lt;num&gt;</code> should be an
405
    The <code>plus</code> keyword is optional. <code>&lt;num&gt;</code> should be an
416
    integer value (acceptable to <code>Integer.parseInt()</code>), and
406
    integer value (acceptable to <code>Integer.parseInt()</code>), and
417
    <code>&lt;type&gt;</code> is one of:
407
    <code>&lt;type&gt;</code> is one of:
408
    </p>
418
    <ul>
409
    <ul>
419
    <li><code>years</code></li>
410
    <li><code>years</code></li>
420
    <li><code>months</code></li>
411
    <li><code>months</code></li>
Lines 424-465 Link Here
424
    <li><code>minutes</code></li>
415
    <li><code>minutes</code></li>
425
    <li><code>seconds</code></li>
416
    <li><code>seconds</code></li>
426
    </ul>
417
    </ul>
418
    <p>
427
    For example, any of the following directives can be used to make documents
419
    For example, any of the following directives can be used to make documents
428
    expire 1 month after being accessed, by default:
420
    expire 1 month after being accessed, by default:
429
    </p>
421
    </p>
430
422
431
    <source>
423
    <source><![CDATA[<init-param>
432
&lt;init-param&gt;
424
 <param-name>ExpiresDefault</param-name>
433
 &lt;param-name&gt;ExpiresDefault&lt;/param-name&gt;
425
 <param-value>access plus 1 month</param-value>
434
 &lt;param-value&gt;access plus 1 month&lt;/param-value&gt;
426
</init-param>
435
&lt;/init-param&gt;
436
427
437
&lt;init-param&gt;
428
<init-param>
438
 &lt;param-name&gt;ExpiresDefault&lt;/param-name&gt;
429
 <param-name>ExpiresDefault</param-name>
439
 &lt;param-value&gt;access plus 4 weeks&lt;/param-value&gt;
430
 <param-value>access plus 4 weeks</param-value>
440
&lt;/init-param&gt;
431
</init-param>
441
432
442
&lt;init-param&gt;
433
<init-param>
443
 &lt;param-name&gt;ExpiresDefault&lt;/param-name&gt;
434
 <param-name>ExpiresDefault</param-name>
444
 &lt;param-value&gt;access plus 30 days&lt;/param-value&gt;
435
 <param-value>access plus 30 days</param-value>
445
&lt;/init-param&gt;
436
</init-param>]]></source>
446
</source>
447
<p>
437
<p>
448
The expiry time can be fine-tuned by adding several &#x27;
438
The expiry time can be fine-tuned by adding several &#x27;
449
<code>&lt;num&gt; &lt;type&gt;</code>&#x27; clauses:
439
<code>&lt;num&gt; &lt;type&gt;</code>&#x27; clauses:
450
</p>
440
</p>
451
441
452
<source>
442
<source><![CDATA[<init-param>
453
&lt;init-param&gt;
443
 <param-name>ExpiresByType text/html</param-name>
454
 &lt;param-name&gt;ExpiresByType text/html&lt;/param-name&gt;
444
 <param-value>access plus 1 month 15   days 2 hours</param-value>
455
 &lt;param-value&gt;access plus 1 month 15   days 2 hours&lt;/param-value&gt;
445
</init-param>
456
&lt;/init-param&gt;
457
446
458
&lt;init-param&gt;
447
<init-param>
459
 &lt;param-name&gt;ExpiresByType image/gif&lt;/param-name&gt;
448
 <param-name>ExpiresByType image/gif</param-name>
460
 &lt;param-value&gt;modification plus 5 hours 3   minutes&lt;/param-value&gt;
449
 <param-value>modification plus 5 hours 3   minutes</param-value>
461
&lt;/init-param&gt;
450
</init-param>]]></source>
462
    </source>
463
    <p>
451
    <p>
464
    Note that if you use a modification date based setting, the <code>Expires</code>
452
    Note that if you use a modification date based setting, the <code>Expires</code>
465
    header will <strong>not</strong> be added to content that does not come from
453
    header will <strong>not</strong> be added to content that does not come from
Lines 471-476 Link Here
471
  <subsection name="Expiration headers generation eligibility">
459
  <subsection name="Expiration headers generation eligibility">
472
    <p>
460
    <p>
473
    A response is eligible to be enriched by <code>ExpiresFilter</code> if :
461
    A response is eligible to be enriched by <code>ExpiresFilter</code> if :
462
    </p>
474
    <ol>
463
    <ol>
475
    <li>no expiration header is defined (<code>Expires</code> header or the
464
    <li>no expiration header is defined (<code>Expires</code> header or the
476
    <code>max-age</code> directive of the <code>Cache-Control</code> header),</li>
465
    <code>max-age</code> directive of the <code>Cache-Control</code> header),</li>
Lines 480-486 Link Here
480
    defined the in <code>ExpiresByType</code> directives or the
469
    defined the in <code>ExpiresByType</code> directives or the
481
    <code>ExpiresDefault</code> directive is defined.</li>
470
    <code>ExpiresDefault</code> directive is defined.</li>
482
    </ol>
471
    </ol>
483
    </p>
472
484
    <p>
473
    <p>
485
    Note : If <code>Cache-Control</code> header contains other directives than
474
    Note : If <code>Cache-Control</code> header contains other directives than
486
    <code>max-age</code>, they are concatenated with the <code>max-age</code> directive
475
    <code>max-age</code>, they are concatenated with the <code>max-age</code> directive
Lines 492-497 Link Here
492
  <subsection name="Expiration configuration selection">
481
  <subsection name="Expiration configuration selection">
493
    <p>
482
    <p>
494
    The expiration configuration if elected according to the following algorithm:
483
    The expiration configuration if elected according to the following algorithm:
484
    </p>
495
    <ol>
485
    <ol>
496
    <li><code>ExpiresByType</code> matching the exact content-type returned by
486
    <li><code>ExpiresByType</code> matching the exact content-type returned by
497
    <code>HttpServletResponse.getContentType()</code> possibly including the charset
487
    <code>HttpServletResponse.getContentType()</code> possibly including the charset
Lines 505-511 Link Here
505
    &#x27;),</li>
495
    &#x27;),</li>
506
    <li><code>ExpiresDefault</code></li>
496
    <li><code>ExpiresDefault</code></li>
507
    </ol>
497
    </ol>
508
    </p>
498
509
  </subsection>
499
  </subsection>
510
500
511
  <subsection name="Filter Class Name">
501
  <subsection name="Filter Class Name">
Lines 600-628 Link Here
600
      </attribute>
590
      </attribute>
601
    </attributes>
591
    </attributes>
602
592
603
    <p><i>Sample : exclude response status codes 302, 500 and 503</i></p>
593
    <p><i>Sample: exclude response status codes 302, 500 and 503</i></p>
604
594
605
<source>
595
<source><![CDATA[<init-param>
606
&lt;init-param&gt;
596
 <param-name>ExpiresExcludedResponseStatusCodes</param-name>
607
 &lt;param-name&gt;ExpiresExcludedResponseStatusCodes&lt;/param-name&gt;
597
 <param-value>302, 500, 503</param-value>
608
 &lt;param-value&gt;302, 500, 503&lt;/param-value&gt;
598
</init-param>]]></source>
609
&lt;/init-param&gt;
610
</source>
611
599
612
    <p><i>Sample for ExpiresByType initialization parameter</i></p>
600
    <p><i>Sample for ExpiresByType initialization parameter</i></p>
613
601
614
         <source>
602
         <source><![CDATA[<init-param>
615
&lt;init-param&gt;
603
   <param-name>ExpiresByType text/html</param-name>
616
   &lt;param-name&gt;ExpiresByType text/html&lt;/param-name&gt;
604
   <param-value>access plus 1 month 15   days 2 hours</param-value>
617
   &lt;param-value&gt;access plus 1 month 15   days 2 hours&lt;/param-value&gt;
605
</init-param>
618
&lt;/init-param&gt;
619
606
620
&lt;init-param&gt;
607
<init-param>
621
   &lt;!-- 2592000 seconds = 30 days --&gt;
608
   <!-- 2592000 seconds = 30 days -->
622
   &lt;param-name&gt;ExpiresByType image/gif&lt;/param-name&gt;
609
   <param-name>ExpiresByType image/gif</param-name>
623
   &lt;param-value&gt;A2592000&lt;/param-value&gt;
610
   <param-value>A2592000</param-value>
624
&lt;/init-param&gt;
611
</init-param>]]></source>
625
         </source>
626
612
627
  </subsection>
613
  </subsection>
628
614
Lines 635-649 Link Here
635
    Extract of logging.properties
621
    Extract of logging.properties
636
    </p>
622
    </p>
637
623
638
    <source>
624
    <source>org.apache.catalina.filters.ExpiresFilter.level = FINE    </source>
639
org.apache.catalina.filters.ExpiresFilter.level = FINE
640
    </source>
641
    <p>
625
    <p>
642
    Sample of initialization log message:
626
    Sample of initialization log message:
643
    </p>
627
    </p>
644
628
645
    <source>
629
    <source>Mar 26, 2010 2:01:41 PM org.apache.catalina.filters.ExpiresFilter init
646
Mar 26, 2010 2:01:41 PM org.apache.catalina.filters.ExpiresFilter init
647
FINE: Filter initialized with configuration ExpiresFilter[
630
FINE: Filter initialized with configuration ExpiresFilter[
648
 excludedResponseStatusCode=[304],
631
 excludedResponseStatusCode=[304],
649
 default=null,
632
 default=null,
Lines 650-657 Link Here
650
 byType={
633
 byType={
651
    image=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 MINUTE]],
634
    image=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 MINUTE]],
652
    text/css=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 MINUTE]],
635
    text/css=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 MINUTE]],
653
    text/javascript=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 MINUTE]]}]
636
    text/javascript=ExpiresConfiguration[startingPoint=ACCESS_TIME, duration=[10 MINUTE]]}]</source>
654
    </source>
655
    <p>
637
    <p>
656
    Sample of per-request log message where <code>ExpiresFilter</code> adds an
638
    Sample of per-request log message where <code>ExpiresFilter</code> adds an
657
    expiration date is below. The message is on one line and is wrapped here
639
    expiration date is below. The message is on one line and is wrapped here
Lines 658-678 Link Here
658
    for better readability.
640
    for better readability.
659
    </p>
641
    </p>
660
642
661
    <source>
643
    <source>Mar 26, 2010 2:09:47 PM org.apache.catalina.filters.ExpiresFilter onBeforeWriteResponseBody
662
Mar 26, 2010 2:09:47 PM org.apache.catalina.filters.ExpiresFilter onBeforeWriteResponseBody
663
FINE: Request "/tomcat.gif" with response status "200"
644
FINE: Request "/tomcat.gif" with response status "200"
664
 content-type "image/gif", set expiration date 3/26/10 2:19 PM
645
 content-type "image/gif", set expiration date 3/26/10 2:19 PM</source>
665
    </source>
666
    <p>
646
    <p>
667
    Sample of per-request log message where <code>ExpiresFilter</code> does not add
647
    Sample of per-request log message where <code>ExpiresFilter</code> does not add
668
    an expiration date:
648
    an expiration date:
669
    </p>
649
    </p>
670
650
671
    <source>
651
    <source>Mar 26, 2010 2:10:27 PM org.apache.catalina.filters.ExpiresFilter onBeforeWriteResponseBody
672
Mar 26, 2010 2:10:27 PM org.apache.catalina.filters.ExpiresFilter onBeforeWriteResponseBody
673
FINE: Request "/docs/config/manager.html" with response status "200"
652
FINE: Request "/docs/config/manager.html" with response status "200"
674
 content-type "text/html", no expiration configured
653
 content-type "text/html", no expiration configured</source>
675
    </source>
676
  </subsection>
654
  </subsection>
677
655
678
</section>
656
</section>
Lines 789-808 Link Here
789
767
790
  <subsection name="Example">
768
  <subsection name="Example">
791
    <p>To allow access only for the clients connecting from localhost:</p>
769
    <p>To allow access only for the clients connecting from localhost:</p>
792
<source>
770
<source><![CDATA[    <filter>
793
    &lt;filter>
771
      <filter-name>Remote Address Filter</filter-name>
794
      &lt;filter-name>Remote Address Filter&lt;/filter-name>
772
      <filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class>
795
      &lt;filter-class>org.apache.catalina.filters.RemoteAddrFilter&lt;/filter-class>
773
      <init-param>
796
      &lt;init-param>
774
        <param-name>allow</param-name>
797
        &lt;param-name>allow&lt;/param-name>
775
        <param-value>127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1</param-value>
798
        &lt;param-value>127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1&lt;/param-value>
776
      </init-param>
799
      &lt;/init-param>
777
    </filter>
800
    &lt;/filter>
778
    <filter-mapping>
801
    &lt;filter-mapping>
779
      <filter-name>Remote Address Filter</filter-name>
802
      &lt;filter-name>Remote Address Filter&lt;/filter-name>
780
      <url-pattern>/*</url-pattern>
803
      &lt;url-pattern>/*&lt;/url-pattern>
781
    </filter-mapping>]]></source>
804
    &lt;/filter-mapping>
805
</source>
806
  </subsection>
782
  </subsection>
807
783
808
</section>
784
</section>
Lines 930-947 Link Here
930
    <p>
906
    <p>
931
    The filter will process the <code>x-forwarded-for</code> http header.
907
    The filter will process the <code>x-forwarded-for</code> http header.
932
    </p>
908
    </p>
933
    <source>
909
    <source><![CDATA[      <filter>
934
      &lt;filter&gt;
910
        <filter-name>RemoteIpFilter</filter-name>
935
        &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
911
        <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
936
        &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
912
      </filter>
937
      &lt;/filter&gt;
938
913
939
      &lt;filter-mapping&gt;
914
      <filter-mapping>
940
        &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
915
        <filter-name>RemoteIpFilter</filter-name>
941
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
916
        <url-pattern>/*</url-pattern>
942
        &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
917
        <dispatcher>REQUEST</dispatcher>
943
      &lt;/filter-mapping&gt;
918
      </filter-mapping>]]></source>
944
    </source>
945
  </subsection>
919
  </subsection>
946
920
947
  <subsection name="Basic configuration to handle &#x27;x-forwarded-for&#x27; and &#x27;x-forwarded-proto&#x27;">
921
  <subsection name="Basic configuration to handle &#x27;x-forwarded-for&#x27; and &#x27;x-forwarded-proto&#x27;">
Lines 951-1004 Link Here
951
    <code>x-forwarded-proto</code> http headers. Expected value for the
925
    <code>x-forwarded-proto</code> http headers. Expected value for the
952
    <code>x-forwarded-proto</code> header in case of SSL connections is
926
    <code>x-forwarded-proto</code> header in case of SSL connections is
953
    <code>https</code> (case insensitive). </p>
927
    <code>https</code> (case insensitive). </p>
954
    <source>
928
    <source><![CDATA[      <filter>
955
      &lt;filter&gt;
929
        <filter-name>RemoteIpFilter</filter-name>
956
        &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
930
        <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
957
        &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
931
        <init-param>
958
        &lt;init-param&gt;
932
          <param-name>protocolHeader</param-name>
959
          &lt;param-name&gt;protocolHeader&lt;/param-name&gt;
933
          <param-value>x-forwarded-proto</param-value>
960
          &lt;param-value&gt;x-forwarded-proto&lt;/param-value&gt;
934
        </init-param>
961
        &lt;/init-param&gt;
935
      </filter>
962
      &lt;/filter&gt;
963
936
964
      &lt;filter-mapping&gt;
937
      <filter-mapping>
965
        &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
938
        <filter-name>RemoteIpFilter</filter-name>
966
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
939
        <url-pattern>/*</url-pattern>
967
        &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
940
        <dispatcher>REQUEST</dispatcher>
968
      &lt;/filter-mapping&gt;
941
      </filter-mapping>]]></source>
969
    </source>
970
  </subsection>
942
  </subsection>
971
943
972
  <subsection name="Advanced configuration with internal proxies">
944
  <subsection name="Advanced configuration with internal proxies">
973
    <p>RemoteIpFilter configuration: </p>
945
    <p>RemoteIpFilter configuration: </p>
974
    <source>
946
    <source><![CDATA[     <filter>
975
     &lt;filter&gt;
947
       <filter-name>RemoteIpFilter</filter-name>
976
       &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
948
       <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
977
       &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
949
       <init-param>
978
       &lt;init-param&gt;
950
         <param-name>allowedInternalProxies</param-name>
979
         &lt;param-name&gt;allowedInternalProxies&lt;/param-name&gt;
951
         <param-value>192\.168\.0\.10|192\.168\.0\.11</param-value>
980
         &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
952
       </init-param>
981
       &lt;/init-param&gt;
953
       <init-param>
982
       &lt;init-param&gt;
954
         <param-name>remoteIpHeader</param-name>
983
         &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
955
         <param-value>x-forwarded-for</param-value>
984
         &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
956
       </init-param>
985
       &lt;/init-param&gt;
957
       <init-param>
986
       &lt;init-param&gt;
958
         <param-name>remoteIpProxiesHeader</param-name>
987
         &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
959
         <param-value>x-forwarded-by</param-value>
988
         &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
960
       </init-param>
989
       &lt;/init-param&gt;
961
       <init-param>
990
       &lt;init-param&gt;
962
         <param-name>protocolHeader</param-name>
991
         &lt;param-name&gt;protocolHeader&lt;/param-name&gt;
963
         <param-value>x-forwarded-proto</param-value>
992
         &lt;param-value&gt;x-forwarded-proto&lt;/param-value&gt;
964
       </init-param>
993
       &lt;/init-param&gt;
965
     </filter>]]></source>
994
     &lt;/filter&gt;
966
    <p>Request values:</p>
995
    </source>
967
    <table class="defaultTable">
996
    <p>Request values:
997
    <table border="1" cellpadding="5">
998
      <tr>
968
      <tr>
999
        <th bgcolor="#023264"><font color="#ffffff">Property</font></th>
969
        <th>Property</th>
1000
        <th bgcolor="#023264"><font color="#ffffff">Value Before RemoteIpFilter</font></th>
970
        <th>Value Before RemoteIpFilter</th>
1001
        <th bgcolor="#023264"><font color="#ffffff">Value After RemoteIpFilter</font></th>
971
        <th>Value After RemoteIpFilter</th>
1002
      </tr>
972
      </tr>
1003
      <tr>
973
      <tr>
1004
        <td> request.remoteAddr </td>
974
        <td> request.remoteAddr </td>
Lines 1036-1042 Link Here
1036
        <td> 443 </td>
1006
        <td> 443 </td>
1037
      </tr>
1007
      </tr>
1038
    </table>
1008
    </table>
1039
    </p>
1009
1040
    <p>
1010
    <p>
1041
    Note : <code>x-forwarded-by</code> header is <code>null</code> because only
1011
    Note : <code>x-forwarded-by</code> header is <code>null</code> because only
1042
    internal proxies has been traversed by the request.
1012
    internal proxies has been traversed by the request.
Lines 1048-1080 Link Here
1048
1018
1049
  <subsection name="Advanced configuration with trusted proxies">
1019
  <subsection name="Advanced configuration with trusted proxies">
1050
    <p>RemoteIpFilter configuration: </p>
1020
    <p>RemoteIpFilter configuration: </p>
1051
    <source>
1021
    <source><![CDATA[     <filter>
1052
     &lt;filter&gt;
1022
       <filter-name>RemoteIpFilter</filter-name>
1053
       &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
1023
       <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
1054
       &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
1024
       <init-param>
1055
       &lt;init-param&gt;
1025
         <param-name>allowedInternalProxies</param-name>
1056
         &lt;param-name&gt;allowedInternalProxies&lt;/param-name&gt;
1026
         <param-value>192\.168\.0\.10|192\.168\.0\.11</param-value>
1057
         &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
1027
       </init-param>
1058
       &lt;/init-param&gt;
1028
       <init-param>
1059
       &lt;init-param&gt;
1029
         <param-name>remoteIpHeader</param-name>
1060
         &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
1030
         <param-value>x-forwarded-for</param-value>
1061
         &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
1031
       </init-param>
1062
       &lt;/init-param&gt;
1032
       <init-param>
1063
       &lt;init-param&gt;
1033
         <param-name>remoteIpProxiesHeader</param-name>
1064
         &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
1034
         <param-value>x-forwarded-by</param-value>
1065
         &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
1035
       </init-param>
1066
       &lt;/init-param&gt;
1036
       <init-param>
1067
       &lt;init-param&gt;
1037
         <param-name>trustedProxies</param-name>
1068
         &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
1038
         <param-value>proxy1|proxy2</param-value>
1069
         &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
1039
       </init-param>
1070
       &lt;/init-param&gt;
1040
     </filter>]]></source>
1071
     &lt;/filter&gt;
1041
    <p>Request values:</p>
1072
    </source>
1042
    <table class="defaultTable">
1073
    <p>Request values: <table border="1" cellpadding="5">
1074
      <tr>
1043
      <tr>
1075
        <th bgcolor="#023264"><font color="#ffffff">Property</font></th>
1044
        <th>Property</th>
1076
        <th bgcolor="#023264"><font color="#ffffff">Value Before RemoteIpFilter</font></th>
1045
        <th>Value Before RemoteIpFilter</th>
1077
        <th bgcolor="#023264"><font color="#ffffff">Value After RemoteIpFilter</font></th>
1046
        <th>Value After RemoteIpFilter</th>
1078
      </tr>
1047
      </tr>
1079
      <tr>
1048
      <tr>
1080
        <td> request.remoteAddr </td>
1049
        <td> request.remoteAddr </td>
Lines 1092-1098 Link Here
1092
        <td> proxy1, proxy2 </td>
1061
        <td> proxy1, proxy2 </td>
1093
      </tr>
1062
      </tr>
1094
    </table>
1063
    </table>
1095
    </p>
1064
1096
    <p>
1065
    <p>
1097
    Note : <code>proxy1</code> and <code>proxy2</code> are both trusted proxies that
1066
    Note : <code>proxy1</code> and <code>proxy2</code> are both trusted proxies that
1098
    come in <code>x-forwarded-for</code> header, they both are migrated in
1067
    come in <code>x-forwarded-for</code> header, they both are migrated in
Lines 1103-1135 Link Here
1103
1072
1104
  <subsection name="Advanced configuration with internal and trusted proxies">
1073
  <subsection name="Advanced configuration with internal and trusted proxies">
1105
    <p>RemoteIpFilter configuration: </p>
1074
    <p>RemoteIpFilter configuration: </p>
1106
    <source>
1075
    <source><![CDATA[     <filter>
1107
     &lt;filter&gt;
1076
       <filter-name>RemoteIpFilter</filter-name>
1108
       &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
1077
       <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
1109
       &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
1078
       <init-param>
1110
       &lt;init-param&gt;
1079
         <param-name>allowedInternalProxies</param-name>
1111
         &lt;param-name&gt;allowedInternalProxies&lt;/param-name&gt;
1080
         <param-value>192\.168\.0\.10|192\.168\.0\.11</param-value>
1112
         &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
1081
       </init-param>
1113
       &lt;/init-param&gt;
1082
       <init-param>
1114
       &lt;init-param&gt;
1083
         <param-name>remoteIpHeader</param-name>
1115
         &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
1084
         <param-value>x-forwarded-for</param-value>
1116
         &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
1085
       </init-param>
1117
       &lt;/init-param&gt;
1086
       <init-param>
1118
       &lt;init-param&gt;
1087
         <param-name>remoteIpProxiesHeader</param-name>
1119
         &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
1088
         <param-value>x-forwarded-by</param-value>
1120
         &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
1089
       </init-param>
1121
       &lt;/init-param&gt;
1090
       <init-param>
1122
       &lt;init-param&gt;
1091
         <param-name>trustedProxies</param-name>
1123
         &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
1092
         <param-value>proxy1|proxy2</param-value>
1124
         &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
1093
       </init-param>
1125
       &lt;/init-param&gt;
1094
     </filter>]]></source>
1126
     &lt;/filter&gt;
1095
    <p>Request values:</p>
1127
    </source>
1096
    <table class="defaultTable">
1128
    <p>Request values: <table border="1" cellpadding="5">
1129
      <tr>
1097
      <tr>
1130
        <th bgcolor="#023264"><font color="#ffffff">Property</font></th>
1098
        <th>Property</th>
1131
        <th bgcolor="#023264"><font color="#ffffff">Value Before RemoteIpFilter</font></th>
1099
        <th>Value Before RemoteIpFilter</th>
1132
        <th bgcolor="#023264"><font color="#ffffff">Value After RemoteIpFilter</font></th>
1100
        <th>Value After RemoteIpFilter</th>
1133
      </tr>
1101
      </tr>
1134
      <tr>
1102
      <tr>
1135
        <td> request.remoteAddr </td>
1103
        <td> request.remoteAddr </td>
Lines 1147-1153 Link Here
1147
        <td> proxy1, proxy2 </td>
1115
        <td> proxy1, proxy2 </td>
1148
      </tr>
1116
      </tr>
1149
    </table>
1117
    </table>
1150
    </p>
1118
1151
    <p>
1119
    <p>
1152
    Note : <code>proxy1</code> and <code>proxy2</code> are both trusted proxies that
1120
    Note : <code>proxy1</code> and <code>proxy2</code> are both trusted proxies that
1153
    come in <code>x-forwarded-for</code> header, they both are migrated in
1121
    come in <code>x-forwarded-for</code> header, they both are migrated in
Lines 1161-1193 Link Here
1161
  <subsection name="Advanced configuration with an untrusted proxy">
1129
  <subsection name="Advanced configuration with an untrusted proxy">
1162
1130
1163
    <p>RemoteIpFilter configuration: </p>
1131
    <p>RemoteIpFilter configuration: </p>
1164
    <source>
1132
    <source><![CDATA[     <filter>
1165
     &lt;filter&gt;
1133
       <filter-name>RemoteIpFilter</filter-name>
1166
       &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
1134
       <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class>
1167
       &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
1135
       <init-param>
1168
       &lt;init-param&gt;
1136
         <param-name>allowedInternalProxies</param-name>
1169
         &lt;param-name&gt;allowedInternalProxies&lt;/param-name&gt;
1137
         <param-value>192\.168\.0\.10|192\.168\.0\.11</param-value>
1170
         &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
1138
       </init-param>
1171
       &lt;/init-param&gt;
1139
       <init-param>
1172
       &lt;init-param&gt;
1140
         <param-name>remoteIpHeader</param-name>
1173
         &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
1141
         <param-value>x-forwarded-for</param-value>
1174
         &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
1142
       </init-param>
1175
       &lt;/init-param&gt;
1143
       <init-param>
1176
       &lt;init-param&gt;
1144
         <param-name>remoteIpProxiesHeader</param-name>
1177
         &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
1145
         <param-value>x-forwarded-by</param-value>
1178
         &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
1146
       </init-param>
1179
       &lt;/init-param&gt;
1147
       <init-param>
1180
       &lt;init-param&gt;
1148
         <param-name>trustedProxies</param-name>
1181
         &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
1149
         <param-value>proxy1|proxy2</param-value>
1182
         &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
1150
       </init-param>
1183
       &lt;/init-param&gt;
1151
     </filter>]]></source>
1184
     &lt;/filter&gt;
1152
    <p>Request values:</p>
1185
    </source>
1153
    <table class="defaultTable">
1186
    <p>Request values: <table border="1" cellpadding="5">
1187
      <tr>
1154
      <tr>
1188
        <th bgcolor="#023264"><font color="#ffffff">Property</font></th>
1155
        <th>Property</th>
1189
        <th bgcolor="#023264"><font color="#ffffff">Value Before RemoteIpFilter</font></th>
1156
        <th>Value Before RemoteIpFilter</th>
1190
        <th bgcolor="#023264"><font color="#ffffff">Value After RemoteIpFilter</font></th>
1157
        <th>Value After RemoteIpFilter</th>
1191
      </tr>
1158
      </tr>
1192
      <tr>
1159
      <tr>
1193
        <td> request.remoteAddr </td>
1160
        <td> request.remoteAddr </td>
Lines 1205-1211 Link Here
1205
        <td> proxy1 </td>
1172
        <td> proxy1 </td>
1206
      </tr>
1173
      </tr>
1207
    </table>
1174
    </table>
1208
    </p>
1175
1209
    <p>
1176
    <p>
1210
    Note : <code>x-forwarded-by</code> holds the trusted proxy <code>proxy1</code>.
1177
    Note : <code>x-forwarded-by</code> holds the trusted proxy <code>proxy1</code>.
1211
    <code>x-forwarded-by</code> holds <code>140.211.11.130</code> because
1178
    <code>x-forwarded-by</code> holds <code>140.211.11.130</code> because
Lines 1348-1370 Link Here
1348
    Request Dumper filter for all requests for that web application. If the
1315
    Request Dumper filter for all requests for that web application. If the
1349
    entries were added to <code>CATALINA_BASE/conf/web.xml</code>, the Request
1316
    entries were added to <code>CATALINA_BASE/conf/web.xml</code>, the Request
1350
    Dumper Filter would be enabled for all web applications.</p>
1317
    Dumper Filter would be enabled for all web applications.</p>
1351
    <source>
1318
    <source><![CDATA[<filter>
1352
&lt;filter&gt;
1319
    <filter-name>requestdumper</filter-name>
1353
    &lt;filter-name&gt;requestdumper&lt;/filter-name&gt;
1320
    <filter-class>
1354
    &lt;filter-class&gt;
1355
        org.apache.catalina.filters.RequestDumperFilter
1321
        org.apache.catalina.filters.RequestDumperFilter
1356
    &lt;/filter-class&gt;
1322
    </filter-class>
1357
&lt;/filter&gt;
1323
</filter>
1358
&lt;filter-mapping&gt;
1324
<filter-mapping>
1359
    &lt;filter-name&gt;requestdumper&lt;/filter-name&gt;
1325
    <filter-name>requestdumper</filter-name>
1360
    &lt;url-pattern&gt;*&lt;/url-pattern&gt;
1326
    <url-pattern>*</url-pattern>
1361
&lt;/filter-mapping&gt;
1327
</filter-mapping>]]></source>
1362
    </source>
1363
1328
1364
    <p>The following entries in CATALINA_BASE/conf/logging.properties would
1329
    <p>The following entries in CATALINA_BASE/conf/logging.properties would
1365
    create a separate log file for the Request Dumper Filter output.</p>
1330
    create a separate log file for the Request Dumper Filter output.</p>
1366
    <source>
1331
    <source># To this configuration below, 1request-dumper.org.apache.juli.FileHandler
1367
# To this configuration below, 1request-dumper.org.apache.juli.FileHandler
1368
# also needs to be added to the handlers property near the top of the file
1332
# also needs to be added to the handlers property near the top of the file
1369
1request-dumper.org.apache.juli.FileHandler.level = INFO
1333
1request-dumper.org.apache.juli.FileHandler.level = INFO
1370
1request-dumper.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1334
1request-dumper.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
Lines 1372-1379 Link Here
1372
1request-dumper.org.apache.juli.FileHandler.formatter = org.apache.juli.VerbatimFormatter
1336
1request-dumper.org.apache.juli.FileHandler.formatter = org.apache.juli.VerbatimFormatter
1373
org.apache.catalina.filters.RequestDumperFilter.level = INFO
1337
org.apache.catalina.filters.RequestDumperFilter.level = INFO
1374
org.apache.catalina.filters.RequestDumperFilter.handlers = \
1338
org.apache.catalina.filters.RequestDumperFilter.handlers = \
1375
  1request-dumper.org.apache.juli.FileHandler
1339
  1request-dumper.org.apache.juli.FileHandler</source>
1376
    </source>
1377
  </subsection>
1340
  </subsection>
1378
</section>
1341
</section>
1379
1342
(-)webapps/docs/config/globalresources.xml (-42 / +30 lines)
Lines 45-51 Link Here
45
  the <a href="../jndi-resources-howto.html">JNDI Resources HOW-TO</a>.
45
  the <a href="../jndi-resources-howto.html">JNDI Resources HOW-TO</a>.
46
  The resources defined in this element are <strong>not</strong> visible in
46
  The resources defined in this element are <strong>not</strong> visible in
47
  the per-web-application contexts unless you explicitly link them with
47
  the per-web-application contexts unless you explicitly link them with
48
  <a href="context.html#Resource Links">&lt;ResourceLink&gt;</a> elements.
48
  <a href="context.html#Resource_Links">&lt;ResourceLink&gt;</a> elements.
49
  </p>
49
  </p>
50
50
51
</section>
51
</section>
Lines 70-94 Link Here
70
    web applications as environment entry resources by nesting
70
    web applications as environment entry resources by nesting
71
    <code>&lt;Environment&gt;</code> entries inside this element. For
71
    <code>&lt;Environment&gt;</code> entries inside this element. For
72
    example, you can create an environment entry like this:</p>
72
    example, you can create an environment entry like this:</p>
73
<source>
73
<source><![CDATA[<GlobalNamingResources ...>
74
&lt;GlobalNamingResources ...&gt;
75
  ...
74
  ...
76
  &lt;Environment name="maxExemptions" value="10"
75
  <Environment name="maxExemptions" value="10"
77
         type="java.lang.Integer" override="false"/&gt;
76
         type="java.lang.Integer" override="false"/>
78
  ...
77
  ...
79
&lt;/GlobalNamingResources&gt;
78
</GlobalNamingResources>]]></source>
80
</source>
81
79
82
    <p>This is equivalent to the inclusion of the following element in the
80
    <p>This is equivalent to the inclusion of the following element in the
83
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):
81
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):
84
    </p>
82
    </p>
85
<source>
83
<source><![CDATA[<env-entry>
86
&lt;env-entry&gt;
84
  <env-entry-name>maxExemptions</env-entry-name>
87
  &lt;env-entry-name&gt;maxExemptions&lt;/env-entry-name&gt;
85
  <env-entry-value>10</env-entry-value>
88
  &lt;env-entry-value&gt;10&lt;/env-entry-value&gt;
86
  <env-entry-type>java.lang.Integer</env-entry-type>
89
  &lt;env-entry-type&gt;java.lang.Integer&lt;/env-entry-type&gt;
87
</env-entry>]]></source>
90
&lt;/env-entry&gt;
91
</source>
92
    <p>but does <em>not</em> require modification of the deployment descriptor
88
    <p>but does <em>not</em> require modification of the deployment descriptor
93
    to customize this value.</p>
89
    to customize this value.</p>
94
90
Lines 137-143 Link Here
137
    to be returned for JNDI lookups of <code>&lt;resource-ref&gt;</code> and
133
    to be returned for JNDI lookups of <code>&lt;resource-ref&gt;</code> and
138
    <code>&lt;resource-env-ref&gt;</code> elements in the web application
134
    <code>&lt;resource-env-ref&gt;</code> elements in the web application
139
    deployment descriptor by defining them in this element and then linking
135
    deployment descriptor by defining them in this element and then linking
140
    them with <a href="context.html#Resource Links">&lt;ResourceLink&gt;</a>
136
    them with <a href="context.html#_Links">&lt;ResourceLink&gt;</a>
141
    elements
137
    elements
142
    in the <code><strong>&lt;Context&gt;</strong></code> element.
138
    in the <code><strong>&lt;Context&gt;</strong></code> element.
143
139
Lines 147-172 Link Here
147
    the properties used to configure that object factory.</p>
143
    the properties used to configure that object factory.</p>
148
144
149
    <p>For example, you can create a resource definition like this:</p>
145
    <p>For example, you can create a resource definition like this:</p>
150
<source>
146
<source><![CDATA[<GlobalNamingResources ...>
151
&lt;GlobalNamingResources ...&gt;
152
  ...
147
  ...
153
  &lt;Resource name="jdbc/EmployeeDB" auth="Container"
148
  <Resource name="jdbc/EmployeeDB" auth="Container"
154
            type="javax.sql.DataSource"
149
            type="javax.sql.DataSource"
155
     description="Employees Database for HR Applications"/&gt;
150
     description="Employees Database for HR Applications"/>
156
  ...
151
  ...
157
&lt;/GlobalNamingResources&gt;
152
</GlobalNamingResources>]]></source>
158
</source>
159
153
160
    <p>This is equivalent to the inclusion of the following element in the
154
    <p>This is equivalent to the inclusion of the following element in the
161
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p>
155
    web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p>
162
<source>
156
<source><![CDATA[<resource-ref>
163
&lt;resource-ref&gt;
157
  <description>Employees Database for HR Applications</description>
164
  &lt;description&gt;Employees Database for HR Applications&lt;/description&gt;
158
  <res-ref-name>jdbc/EmployeeDB</res-ref-name>
165
  &lt;res-ref-name&gt;jdbc/EmployeeDB&lt;/res-ref-name&gt;
159
  <res-ref-type>javax.sql.DataSource</res-ref-type>
166
  &lt;res-ref-type&gt;javax.sql.DataSource&lt;/res-ref-type&gt;
160
  <res-auth>Container</res-auth>
167
  &lt;res-auth&gt;Container&lt;/res-auth&gt;
161
</resource-ref>]]></source>
168
&lt;/resource-ref&gt;
169
</source>
170
162
171
    <p>but does <em>not</em> require modification of the deployment
163
    <p>but does <em>not</em> require modification of the deployment
172
    descriptor to customize this value.</p>
164
    descriptor to customize this value.</p>
Lines 239-263 Link Here
239
  </subsection>
231
  </subsection>
240
232
241
  <subsection name="Resource Links">
233
  <subsection name="Resource Links">
242
    <p>Use <a href="context.html#Resource Links">&lt;ResourceLink&gt;</a>
234
    <p>Use <a href="context.html#Resource_Links"><code>&lt;ResourceLink&gt;</code></a>
243
    elements to link resources from the global context into
235
    elements to link resources from the global context into
244
    per-web-application contexts. Here is an example of making a custom
236
    per-web-application contexts. Here is an example of making a custom
245
    factory available to an application, based on the example definition in the
237
    factory available to an application, based on the example definition in the
246
    <a href="../jndi-resources-howto.html#Generic JavaBean Resources">
238
    <a href="../jndi-resources-howto.html#Generic_JavaBean_Resources">
247
    JNDI Resource HOW-TO</a>:
239
    JNDI Resource HOW-TO</a>:
248
    </p>
240
    </p>
249
241
250
    <source>
242
    <source><![CDATA[<Context>
251
      <![CDATA[
243
  <ResourceLink
252
        <Context>
244
    name="bean/MyBeanFactory"
253
          <ResourceLink
245
    global="bean/MyBeanFactory"
254
            name="bean/MyBeanFactory"
246
    type="com.mycompany.MyBean"
255
            global="bean/MyBeanFactory"
247
  />
256
            type="com.mycompany.MyBean"
248
</Context>]]></source>
257
          />
258
        </Context>
259
      ]]>
260
    </source>
261
249
262
   </subsection>
250
   </subsection>
263
251
(-)webapps/docs/config/host.xml (-54 / +36 lines)
Lines 48-54 Link Here
48
  <p>In many cases, System Administrators wish to associate more than
48
  <p>In many cases, System Administrators wish to associate more than
49
  one network name (such as <code>www.mycompany.com</code> and
49
  one network name (such as <code>www.mycompany.com</code> and
50
  <code>company.com</code>) with the same virtual host and applications.
50
  <code>company.com</code>) with the same virtual host and applications.
51
  This can be accomplished using the <a href="#Host Name Aliases">Host
51
  This can be accomplished using the <a href="#Host_Name_Aliases">Host
52
  Name Aliases</a> feature discussed below.</p>
52
  Name Aliases</a> feature discussed below.</p>
53
53
54
  <p>One or more <strong>Host</strong> elements are nested inside an
54
  <p>One or more <strong>Host</strong> elements are nested inside an
Lines 67-79 Link Here
67
  not match the name of a <strong>Host</strong> element will be routed to the
67
  not match the name of a <strong>Host</strong> element will be routed to the
68
  default host.</p>
68
  default host.</p>
69
69
70
    <blockquote><em>
70
    <p><em>The description below uses the variable name $CATALINA_BASE to refer the
71
    <p>The description below uses the variable name $CATALINA_BASE to refer the
72
    base directory against which most relative paths are resolved. If you have
71
    base directory against which most relative paths are resolved. If you have
73
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
72
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
74
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
73
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
75
    the directory into which you have installed Tomcat.</p>
74
    the directory into which you have installed Tomcat.</em></p>
76
    </em></blockquote>
77
75
78
</section>
76
</section>
79
77
Lines 183-189 Link Here
183
        specify the host name, Tomcat will convert it to lower case internally.
181
        specify the host name, Tomcat will convert it to lower case internally.
184
        One of the Hosts nested within an <a href="engine.html">Engine</a> MUST
182
        One of the Hosts nested within an <a href="engine.html">Engine</a> MUST
185
        have a name that matches the <code>defaultHost</code> setting for that
183
        have a name that matches the <code>defaultHost</code> setting for that
186
        Engine.  See <a href="#Host Name Aliases">Host Name Aliases</a> for
184
        Engine.  See <a href="#Host_Name_Aliases">Host Name Aliases</a> for
187
        information on how to assign more than one network name to the same
185
        information on how to assign more than one network name to the same
188
        virtual host.</p>
186
        virtual host.</p>
189
      </attribute>
187
      </attribute>
Lines 337-353 Link Here
337
    <a href="host.html">Host</a>, or <a href="context.html">Context</a>
335
    <a href="host.html">Host</a>, or <a href="context.html">Context</a>
338
    by nesting a <a href="valve.html">Valve</a> element like this:</p>
336
    by nesting a <a href="valve.html">Valve</a> element like this:</p>
339
337
340
<source>
338
<source><![CDATA[<Host name="localhost" ...>
341
&lt;Host name="localhost" ...&gt;
342
  ...
339
  ...
343
  &lt;Valve className="org.apache.catalina.valves.AccessLogValve"
340
  <Valve className="org.apache.catalina.valves.AccessLogValve"
344
         prefix="localhost_access_log." suffix=".txt"
341
         prefix="localhost_access_log." suffix=".txt"
345
         pattern="common"/&gt;
342
         pattern="common"/>
346
  ...
343
  ...
347
&lt;/Host&gt;
344
</Host>]]></source>
348
</source>
349
345
350
    <p>See <a href="valve.html#Access Log Valve">Access Log Valve</a>
346
    <p>See <a href="valve.html#Access_Log_Valve">Access Log Valve</a>
351
    for more information on the configuration attributes that are
347
    for more information on the configuration attributes that are
352
    supported.</p>
348
    supported.</p>
353
349
Lines 394-400 Link Here
394
      for context.xml and/or WAR files.</li>
390
      for context.xml and/or WAR files.</li>
395
    </ol>
391
    </ol>
396
392
397
    <p>When <code>autoDeploy</code> is <true>true</true>, the automatic
393
    <p>When <code>autoDeploy</code> is <code>true</code>, the automatic
398
    deployment process will monitor the deployed web applications for changes.
394
    deployment process will monitor the deployed web applications for changes.
399
    Depending on exactly what changes, the web application will either be
395
    Depending on exactly what changes, the web application will either be
400
    re-deployed or reloaded. Re-deployment involves the creation of a new web
396
    re-deployed or reloaded. Re-deployment involves the creation of a new web
Lines 451-463 Link Here
451
    <p>This is accomplished by utilizing one or more <strong>Alias</strong>
447
    <p>This is accomplished by utilizing one or more <strong>Alias</strong>
452
    elements nested inside your <strong>Host</strong> element.  For
448
    elements nested inside your <strong>Host</strong> element.  For
453
    example:</p>
449
    example:</p>
454
<source>
450
<source><![CDATA[<Host name="www.mycompany.com" ...>
455
&lt;Host name="www.mycompany.com" ...&gt;
456
  ...
451
  ...
457
  &lt;Alias&gt;mycompany.com&lt;/Alias&gt;
452
  <Alias>mycompany.com</Alias>
458
  ...
453
  ...
459
&lt;/Host&gt;
454
</Host>]]></source>
460
</source>
461
455
462
    <p>In order for this strategy to be effective, all of the network names
456
    <p>In order for this strategy to be effective, all of the network names
463
    involved must be registered in your DNS server to resolve to the
457
    involved must be registered in your DNS server to resolve to the
Lines 476-488 Link Here
476
    it will be notified about the occurrence of the corresponding
470
    it will be notified about the occurrence of the corresponding
477
    lifecycle events.  Configuration of such a listener looks like this:</p>
471
    lifecycle events.  Configuration of such a listener looks like this:</p>
478
472
479
<source>
473
<source><![CDATA[<Host name="localhost" ...>
480
&lt;Host name="localhost" ...&gt;
481
  ...
474
  ...
482
  &lt;Listener className="com.mycompany.mypackage.MyListener" ... &gt;
475
  <Listener className="com.mycompany.mypackage.MyListener" ... >
483
  ...
476
  ...
484
&lt;/Host&gt;
477
</Host>]]></source>
485
</source>
486
478
487
    <p>Note that a Listener can have any number of additional properties
479
    <p>Note that a Listener can have any number of additional properties
488
    that may be configured from this element.  Attribute names are matched
480
    that may be configured from this element.  Attribute names are matched
Lines 504-522 Link Here
504
    not accepted will be rejected with an HTTP "Forbidden" error.
496
    not accepted will be rejected with an HTTP "Forbidden" error.
505
    Example filter declarations:</p>
497
    Example filter declarations:</p>
506
498
507
<source>
499
<source><![CDATA[<Host name="localhost" ...>
508
&lt;Host name="localhost" ...&gt;
509
  ...
500
  ...
510
  &lt;Valve className="org.apache.catalina.valves.RemoteHostValve"
501
  <Valve className="org.apache.catalina.valves.RemoteHostValve"
511
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/&gt;
502
         allow=".*\.mycompany\.com|www\.yourcompany\.com"/>
512
  &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
503
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
513
         deny="192\.168\.1\.\d+"/&gt;
504
         deny="192\.168\.1\.\d+"/>
514
  ...
505
  ...
515
&lt;/Host&gt;
506
</Host>]]></source>
516
</source>
517
507
518
  <p>See <a href="valve.html#Remote Address Filter">Remote Address Filter</a>
508
  <p>See <a href="valve.html#Remote_Address_Filter">Remote Address Filter</a>
519
  and <a href="valve.html#Remote Host Filter">Remote Host Filter</a> for
509
  and <a href="valve.html#Remote_Host_Filter">Remote Host Filter</a> for
520
  more information about the configuration options that are supported.</p>
510
  more information about the configuration options that are supported.</p>
521
511
522
  </subsection>
512
  </subsection>
Lines 530-542 Link Here
530
    host.  This can be accomplished by nesting an element like this inside
520
    host.  This can be accomplished by nesting an element like this inside
531
    the Host element for this virtual host:</p>
521
    the Host element for this virtual host:</p>
532
522
533
<source>
523
<source><![CDATA[<Host name="localhost" ...>
534
&lt;Host name="localhost" ...&gt;
535
  ...
524
  ...
536
  &lt;Valve className="org.apache.catalina.authenticator.SingleSignOn"/&gt;
525
  <Valve className="org.apache.catalina.authenticator.SingleSignOn"/>
537
  ...
526
  ...
538
&lt;/Host&gt;
527
</Host>]]></source>
539
</source>
540
528
541
    <p>The Single Sign On facility operates according to the following rules:
529
    <p>The Single Sign On facility operates according to the following rules:
542
    </p>
530
    </p>
Lines 582-596 Link Here
582
    <strong>Listener</strong> element like this (on a Unix system that
570
    <strong>Listener</strong> element like this (on a Unix system that
583
    uses the <code>/etc/passwd</code> file to identify valid users):</p>
571
    uses the <code>/etc/passwd</code> file to identify valid users):</p>
584
572
585
<source>
573
<source><![CDATA[<Host name="localhost" ...>
586
&lt;Host name="localhost" ...&gt;
587
  ...
574
  ...
588
  &lt;Listener className="org.apache.catalina.startup.UserConfig"
575
  <Listener className="org.apache.catalina.startup.UserConfig"
589
            directoryName="public_html"
576
            directoryName="public_html"
590
            userClass="org.apache.catalina.startup.PasswdUserDatabase"/&gt;
577
            userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
591
  ...
578
  ...
592
&lt;/Host&gt;
579
</Host>]]></source>
593
</source>
594
580
595
    <p>On a server where <code>/etc/passwd</code> is not in use, you can
581
    <p>On a server where <code>/etc/passwd</code> is not in use, you can
596
    request Catalina to consider all directories found in a specified base
582
    request Catalina to consider all directories found in a specified base
Lines 597-620 Link Here
597
    directory (such as <code>c:\Homes</code> in this example) to be
583
    directory (such as <code>c:\Homes</code> in this example) to be
598
    considered "user home" directories for the purposes of this directive:</p>
584
    considered "user home" directories for the purposes of this directive:</p>
599
585
600
<source>
586
<source><![CDATA[<Host name="localhost" ...>
601
&lt;Host name="localhost" ...&gt;
602
  ...
587
  ...
603
  &lt;Listener className="org.apache.catalina.startup.UserConfig"
588
  <Listener className="org.apache.catalina.startup.UserConfig"
604
            directoryName="public_html"
589
            directoryName="public_html"
605
            homeBase=c:\Homes"
590
            homeBase=c:\Homes"
606
            userClass="org.apache.catalina.startup.HomesUserDatabase"/&gt;
591
            userClass="org.apache.catalina.startup.HomesUserDatabase"/>
607
  ...
592
  ...
608
&lt;/Host&gt;
593
</Host>]]></source>
609
</source>
610
594
611
    <p>If a user home directory has been set up for a user named
595
    <p>If a user home directory has been set up for a user named
612
    <code>craigmcc</code>, then its contents will be visible from a
596
    <code>craigmcc</code>, then its contents will be visible from a
613
    client browser by making a request to a URL like:</p>
597
    client browser by making a request to a URL like:</p>
614
598
615
<source>
599
<source>http://www.mycompany.com:8080/~craigmcc</source>
616
http://www.mycompany.com:8080/~craigmcc
617
</source>
618
600
619
    <p>Successful use of this feature requires recognition of the following
601
    <p>Successful use of this feature requires recognition of the following
620
    considerations:</p>
602
    considerations:</p>
(-)webapps/docs/config/http.xml (-27 / +81 lines)
Lines 174-180 Link Here
174
        <code>org.apache.coyote.http11.Http11AprProtocol</code> -
174
        <code>org.apache.coyote.http11.Http11AprProtocol</code> -
175
              the APR/native connector.<br/>
175
              the APR/native connector.<br/>
176
        Custom implementations may also be used.<br/>
176
        Custom implementations may also be used.<br/>
177
        Take a look at our <a href="#Connector Comparison">Connector
177
        Take a look at our <a href="#Connector_Comparison">Connector
178
        Comparison</a> chart. The configuration for both Java connectors is
178
        Comparison</a> chart. The configuration for both Java connectors is
179
        identical, for http and https.<br/>
179
        identical, for http and https.<br/>
180
        For more information on the APR connector and APR specific SSL settings
180
        For more information on the APR connector and APR specific SSL settings
Lines 186-192 Link Here
186
      <p>If this <strong>Connector</strong> is being used in a proxy
186
      <p>If this <strong>Connector</strong> is being used in a proxy
187
      configuration, configure this attribute to specify the server name
187
      configuration, configure this attribute to specify the server name
188
      to be returned for calls to <code>request.getServerName()</code>.
188
      to be returned for calls to <code>request.getServerName()</code>.
189
      See <a href="#Proxy Support">Proxy Support</a> for more
189
      See <a href="#Proxy_Support">Proxy Support</a> for more
190
      information.</p>
190
      information.</p>
191
    </attribute>
191
    </attribute>
192
192
Lines 194-200 Link Here
194
      <p>If this <strong>Connector</strong> is being used in a proxy
194
      <p>If this <strong>Connector</strong> is being used in a proxy
195
      configuration, configure this attribute to specify the server port
195
      configuration, configure this attribute to specify the server port
196
      to be returned for calls to <code>request.getServerPort()</code>.
196
      to be returned for calls to <code>request.getServerPort()</code>.
197
      See <a href="#Proxy Support">Proxy Support</a> for more
197
      See <a href="#Proxy_Support">Proxy Support</a> for more
198
      information.</p>
198
      information.</p>
199
    </attribute>
199
    </attribute>
200
200
Lines 489-495 Link Here
489
      <code>scheme</code> and the <code>secure</code> attributes as well
489
      <code>scheme</code> and the <code>secure</code> attributes as well
490
      to pass the correct <code>request.getScheme()</code> and
490
      to pass the correct <code>request.getScheme()</code> and
491
      <code>request.isSecure()</code> values to the servlets
491
      <code>request.isSecure()</code> values to the servlets
492
      See <a href="#SSL Support">SSL Support</a> for more information.
492
      See <a href="#SSL_Support">SSL Support</a> for more information.
493
      </p>
493
      </p>
494
    </attribute>
494
    </attribute>
495
495
Lines 565-583 Link Here
565
      </attribute>
565
      </attribute>
566
      <attribute name="socket.performanceConnectionTime" required="false">
566
      <attribute name="socket.performanceConnectionTime" required="false">
567
        <p>(int)The first value for the performance settings. See
567
        <p>(int)The first value for the performance settings. See
568
        <a href="http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a>
568
        <a href="http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a>
569
        All three performance attributes must be set else the JVM defaults will
569
        All three performance attributes must be set else the JVM defaults will
570
        be used for all three.</p>
570
        be used for all three.</p>
571
      </attribute>
571
      </attribute>
572
      <attribute name="socket.performanceLatency" required="false">
572
      <attribute name="socket.performanceLatency" required="false">
573
        <p>(int)The second value for the performance settings. See
573
        <p>(int)The second value for the performance settings. See
574
        <a href="http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a>
574
        <a href="http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a>
575
        All three performance attributes must be set else the JVM defaults will
575
        All three performance attributes must be set else the JVM defaults will
576
        be used for all three.</p>
576
        be used for all three.</p>
577
      </attribute>
577
      </attribute>
578
      <attribute name="socket.performanceBandwidth" required="false">
578
      <attribute name="socket.performanceBandwidth" required="false">
579
        <p>(int)The third value for the performance settings. See
579
        <p>(int)The third value for the performance settings. See
580
        <a href="http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a>
580
        <a href="http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a>
581
        All three performance attributes must be set else the JVM defaults will
581
        All three performance attributes must be set else the JVM defaults will
582
        be used for all three.</p>
582
        be used for all three.</p>
583
      </attribute>
583
      </attribute>
Lines 1029-1036 Link Here
1029
      the JVM default is used. The permitted values may be obtained from the
1029
      the JVM default is used. The permitted values may be obtained from the
1030
      JVM documentation for the allowed values for
1030
      JVM documentation for the allowed values for
1031
      <code>SSLSocket.setEnabledProtocols()</code> e.g.
1031
      <code>SSLSocket.setEnabledProtocols()</code> e.g.
1032
      <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#jssenames">
1033
      Oracle Java 6</a> and
1034
      <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#jssenames">
1032
      <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#jssenames">
1035
      Oracle Java 7</a>. Note: There is overlap between this attribute and
1033
      Oracle Java 7</a>. Note: There is overlap between this attribute and
1036
      <code>sslProtocol</code>.</p>
1034
      <code>sslProtocol</code>.</p>
Lines 1049-1056 Link Here
1049
      default is <code>TLS</code>. The permitted values may be obtained from the
1047
      default is <code>TLS</code>. The permitted values may be obtained from the
1050
      JVM documentation for the allowed values for algorithm when creating an
1048
      JVM documentation for the allowed values for algorithm when creating an
1051
      <code>SSLContext</code> instance e.g.
1049
      <code>SSLContext</code> instance e.g.
1052
      <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#SSLContext">
1053
      Oracle Java 6</a> and
1054
      <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SSLContext">
1050
      <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SSLContext">
1055
      Oracle Java 7</a>. Note: There is overlap between this attribute and
1051
      Oracle Java 7</a>. Note: There is overlap between this attribute and
1056
      <code>sslEnabledProtocols</code>.</p>
1052
      <code>sslEnabledProtocols</code>.</p>
Lines 1249-1272 Link Here
1249
  <subsection name="Connector Comparison">
1245
  <subsection name="Connector Comparison">
1250
1246
1251
    <p>Below is a small chart that shows how the connectors differentiate.</p>
1247
    <p>Below is a small chart that shows how the connectors differentiate.</p>
1252
    <source>
1253
                       Java Blocking Connector   Java Non Blocking Connector   APR/native Connector
1254
                                 BIO                         NIO                       APR
1255
    Classname              Http11Protocol             Http11NioProtocol         Http11AprProtocol
1256
    Tomcat Version           3.x onwards                 6.x onwards              5.5.x onwards
1257
    Support Polling              NO                          YES                       YES
1258
    Polling Size                 N/A                   maxConnections             maxConnections
1259
    Read HTTP Request         Blocking                  Non Blocking                 Blocking
1260
    Read HTTP Body            Blocking                  Sim Blocking                 Blocking
1261
    Write HTTP Response       Blocking                  Sim Blocking                 Blocking
1262
    Wait for next Request     Blocking                  Non Blocking               Non Blocking
1263
    SSL Support               Java SSL                    Java SSL                   OpenSSL
1264
    SSL Handshake             Blocking                  Non blocking                 Blocking
1265
    Max Connections        maxConnections              maxConnections             maxConnections
1266
1248
1249
    <table class="defaultTable" style="text-align: center;">
1250
      <tr>
1251
        <th />
1252
        <th>Java Blocking Connector<br />BIO</th>
1253
        <th>Java Nio Blocking Connector<br />NIO</th>
1254
        <th>APR/native Connector<br />APR</th>
1255
      </tr>
1256
      <tr>
1257
        <th style="text-align: left;">Classname</th>
1258
        <td><code class="noHighlight">Http11Protocol</code></td>
1259
        <td><code class="noHighlight">Http11NioProtocol</code></td>
1260
        <td><code class="noHighlight">Http11AprProtocol</code></td>
1261
      </tr>
1262
      <tr>
1263
        <th style="text-align: left;">Tomcat Version</th>
1264
        <td>3.x onwards</td>
1265
        <td>6.x onwards</td>
1266
        <td>5.5.x onwards</td>
1267
      </tr>
1268
      <tr>
1269
        <th style="text-align: left;">Support Polling</th>
1270
        <td>NO</td>
1271
        <td>YES</td>
1272
        <td>YES</td>
1273
      </tr>
1274
      <tr>
1275
        <th style="text-align: left;">Polling Size</th>
1276
        <td>N/A</td>
1277
        <td><code class="noHighlight">maxConnections</code></td>
1278
        <td><code class="noHighlight">maxConnections</code></td>
1279
      </tr>
1280
      <tr>
1281
        <th style="text-align: left;">Read HTTP Request</th>
1282
        <td>Blocking</td>
1283
        <td>Non Blocking</td>
1284
        <td>Blocking</td>
1285
      </tr>
1286
      <tr>
1287
        <th style="text-align: left;">Read HTTP Body</th>
1288
        <td>Blocking</td>
1289
        <td>Sim Blocking</td>
1290
        <td>Blocking</td>
1291
      </tr>
1292
      <tr>
1293
        <th style="text-align: left;">Write HTTP Response</th>
1294
        <td>Blocking</td>
1295
        <td>Sim Blocking</td>
1296
        <td>Blocking</td>
1297
      </tr>
1298
      <tr>
1299
        <th style="text-align: left;">Wait for next Request</th>
1300
        <td>Blocking</td>
1301
        <td>Non Blocking</td>
1302
        <td>Non Blocking</td>
1303
      </tr>
1304
      <tr>
1305
        <th style="text-align: left;">SSL Support</th>
1306
        <td>Java SSL</td>
1307
        <td>Java SSL</td>
1308
        <td>OpenSSL</td>
1309
      </tr>
1310
      <tr>
1311
        <th style="text-align: left;">SSL Handshake</th>
1312
        <td>Blocking</td>
1313
        <td>Non blocking</td>
1314
        <td>Blocking</td>
1315
      </tr>
1316
      <tr>
1317
        <th style="text-align: left;">Max Connections</th>
1318
        <td><code class="noHighlight">maxConnections</code></td>
1319
        <td><code class="noHighlight">maxConnections</code></td>
1320
        <td><code class="noHighlight">maxConnections</code></td>
1321
      </tr>
1322
    </table>
1267
1323
1268
    </source>
1269
1270
  </subsection>
1324
  </subsection>
1271
</section>
1325
</section>
1272
1326
(-)webapps/docs/config/listeners.xml (-37 / +23 lines)
Lines 451-481 Link Here
451
451
452
    <h3>Using file-based Authentication and Authorisation</h3>
452
    <h3>Using file-based Authentication and Authorisation</h3>
453
453
454
    <p>If this listener was configured in server.xml as:
454
    <p>If this listener was configured in server.xml as:</p>
455
  <source>
455
  <source><![CDATA[  <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
456
  &lt;Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
456
          rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />]]></source>
457
          rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" /&gt;
457
    <p>with the following system properties set (e.g. in setenv.sh):</p>
458
  </source>
458
  <source>  -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
459
    with the following system properties set (e.g. in setenv.sh):
460
  <source>
461
  -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
462
  -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
459
  -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
463
  -Dcom.sun.management.jmxremote.ssl=false
460
  -Dcom.sun.management.jmxremote.ssl=false</source>
464
  </source>
461
    <p>$CATALINA_BASE/conf/jmxremote.password containing:</p>
465
    $CATALINA_BASE/conf/jmxremote.password containing:
462
  <source>admin letmein</source>
466
  <source>
463
    <p>$CATALINA_BASE/conf/jmxremote.access containing:</p>
467
  admin letmein
464
  <source>admin readwrite</source>
468
  </source>
465
    <p>then opening ports 10001 (RMI Registry) and 10002 (JMX/RMI Server) in your
469
    $CATALINA_BASE/conf/jmxremote.access containing:
470
  <source>
471
  admin readwrite
472
  </source>
473
    then opening ports 10001 (RMI Registry) and 10002 (JMX/RMI Server) in your
474
    firewall would enable jconsole to connect to a Tomcat instance running
466
    firewall would enable jconsole to connect to a Tomcat instance running
475
    behind a firewall using a connection string of the form:
467
    behind a firewall using a connection string of the form:</p>
476
  <source>
468
  <source>service:jmx:rmi://&lt;hostname&gt;:10002/jndi/rmi://&lt;hostname&gt;:10001/jmxrmi</source>
477
  service:jmx:rmi://&lt;hostname&gt;:10002/jndi/rmi://&lt;hostname&gt;:10001/jmxrmi
469
    <p>
478
  </source>
479
    with a user name of <code>admin</code> and a password of
470
    with a user name of <code>admin</code> and a password of
480
    <code>letmein</code>.
471
    <code>letmein</code>.
481
    </p>
472
    </p>
Lines 482-497 Link Here
482
473
483
    <h3>Using JAAS</h3>
474
    <h3>Using JAAS</h3>
484
475
485
    <p>If we use the following system properties instead:
476
    <p>If we use the following system properties instead:</p>
486
  <source>
477
  <source>  -Dcom.sun.management.jmxremote.login.config=Tomcat
487
  -Dcom.sun.management.jmxremote.login.config=Tomcat
488
  -Djava.security.auth.login.config=$CATALINA_BASE/conf/login.config
478
  -Djava.security.auth.login.config=$CATALINA_BASE/conf/login.config
489
  -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
479
  -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
490
  -Dcom.sun.management.jmxremote.ssl=false
480
  -Dcom.sun.management.jmxremote.ssl=false</source>
491
  </source>
481
    <p>$CATALINA_BASE/conf/login.config containing your choice of JAAS LoginModule implementation, for example:</p>
492
    $CATALINA_BASE/conf/login.config containing your choice of JAAS LoginModule implementation, for example:
482
  <source>  Tomcat { /* should match to the com.sun.management.jmxremote.login.config property */
493
  <source>
494
  Tomcat { /* should match to the com.sun.management.jmxremote.login.config property */
495
483
496
    /* for illustration purposes only */
484
    /* for illustration purposes only */
497
    com.sun.security.auth.module.LdapLoginModule REQUIRED
485
    com.sun.security.auth.module.LdapLoginModule REQUIRED
Lines 499-510 Link Here
499
      userFilter="(&amp;(uid={USERNAME})(objectClass=inetOrgPerson))"
487
      userFilter="(&amp;(uid={USERNAME})(objectClass=inetOrgPerson))"
500
      authzIdentity="admin"
488
      authzIdentity="admin"
501
      debug=true;
489
      debug=true;
502
  };
490
  };</source>
503
  </source>
491
    <p>$CATALINA_BASE/conf/jmxremote.access containing:</p>
504
    $CATALINA_BASE/conf/jmxremote.access containing:
492
  <source>admin readwrite</source>
505
  <source>
493
    <p>
506
  admin readwrite
507
  </source>
508
    then we would need to provide LDAP credentials instead.
494
    then we would need to provide LDAP credentials instead.
509
    </p>
495
    </p>
510
496
(-)webapps/docs/config/loader.xml (-4 / +2 lines)
Lines 56-68 Link Here
56
  <p>For a more in-depth description of the class loader hierarchy
56
  <p>For a more in-depth description of the class loader hierarchy
57
  that is implemented by Catalina, see <a href="../class-loader-howto.html">the ClassLoader HowTo</a>.</p>
57
  that is implemented by Catalina, see <a href="../class-loader-howto.html">the ClassLoader HowTo</a>.</p>
58
58
59
    <blockquote><em>
59
    <p><em>The description below uses the variable name $CATALINA_BASE to refer the
60
    <p>The description below uses the variable name $CATALINA_BASE to refer the
61
    base directory against which most relative paths are resolved. If you have
60
    base directory against which most relative paths are resolved. If you have
62
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
61
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
63
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
62
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
64
    the directory into which you have installed Tomcat.</p>
63
    the directory into which you have installed Tomcat.</em></p>
65
    </em></blockquote>
66
64
67
</section>
65
</section>
68
66
(-)webapps/docs/config/manager.xml (-7 / +5 lines)
Lines 195-201 Link Here
195
    element - this is required for use of <code>PersistentManager</code>.</p>
195
    element - this is required for use of <code>PersistentManager</code>.</p>
196
196
197
    <p>This implementation of Manager supports the following attributes in
197
    <p>This implementation of Manager supports the following attributes in
198
    addition to the <a href="#Common Attributes">Common Attributes</a>
198
    addition to the <a href="#Common_Attributes">Common Attributes</a>
199
    described earlier.</p>
199
    described earlier.</p>
200
200
201
    <attributes>
201
    <attributes>
Lines 202-208 Link Here
202
202
203
      <attribute name="className" required="true">
203
      <attribute name="className" required="true">
204
        <p>It has the same meaning as described in the
204
        <p>It has the same meaning as described in the
205
        <a href="#Common Attributes">Common Attributes</a> above.
205
        <a href="#Common_Attributes">Common Attributes</a> above.
206
        You <strong>must</strong> specify
206
        You <strong>must</strong> specify
207
        <code>org.apache.catalina.session.PersistentManager</code> to use
207
        <code>org.apache.catalina.session.PersistentManager</code> to use
208
        this manager implementation.</p>
208
        this manager implementation.</p>
Lines 432-439 Link Here
432
  Detailed SQL commands vary depending on the database you are using, but
432
  Detailed SQL commands vary depending on the database you are using, but
433
  a script like this will generally be required:</p>
433
  a script like this will generally be required:</p>
434
434
435
<source>
435
<source>create table tomcat_sessions (
436
create table tomcat_sessions (
437
  session_id     varchar(100) not null primary key,
436
  session_id     varchar(100) not null primary key,
438
  valid_session  char(1) not null,
437
  valid_session  char(1) not null,
439
  max_inactive   int not null,
438
  max_inactive   int not null,
Lines 441-448 Link Here
441
  app_name       varchar(255),
440
  app_name       varchar(255),
442
  session_data   mediumblob,
441
  session_data   mediumblob,
443
  KEY kapp_name(app_name)
442
  KEY kapp_name(app_name)
444
);
443
);</source>
445
</source>
446
444
447
  <p>In order for the JDBC Based Store to successfully connect to your
445
  <p>In order for the JDBC Based Store to successfully connect to your
448
  database, the JDBC driver you configure must be visible to Tomcat's
446
  database, the JDBC driver you configure must be visible to Tomcat's
Lines 481-487 Link Here
481
    a <a href="context.html">Context</a> configuration file for your web
479
    a <a href="context.html">Context</a> configuration file for your web
482
    application and add the following element there:</p>
480
    application and add the following element there:</p>
483
481
484
    <source>&lt;Manager pathname="" /&gt;</source>
482
    <source><![CDATA[<Manager pathname="" />]]></source>
485
  </subsection>
483
  </subsection>
486
484
487
</section>
485
</section>
(-)webapps/docs/config/realm.xml (-4 / +2 lines)
Lines 55-67 Link Here
55
  <a href="../realm-howto.html">Container-Managed Security Guide</a>.
55
  <a href="../realm-howto.html">Container-Managed Security Guide</a>.
56
  </p>
56
  </p>
57
57
58
    <blockquote><em>
58
    <p><em>The description below uses the variable name $CATALINA_BASE to refer the
59
    <p>The description below uses the variable name $CATALINA_BASE to refer the
60
    base directory against which most relative paths are resolved. If you have
59
    base directory against which most relative paths are resolved. If you have
61
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
60
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
62
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
61
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
63
    the directory into which you have installed Tomcat.</p>
62
    the directory into which you have installed Tomcat.</em></p>
64
    </em></blockquote>
65
63
66
</section>
64
</section>
67
65
(-)webapps/docs/config/systemprops.xml (-6 / +6 lines)
Lines 278-284 Link Here
278
278
279
    <property name="org.apache.catalina. STRICT_SERVLET_COMPLIANCE">
279
    <property name="org.apache.catalina. STRICT_SERVLET_COMPLIANCE">
280
      <p>The default value of this system property is <code>false</code>.</p>
280
      <p>The default value of this system property is <code>false</code>.</p>
281
      <p>If this is <code>true</code> the default values will be changed for:
281
      <p>If this is <code>true</code> the default values will be changed for:</p>
282
      <ul>
282
      <ul>
283
      <li><code>org.apache.catalina.core.<br/>ApplicationContext.GET_RESOURCE_REQUIRE_SLASH</code></li>
283
      <li><code>org.apache.catalina.core.<br/>ApplicationContext.GET_RESOURCE_REQUIRE_SLASH</code></li>
284
      <li><code>org.apache.catalina.core.<br/>ApplicationDispatcher.WRAP_SAME_OBJECT</code></li>
284
      <li><code>org.apache.catalina.core.<br/>ApplicationDispatcher.WRAP_SAME_OBJECT</code></li>
Lines 298-304 Link Here
298
      <li>The <code>xmlValidation</code> attribute of any
298
      <li>The <code>xmlValidation</code> attribute of any
299
          <a href="context.html">Context</a> element.</li>
299
          <a href="context.html">Context</a> element.</li>
300
      </ul>
300
      </ul>
301
      </p>
301
302
      <p>Note that changing a number of the above defaults is likely to break
302
      <p>Note that changing a number of the above defaults is likely to break
303
      the majority of systems as some browsers are unable to correctly handle
303
      the majority of systems as some browsers are unable to correctly handle
304
      the cookie headers that result from a strict adherence to the
304
      the cookie headers that result from a strict adherence to the
Lines 342-353 Link Here
342
342
343
    <property name="org.apache.tomcat.websocket. STRICT_SPEC_COMPLIANCE">
343
    <property name="org.apache.tomcat.websocket. STRICT_SPEC_COMPLIANCE">
344
      <p>The default value of this system property is <code>false</code>.</p>
344
      <p>The default value of this system property is <code>false</code>.</p>
345
      <p>If this is <code>true</code> the default values will be changed for:
345
      <p>If this is <code>true</code> the default values will be changed for:</p>
346
      <ul>
346
      <ul>
347
        <li><code>org.apache.tomcat.websocket.server#isEnforceNoAddAfterHandshake</code>
347
        <li><code>org.apache.tomcat.websocket.server#isEnforceNoAddAfterHandshake</code>
348
        (default changes from <code>false</code> to <code>true</code>)</li>
348
        (default changes from <code>false</code> to <code>true</code>)</li>
349
      </ul>
349
      </ul>
350
      </p>
350
351
    </property>
351
    </property>
352
352
353
    <property
353
    <property
Lines 510-516 Link Here
510
         <code>org.apache.juli.logging.UserDataHelper.SUPPRESSION_TIME</code>.
510
         <code>org.apache.juli.logging.UserDataHelper.SUPPRESSION_TIME</code>.
511
         </p>
511
         </p>
512
      <p>The default value is <code>INFO_THEN_DEBUG</code>.</p>
512
      <p>The default value is <code>INFO_THEN_DEBUG</code>.</p>
513
      <p>The errors currently logged using this system are:
513
      <p>The errors currently logged using this system are:</p>
514
         <ul>
514
         <ul>
515
         <li>invalid cookies;</li>
515
         <li>invalid cookies;</li>
516
         <li>invalid parameters;</li>
516
         <li>invalid parameters;</li>
Lines 518-524 Link Here
518
           <code>maxHeaderCount</code> or <code>maxParameterCount</code> limits
518
           <code>maxHeaderCount</code> or <code>maxParameterCount</code> limits
519
           of a <a href="http.html">connector</a>).</li>
519
           of a <a href="http.html">connector</a>).</li>
520
         </ul>
520
         </ul>
521
         Other errors triggered by invalid input data may be added to this
521
         <p>Other errors triggered by invalid input data may be added to this
522
         system in later versions.</p>
522
         system in later versions.</p>
523
    </property>
523
    </property>
524
524
(-)webapps/docs/config/valve.xml (-10 / +6 lines)
Lines 42-54 Link Here
42
  Individual Valves have distinct processing capabilities, and are
42
  Individual Valves have distinct processing capabilities, and are
43
  described individually below.</p>
43
  described individually below.</p>
44
44
45
    <blockquote><em>
45
    <p><em>The description below uses the variable name $CATALINA_BASE to refer the
46
    <p>The description below uses the variable name $CATALINA_BASE to refer the
47
    base directory against which most relative paths are resolved. If you have
46
    base directory against which most relative paths are resolved. If you have
48
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
47
    not configured Tomcat for multiple instances by setting a CATALINA_BASE
49
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
48
    directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
50
    the directory into which you have installed Tomcat.</p>
49
    the directory into which you have installed Tomcat.</em></p>
51
    </em></blockquote>
52
50
53
</section>
51
</section>
54
52
Lines 297-302 Link Here
297
    It is modeled after the
295
    It is modeled after the
298
    <a href="http://httpd.apache.org/">Apache HTTP Server</a> log configuration
296
    <a href="http://httpd.apache.org/">Apache HTTP Server</a> log configuration
299
    syntax:
297
    syntax:
298
    </p>
300
    <ul>
299
    <ul>
301
    <li><b><code>%{xxx}i</code></b> for incoming headers</li>
300
    <li><b><code>%{xxx}i</code></b> for incoming headers</li>
302
    <li><b><code>%{xxx}o</code></b> for outgoing response headers</li>
301
    <li><b><code>%{xxx}o</code></b> for outgoing response headers</li>
Lines 305-311 Link Here
305
    <li><b><code>%{xxx}s</code></b> xxx is an attribute in the HttpSession</li>
304
    <li><b><code>%{xxx}s</code></b> xxx is an attribute in the HttpSession</li>
306
    <li><b><code>%{xxx}t</code></b> xxx is an enhanced SimpleDateFormat pattern</li>
305
    <li><b><code>%{xxx}t</code></b> xxx is an enhanced SimpleDateFormat pattern</li>
307
    </ul>
306
    </ul>
308
    </p>
309
307
310
    <p>All formats supported by SimpleDateFormat are allowed in <code>%{xxx}t</code>.
308
    <p>All formats supported by SimpleDateFormat are allowed in <code>%{xxx}t</code>.
311
    In addition the following extensions have been added:</p>
309
    In addition the following extensions have been added:</p>
Lines 518-527 Link Here
518
516
519
  <subsection name="Example">
517
  <subsection name="Example">
520
    <p>To allow access only for the clients connecting from localhost:</p>
518
    <p>To allow access only for the clients connecting from localhost:</p>
521
<pre>
519
    <source><![CDATA[<Valve className="org.apache.catalina.valves.RemoteAddrValve"
522
    &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
520
   allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1"/>]]></source>
523
       allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1"/&gt;
524
</pre>
525
  </subsection>
521
  </subsection>
526
522
527
</section>
523
</section>
Lines 605-611 Link Here
605
    your virtual host, and then have their identity recognized by all other
601
    your virtual host, and then have their identity recognized by all other
606
    web applications on the same virtual host.</p>
602
    web applications on the same virtual host.</p>
607
603
608
    <p>See the <a href="host.html#Single Sign On">Single Sign On</a> special
604
    <p>See the <a href="host.html#Single_Sign_On">Single Sign On</a> special
609
    feature on the <strong>Host</strong> element for more information.</p>
605
    feature on the <strong>Host</strong> element for more information.</p>
610
606
611
  </subsection>
607
  </subsection>
(-)webapps/docs/images/docs-stylesheet.css (-13 / +9 lines)
Lines 38-44 Link Here
38
38
39
table {
39
table {
40
  border-collapse: collapse;
40
  border-collapse: collapse;
41
  text-align: left;
41
}
42
}
43
table *:not(table) {
44
  /* Prevent border-collapsing for table child elements like <div> */
45
  border-collapse: separate;
46
}
42
47
43
main {
48
main {
44
  /* Remove this once all IEs support <main> element */
49
  /* Remove this once all IEs support <main> element */
Lines 213-246 Link Here
213
}
218
}
214
219
215
220
216
table.defaultTable tr {
221
table.defaultTable tr, table.detail-table tr {
217
    border: 1px solid #CCC;
222
    border: 1px solid #CCC;
218
}
223
}
219
224
220
table.defaultTable tr:nth-child(even) {
225
table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
221
    background-color: #FAFBFF;
226
    background-color: #FAFBFF;
222
}
227
}
223
228
224
table.defaultTable tr:nth-child(odd) {
229
table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
225
    background-color: #EEEFFF;
230
    background-color: #EEEFFF;
226
}
231
}
227
232
228
table.defaultTable th {
233
table.defaultTable th, table.detail-table th {
229
  background-color: #88b;
234
  background-color: #88b;
230
  color: #fff;
235
  color: #fff;
231
}
236
}
232
237
233
table.detail-table th {
234
  background-color: #039acc;
235
  color: #fff;
236
}
237
table.detail-table td {
238
  background-color: #DAF2FA;
239
}
240
241
table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
238
table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
242
  padding: 5px 8px;
239
  padding: 5px 8px;
243
  text-align: left;
244
}
240
}
245
241
246
242
(-)webapps/docs/tomcat-docs.xsl (+2 lines)
Lines 307-312 Link Here
307
307
308
    <div class="subsection">
308
    <div class="subsection">
309
      <!-- Subsection heading -->
309
      <!-- Subsection heading -->
310
      <!-- TODO: When a <subsection> is nested in another <subsection>,
311
           the output should be <h5>, not <h4>. Same with <h6>. -->
310
      <h4 id="{$name}">
312
      <h4 id="{$name}">
311
        <xsl:value-of select="@name"/>
313
        <xsl:value-of select="@name"/>
312
      </h4>
314
      </h4>

Return to bug 55383