Tomcat 6 Developer's Guide

Tomcat 6 Developer's Guide
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Take your Java EE web programming skills to the next level by getting an expert's level understanding of the servlet specification and its reference implementation, Apache Tomcat.
  • Build a Tomcat distribution from its source code, and explore the components, classes, and technologies that make up this container.
  • Use standard development tools such as Eclipse, Ant, and Subversion to dissect a Tomcat distribution.
  • Discover the touch points between the servlet specification and a servlet container's implementation.
  • Acquire specialist grade skills in a range of technologies that contribute to Java server side development

Book Details

Language : English
Paperback : 416 pages [ 235mm x 191mm ]
Release Date : December 2009
ISBN : 1847197280
ISBN 13 : 9781847197283
Author(s) : Damodar Chetty
Topics and Technologies : All Books, Networking and Servers, Java, Open Source

Table of Contents

Chapter 1: Introduction to Tomcat
Chapter 2: Servlet API Overview
Chapter 3: Servlet Container Overview
Chapter 4: Starting Up Tomcat
Chapter 5: The Server and Service Components
Chapter 6: The Connector Component
Chapter 7: The Engine Component
Chapter 8: The Host Component
Chapter 9: The Context Component
Chapter 10: The Wrapper Component
Chapter 11: The Manager Component
  • Chapter 1: Introduction to Tomcat
    • What's the story behind Tomcat?
    • What exactly is Tomcat?
      • JSPs
      • Servlet container
    • Why this book?
    • Gathering our tools
      • Java Development Kit (JDK) 6.0
      • Verifying downloaded files
        • Apache Ant
        • Subversion
      • Obtaining the Tomcat source code
        • Using Subversion
        • Tomcat source distribution
        • Getting ready to build Tomcat
        • Starting up your shiny new Tomcat
      • Eclipse
    • Summary
  • Chapter 2: Servlet API Overview
    • Java Community Process
    • Java Enterprise Edition platform
      • What is an enterprise application?
        • Simultaneous users
        • Highly available, reliable, and scalable
        • Heterogeneous environment
        • Distributed nature
      • Java EE architecture
        • Java based
        • Generic APIs
        • Java EE containers and container services
        • Java EE components and their APIs
        • Java EE Service APIs
      • What is a typical Java EE application architecture?
    • Hypertext Transfer Protocol (HTTP)
      • Uniform Resource Locator, URL
      • HTTP methods
        • GET (HTTP/0.9)
        • POST (HTTP/1.0)
        • PUT (HTTP/1.1)
        • DELETE (HTTP/1.1)
        • TRACE (HTTP/1.1)
        • OPTIONS (HTTP/1.1)
        • HEAD (HTTP/1.0)
      • HTTP requests
      • HTTP responses
        • The response line
        • Response headers
      • Spying on HTTP
    • What is the Servlet API?
      • Servlet container
      • Core servlet classes
        • Servlets
        • ServletConfig interface
        • ServletContext interface
        • Multithreading in servlets
        • Request
        • Response
        • Sessions
        • Filters
        • Listeners
      • Web applications
        • Deployment descriptors
    • Summary
  • Chapter 3: Servlet Container Overview
    • Component taxonomy
      • Architectural benefits
      • Top Level Components
        • Server
        • Service
      • Connectors
      • Container components
        • Engine
        • Virtual host
        • Context
        • Wrapper
      • Nested components
        • Valve
        • Realm
        • Executor
        • Listener
        • Manager
        • Loader
        • Logger
        • Resources
    • Summary
  • Chapter 4: Starting Up Tomcat
    • Using scripts
      • Setting up the environment
      • Executing the requested command
    • Setting up your project
      • Modifying the Run/Debug configuration
    • Bootstrapping Tomcat
    • Bootstrapping environment variables
    • Bootstrapping class loading
    • Bootstrapping the embedded container
    • Bootstrapping the Tomcat component hierarchy
    • Initializing the Server
    • Adding a new web application to Tomcat in Eclipse
  • Summary
  • Chapter 5: The Server and Service Components
    • Setting up your project
      • Installing MySQL
      • Installing the MySQL driver
      • Enhancing the devguide web application
    • JNDI service
      • Basic JNDI concepts
      • Using JNDI
    • StandardServer
      • Lifecycle
      • Shutdown
      • JNDI implementation
    • StandardService
  • Summary
  • Chapter 6: The Connector Component
    • Connector classification
      • Usage scenario
      • Protocol
      • Implementation architecture
    • Connector configuration
      • Binding attributes
      • Socket attributes
      • Thread parameters
    • The connector subsystem—a structural perspective
    • Modeling the Request and Response
      • Coyote and Catalina
      • Request classes
      • Response classes
      • HTTP classes
      • Stream classes
      • Helper classes
    • Socket programming
      • Socket options
    • The connector subsystem—a dynamic perspective
      • Initializing the Apache Portable Runtime (APR)
      • Instantiating a Connector
      • Initializing the Mapper
    • Receiving a request
      • Thread notification
      • End point
      • Connection handler
      • Http11Processor
      • CoyoteAdapter
      • Completing the request
  • Summary
  • Chapter 7: The Engine Component
    • Containers
    • Nested components
    • Engine
      • Configuring an Engine
    • Implementation details
      • StandardEngine
      • Container interface
      • ContainerBase abstract class
    • Pipeline
      • Pipeline execution scope
      • Valve execution order
      • StandardPipeline
    • Valve
      • ValveBase
      • StandardEngineValve
      • Request Dumper Valve
      • Request Filter Valve
      • AccessLogValve
  • Summary
  • Chapter 8: The Host Component
    • Virtual hosts
      • Tomcat virtual hosts
      • Virtual hosting scenarios
    • Configuring a host
    • StandardHost
    • HostConfig
      • Contexts and context fragments
      • DeployedApplication
      • Lifecycle events
      • Periodic events
    • Examples of name-based virtual hosting
    • StandardHostValve
      • The servlet error handling mechanism
      • Exception processing
      • Method termination
    • ErrorReportValve
      • Error page mechanism example
  • Summary
  • Chapter 9: The Context Component
    • Aspects of the Context component
      • The Context aspect
        • Configuration files
        • Context children
      • Web application aspect
        • Configuration files
    • Web application resources
      • Resources
      • Resource cache
      • Resource retrieval
        • BaseDirContext
        • FileDirContext
        • ProxyDirContext
    • Shared library mechanism
      • Manifest file format
  • URLs and protocol handlers
    • Accessing resources
    • Protocol handlers
    • Protocol handler implementation
      • Locating a stream handler
      • The jndi protocol
  • Java class loading
    • Advantages of dynamic class loading
    • Class loader hierarchy
    • Class loader rules
    • Implicit and explicit class loading
    • Tomcat class loading
  • Implementing a custom class loader
  • Making a class available
    • The custom web application class loader
    • Class loader initialization
      • ResourceEntry
      • loadClass()
      • findClass()
      • getResource()
  • Context initialization and startup
    • Context initialization
      • Digesting the context fragment
      • Setting the document base
    • Context startup
      • Anti resource locking
      • Setting up the Context's resources
      • Setting up the Context's Loader
      • Publish the work directory
      • Setting up a servlet context
      • Validating optional JARs
      • Naming context
      • Starting nested components
      • Configuring the web application aspect
      • Starting listeners
      • Starting application filters
      • Session manager and the background thread
      • Loading servlets on startup
  • Request processing
  • Hot deploying a context
    • Determining if a reload is necessary
    • Reloading a context
  • Context example
    • Deployment descriptor
    • Source files
      • Listeners
  • Summary
  • Chapter 10: The Wrapper Component
    • StandardWrapper
    • Servlet lifecycle
      • Loading a servlet
    • Mappers
      • Mapping rules
      • Tomcat mappers
    • Request processing
    • Filters
      • Filter chain construction
      • Filter chain invocation
    • Request dispatcher
      • Obtaining a request dispatcher
      • Using a request dispatcher
      • Wrapper classes
    • Examples
      • Servlets
      • Static resources
  • Summary
  • Chapter 11: The Manager Component
    • Session propagation mechanisms
      • Cookies
      • URL rewriting
    • Session
      • Session identifiers
      • Session attributes
      • Session lifetime
      • Session lifecycle events
      • Session serialization
      • Session multi threading
    • Manager
      • ManagerBase
      • StandardManager
      • Persistent manager
      • Store
  • Summary

