Jason Brittain, Ian F. Darwin0596101066, 9780596101060
Updated for the latest version of Tomcat, this new edition offers a complete guide to installing, configuring, maintaining and securing this servlet container. In fact, with such a wealth of new information, this is essentially a new book rather than a simple revision. You will find details for using Tomcat on all major platforms, including Windows, Linux, OS X, Solaris, and FreeBSD, along with specifics on Tomcat configuration files, and step-by-step advice for deploying and running web applications.
This book offers complete information for:
– Installation and startup procedures
– Configuring Tomcat-including realms, roles, users, servlet sessions, and JNDI resources including JDBC DataSources
– Deploying web applications-individual servlets and JSP pages, and web application archive files
– Tuning Tomcat to measure and improve performance
– Integrating Tomcat with Apache Web Server
– Securing Tomcat to keep online thugs at bay
– Tomcat configuration files-server.xml and web.xml, and more
– Debugging and Troubleshooting-diagnosing problems with Tomcat or a web application
– Compiling your own Tomcat, rather than using the pre-built release
– Running two or more Tomcat servlet containers in parallel
This book also offers an overview of the Tomcat open source project’s community resources, including docs, mailing lists, and more. Community interest fueled a strong demand for a Tomcat guide from O’Reilly. The result clearly exceeds expectations.
Table of contents :
Tomcat: The Definitive Guide, Second Edition……Page 1
Table of Contents……Page 4
What’s This Book About?……Page 10
Why an Entire Book on Tomcat?……Page 11
Conventions Used in This Book……Page 13
We’d Like to Hear from You……Page 14
Acknowledgments……Page 15
Jason Brittain’s Acknowledgments……Page 16
Ian Darwin’s Acknowledgments……Page 17
Installing Tomcat……Page 18
Installing Tomcat on Linux……Page 19
Installing Tomcat from an Apache multiplatform binary release……Page 21
Installing Tomcat from this book’s Linux RPM packages……Page 22
Installing Tomcat on Solaris……Page 25
Installing Tomcat on Windows……Page 27
Installing Tomcat on Mac OS X……Page 31
Installing Tomcat on FreeBSD……Page 33
Starting Up and Shutting Down……Page 34
Environment variables……Page 36
Starting and stopping: The general case……Page 37
Starting and stopping on Linux……Page 38
Starting and stopping on Mac OS X……Page 39
Starting and stopping on FreeBSD……Page 40
Restarting Tomcat……Page 41
The general case……Page 42
Restarting Tomcat on Mac OS X……Page 44
Automatic Startup on Linux……Page 46
Automatic Startup on Solaris……Page 47
Automatic Startup on Windows……Page 48
Automatic Startup on Mac OS X……Page 49
Testing Your Tomcat Installation……Page 51
Where Did Tomcat Come From?……Page 52
A Word About Using the Apache Web Server……Page 55
Relocating the Web Applications Directory……Page 56
Changing the Port Number from 8080……Page 59
Relaying Port 80 TCP Connections to Port 8080……Page 60
Running Tomcat on Port 80 via a Service Wrapper……Page 62
Common Errors……Page 67
Java VM Configuration……Page 68
Changing the JSP Compiler……Page 71
Managing Realms, Roles, and Users……Page 72
Realms……Page 73
UserDatabaseRealm……Page 74
JDBCRealm……Page 75
JNDIRealm……Page 76
JAASRealm……Page 77
Basic authentication……Page 80
Digest authentication……Page 81
Form authentication……Page 83
Client-cert authentication……Page 85
Single Sign-on……Page 86
Controlling Sessions……Page 87
StandardManager……Page 88
PersistentManager……Page 89
Using JDBCStore for storing sessions……Page 91
Accessing JNDI and JDBC Resources……Page 92
JDBC DataSources……Page 93
Other JNDI Resources……Page 94
Customized User Directories……Page 95
Common Gateway Interface (CGI)……Page 97
The Tomcat Admin Webapp……Page 99
Deploying Servlet and JSP Web Applications in Tomcat……Page 103
Hosts……Page 106
The Host Manager Webapp……Page 108
Layout of a Web Application……Page 110
Deploying Servlets and JavaServer Pages……Page 111
Deploying an Unpacked Webapp Directory……Page 112
server.xml Context Deployment……Page 113
Context XML Fragment File Deployment……Page 114
Deploying a WAR File……Page 117
server.xml Context Deployment……Page 118
Context XML Fragment File Deployment……Page 120
Hot Deployment……Page 123
Working with WAR Files……Page 124
The Manager Webapp……Page 125
Automation with Apache Ant……Page 128
Building a JAR/WAR……Page 129
Deployment via Ant……Page 130
Copying the WAR file or webapp directory……Page 131
Accessing the Manager webapp……Page 132
The scp Ant Task……Page 136
FileNotFoundExceptions……Page 140
Symbolic Links……Page 141
Tomcat Performance Tuning……Page 143
Measuring Web Server Performance……Page 144
Load-Testing Tools……Page 145
ab: The Apache benchmark tool……Page 147
Siege……Page 150
Apache Jakarta JMeter……Page 151
Tomcat connectors and Apache httpd connector modules……Page 155
Benchmarked hardware and software configurations……Page 158
Benchmark procedure……Page 162
Benchmark results and summary……Page 163
What else we could have benchmarked……Page 169
JVM Performance……Page 170
Operating System Performance……Page 172
Adjusting the Number of Threads……Page 173
Precompiling JSPs by requesting them……Page 174
Precompiling JSPs at webapp start time……Page 175
Precompiling JSPs at build time using JspC……Page 176
Capacity Planning……Page 181
Capacity Planning on Tomcat……Page 182
Additional Resources……Page 184
Integration with the Apache Web Server……Page 186
It’s easier to set up……Page 187
Ease of migration……Page 188
Running Tomcat with Apache httpd……Page 189
Faster startup and shutdown times……Page 190
Installing Apache httpd……Page 191
Sharing the Load Using Separate Port Numbers……Page 194
Troublesome double authentication……Page 196
Proxying from Apache httpd to Tomcat……Page 197
Setting Up Apache httpd……Page 198
Setting Up Tomcat……Page 200
Disadvantages……Page 201
Troublesome dual authentication……Page 202
See also……Page 203
Proxying from Tomcat to Apache httpd……Page 205
Compiling mod_jk……Page 207
Starting up the integrated servers……Page 209
Tomcat Serving HTTP over the APR Connector……Page 211
Using binary releases……Page 213
Building and Installing the APR Connector……Page 214
Configuring Tomcat to Use the APR Connector……Page 216
Tomcat Security……Page 218
Operating System Security Forums……Page 219
Configuring Your Network……Page 220
Multiple Server Security Models……Page 221
Using the SecurityManager……Page 222
Granting File Permissions……Page 225
Setting Up a Tomcat chroot Jail……Page 230
Setting Up a chroot Jail……Page 231
Using a Non-Root User in the chroot Jail……Page 237
Filtering Bad User Input……Page 241
Cross site scripting……Page 242
HTML injection……Page 245
SQL injection……Page 246
Command injection……Page 249
HTTP Request Filtering……Page 250
Installing the BadInputValve……Page 256
See also……Page 257
Securing Tomcat with SSL……Page 258
Generating a Self-Signed Server Certificate……Page 259
Requesting and Installing a Commercial Certificate……Page 262
Configuring the JIO connector for SSL……Page 266
Configuring the APR connector for SSL……Page 267
Configuring the NIO connector for SSL……Page 268
Client Certificates……Page 269
Configuration……Page 276
server.xml……Page 277
Server……Page 281
Executor……Page 282
Connector……Page 284
Host……Page 290
Virtual hosting……Page 292
Context……Page 293
Realm……Page 295
GlobalNamingResources……Page 296
ResourceEnvRef……Page 298
WatchedResource……Page 299
Loader……Page 300
Manager……Page 301
Resources……Page 304
Valve……Page 305
Controlling access logs with an access log valve……Page 306
RemoteHostValve and RemoteAddrValve……Page 313
Limiting request concurrency with SemaphoreValve……Page 314
Transaction……Page 315
Cluster……Page 316
Channel……Page 317
Membership……Page 318
Transport……Page 319
Receiver……Page 320
Interceptor……Page 322
ClusterListener……Page 326
Migrating from Older Versions of Tomcat……Page 327
Migrating from 4.1 to 5.0……Page 328
Migrating from 5.0 to 5.5……Page 329
Migrating from 5.5 to 6.0……Page 331
web-app……Page 333
distributable……Page 335
context-param……Page 336
filter and filter-mapping……Page 337
servlet……Page 338
servlet-mapping……Page 339
session-config……Page 340
welcome-file-list……Page 341
error-page……Page 342
jsp-config and taglib……Page 343
See also……Page 345
login-config……Page 346
ejb-ref and ejb-local-ref……Page 347
service-ref……Page 348
message-destination……Page 349
catalina.policy……Page 350
catalina.properties……Page 351
context.xml……Page 352
Reading Logfiles……Page 353
URLs and the HTTP Conversation……Page 354
Response Codes and Headers……Page 355
Interacting with HTTP……Page 356
Debugging with RequestDumperValve……Page 359
When Tomcat Won’t Shut Down……Page 360
Building Tomcat from Source……Page 364
Installing Apache Ant……Page 365
Obtaining Source Code from Apache’s Subversion Repository……Page 366
Downloading Support Libraries……Page 368
Building Tomcat……Page 369
Tomcat Clustering……Page 371
Clustering Terms……Page 372
The Communication Sequence of an HTTP Request……Page 373
DNS Request Distribution……Page 376
TCP NAT Request Distribution……Page 377
mod_proxy Load Balancing and Failover……Page 379
Distributed Java Servlet Containers……Page 383
Servlet sessions……Page 384
Session affinity……Page 385
Replicated sessions……Page 386
Tomcat 6 Clustering Implementation……Page 387
Features……Page 389
Configuring and Testing IP Multicast……Page 391
Configuring All-to-All Replication……Page 395
Testing Session Replication……Page 401
Configuring Static Membership……Page 404
JDBC Request Distribution and Failover……Page 405
Additional Resources……Page 406
Online Documentation That Shipped with Tomcat……Page 408
Web Sites Related to This Book……Page 409
The #tomcat IRC Channel……Page 410
The Apache Tomcat Mailing Lists……Page 411
Community……Page 412
Installing Java……Page 414
Choosing a Java JDK……Page 415
Working Around Older GCJ and Kaffe JVMs……Page 416
Sun Microsystems Java SE JDK……Page 419
IBM J9 JDK……Page 420
BEA JRockit JDK……Page 421
Excelsior JET……Page 423
Apache Harmony JDK……Page 426
jbchroot.c……Page 427
BadInputValve.java……Page 433
BadInputFilter.java……Page 443
RPM Package Files……Page 456
Index……Page 480
Reviews
There are no reviews yet.