Damodar Chetty

Damodar Chetty is a lifelong programmer with almost two decades in the computer software industry. He cut his teeth on assembler and BASIC programming, and has journeyed through Fortran, Cobol, Visual Basic, C++, and Java. Along the way he has stubbed his toes often enough to develop a keen sense of where dragons lie. He is currently an independent consultant at Software Engineering Solutions, Inc. doing what he loves most – building high quality software.

Damodar has a degree in Electronics & Telecommunications engineering from the University of Bombay, and higher degrees in Management Sciences from the University of Goa, and in Computer Engineering from the University of Minnesota.

He currently lives in Woodbury, Minnesota with his wife, Devi, his children, Ashwin and Anita, and a passion for photography.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Tomcat 6 Developer's Guide +    Java EE 6 with GlassFish 3 Application Server =
50% Off
the second eBook
Price for both: £24.65

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Obtain an in-depth view of the inner workings of one of the most successful open source projects of all time.
  • Discover the touch points between the Java EE platform specifications and a servlet container's implementation.
  • Learn how to extract the most out of your Tomcat installation by understanding how its various components are implemented.
  • Use standard development tools such as Subversion, and Ant, and Eclipse to build a Tomcat distribution from its source code.
  • Execute Tomcat from inside the Eclipse IDE to watch the various components cooperate in processing a request.
  • Acquire specialist grade skills in a range of technologies and protocols that contribute to Java server side development.
  • Learn advanced software techniques such as building a custom class loader, implementing a custom protocol, and implementing JNDI-based naming and directory services.
  • Explore some of the performance optimizations and design patterns used in building highly scalable and performant software.

In Detail

While Tomcat is one of the most popular servlet containers, its inner workings still remain a mystery to many developers. If you only have a superficial familiarity of how this container actually functions, much of its power remains untapped and underutilized. This book will provide you with all that you need to undertand how to effectively use Apache Tomcat.

This book begins by providing detailed instructions on building a Tomcat distribution. The next few chapters introduce you to the conceptual underpinnings of web servers, the Java EE and servlet specifications, and the Tomcat container. Subsequent chapters address the key Tomcat components, taking care to provide you with the information needed to understand the internal workings of each component. Detailed examples let you walk through a Tomcat installation, stepping into key Tomcat components, as well as into your own custom servlets.

During the course of the book you will encounter various structural components such as the Server and Service; containers such as the Engine, Host, Context, and Wrapper; and helpers such as the Loader, Manager, and Valve. You will also see how Tomcat implements the JNDI API to provide both a directory service for storage agnostic access to its resources, as well as a naming service that implements the Java EE Environment Naming Context.

Along the way you will learn how various elements of the servlet 2.5 specification, as well as the HTTP RFCs are implemented by a servlet container. By the end of your journey, you will be able to count yourself as part of the elite minority of Java EE web developers who truly understand what goes on under the covers of a servlet container.

Take your Java EE web programming skills to the next level by getting an expert's level understanding of the servlet specification and its reference implementation, Apache Tomcat.


This book taps into the author's wide experience as an architect and programmer to explore Tomcat from the ground up. Each major component of Tomcat is covered in careful detail, both from a conceptual and an implementation perspective. Written with detailed explanations and lots of screenshots, the book covers its topics in a concise, practical, and understandable manner.

Who this book is for

This book is intended for web developers who want to take their programming skills to the next level, and for server administrators who want to get a better understanding of the container software they manage.

This book will give you an expert's understanding of every component that contributes to the overall request processing capabilities of Tomcat. In addition, the concepts you learn will be general enough to be carried over to other servlet containers.

This book is also a good starting point for developers who want to understand how high availability and high performance software, such as Tomcat, are designed.

If you wish to contribute to the Tomcat project, then this is an ideal book for you.

Prior knowledge of the Java programming language, and web development on the Java platform is assumed.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software