Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Tomcat 6 Developer's Guide
Tomcat 6 Developer's Guide

Tomcat 6 Developer's Guide: Understanding how a servlet container actually works will add greatly to your Java EE web programming skills, and this comprehensive guide to Tomcat is the perfect starting point.

eBook
$9.99 $28.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Tomcat 6 Developer's Guide

Chapter 2. Servlet API Overview

In the preceding chapter, Apache Tomcat was described as a reference implementation of the Servlet and JSP specifications.

There are two concepts here that go together like peanut butter and jelly a specification and its implementation.

While the bulk of this book is focused on the implementation aspect, this chapter takes a bit of a detour to review the actual specification that is under discussion. Think of it as a walk through the actual requirements that the Tomcat development teams were given to implement.

We will begin by taking a look at how specifications are born and nurtured in the world of Java. We will then look at the Java Enterprise Edition specification, the uber-specification of which the Servlet and JSP specifications are but a part. We will end our tour by examining the Servlet and JSP specifications themselves.

There is a lot of ground to cover, and concepts will be coming at you from every direction. But at the end of this chapter, you will...

Java Community Process


The Java Community Process (JCP) was introduced by Sun Microsystems in 1998. Its primary goal was to engage the greater Java community in the process of developing and revising Java Application Programming Interfaces (APIs). The process is currently at version 2.6 (http://jcp.org/en/procedures/jcp2).

The JCP works by bringing together a group of experts in the subject area, under the guidance of a technical specification lead to not only develop or revise a specification, but also to build a reference implementation as well as a technology compatibility kit.

The process starts with the submission of a Java Specification Request (JSR), which either proposes a brand new specification or a significant revision to an existing specification.

An API is the contract that is made by a software package in terms of the functionality that it makes available to the developer. There is an implicit guarantee that APIs can be relied upon to exist for a very long time. You can see...

Java Enterprise Edition platform


The Java Enterprise Edition platform is nothing more than a set of API specifications that act as building blocks that you can use to build enterprise applications.

Note

With its most recent release, the name of the Java Enterprise Edition platform has been simplified.

Instead of being called the Java 2 Platform, Enterprise Edition (J2EE) v1.5, the version up from J2EE v1.4 is now labeled Java Enterprise Edition 5 or Java EE 5. It is incorrect to abbreviate this name as 'JEE'.

The main drivers for this change are a desire to do away with the '2', which really was beginning to lose its meaning anyway; and to provide center stage to the word 'Java', which is the core technology underlying the different platform editions.

While this may seem like just a rebranding decision, there are some real issues associated with it. Firstly, you need to be aware that you might come across JARs named j2ee.jar and javaee.jar and will need to know which one to pick. Secondly, you...

Hypertext Transfer Protocol (HTTP)


Any communication between two parties requires a clear understanding of how the communication will be conducted. For example, a telephone conversation is initiated by the caller lifting the handset from the cradle, checking for a dial tone, and if the dial tone is present, beginning to dial the desired number. This is usually comprised of a country code prefix, followed by the country code, an area code, and the phone number. If the call is made to another phone within the same country, or within the same area code, the caller might skip these elements.

At the receiving end, the protocol is much simpler. The called party waits until the phone begins to ring, at which point, she picks up the phone and indicates that she is ready to receive the communication by saying 'Hello'.

This telephony protocol has been in place for so many years that it has now become second nature to us, and seems quite unremarkable. Until of course, you move to a different country...

What is the Servlet API?


Now that we've looked at the environment within which the Servlet API executes, the remainder of this chapter is pointed squarely at the Servlet API. This API is one of the oldest within the Java Enterprise Edition family—its first incarnation dates back to 1997.

In this section, we'll take a quick walk through JSR 154 for the Servlet 2.5 API.

Note

The information in this section is applicable to all Java EE compliant servlet containers, including those contained in IBM WebSphere and BEA WebLogic, as well as to Apache Tomcat.

The word 'servlet' conjures up an image of a baby server, and that is exactly what it is. It is a play on the word 'applet', which represents a baby application.

A servlet is a web component, a pluggable piece of functionality that is written in Java and deployed to a web container to extend the container's functionality in a very custom way.

For all intents and purposes, a servlet functions in a very similar manner to its bigger sibling—the web...

Summary


The goal of this chapter was to provide you with a general background of the foundational elements upon which the servlet specification is built. As a result, we covered a significant amount of ground in the course of this chapter.

We began with a tour of the characteristics of an enterprise application that make it a particularly unique problem domain, requiring the special attention of an entire set of APIs, all of which are packaged conveniently in the Java Enterprise Edition Platform specification.

We then took a high level overview of the HTTP version 1.1 and noted that it was a connection oriented, stateless protocol. We saw the methods it defines, as well as with the structure of the request and response that form the core of the protocol.

Finally, we reviewed JSR 154, the Servlet 2.5 specification that forms the requirements that any Java EE compliant servlet container should implement. We looked at the core classes that form the basis of the Servlet API and the basic building...

Left arrow icon Right arrow icon

Key benefits

  • 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

Description

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.

Who is this book 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.

What you will learn

  • 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.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 10, 2009
Length: 416 pages
Edition : 1st
Language : English
ISBN-13 : 9781847197283
Category :
Languages :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Dec 10, 2009
Length: 416 pages
Edition : 1st
Language : English
ISBN-13 : 9781847197283
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 147.97
Object-Oriented JavaScript - Second Edition
$54.99
Tomcat 6 Developer's Guide
$48.99
Apache Tomcat 7 Essentials
$43.99
Total $ 147.97 Stars icon
Banner background image

Table of Contents

11 Chapters
Introduction to Tomcat Chevron down icon Chevron up icon
Servlet API Overview Chevron down icon Chevron up icon
Servlet Container Overview Chevron down icon Chevron up icon
Starting Up Tomcat Chevron down icon Chevron up icon
The Server and Service Components Chevron down icon Chevron up icon
The Connector Component Chevron down icon Chevron up icon
The Engine Component Chevron down icon Chevron up icon
The Host Component Chevron down icon Chevron up icon
The Context Component Chevron down icon Chevron up icon
The Wrapper Component Chevron down icon Chevron up icon
The Manager Component Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(3 Ratings)
5 star 33.3%
4 star 66.7%
3 star 0%
2 star 0%
1 star 0%
Mike Angstadt Nov 23, 2011
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book is very wholistic in its approach to educating the reader. It provides a well-written overview of JavaEE and HTTP in Chapter 2. And whenever it mentions a technology that Tomcat uses in some way, it immediately gives a brief overview of that technology. I found this helpful because it gave me the knowledge I needed to continue reading without having to switch to a search engine. For example, in Chapter 5, when discussing the JNDI functionality that Tomcat comes packaged with, the book pauses for a moment to explain the basic concepts of JNDI itself. The book will also often describe the historical origins of the technology, like in Chapter 1, where it discusses the origins of Ant (spoiler alert: it was created as a custom build system for Tomcat).The instructions for downloading the Tomcat source code and building it are very clear. It provides a specific branch you can checkout from the Tomcat Subversion server, which is the exact version of Tomcat that was used when writing the book. This allows you to follow along without worrying about dealing with differences between what you see in the code and what you see in the book. And it also includes instructions for getting the project properly configured with Eclipse.The later chapters of the book go into a lot of detail about the various classes that make up the Tomcat source code, so be prepared for some serious code spelunking. Anyone who is interested in doing serious coding in the Tomcat codebase will gain a lot from these chapters.I'd recommend this book to people who want to work on the Tomcat source code and need something to guide them through it. I'd also recommend the book to JavaEE developers who use Tomcat on a regular basis and who want to expand their knowledge.
Amazon Verified review Amazon
I. Cherouvim Feb 15, 2010
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I've been writing Java webapps and using tomcat on production for the past 5 years.This book is the best and most complete tomcat analysis book I've read. It is for developers and sysadmins, and it gives both the high level and very detailed views of the system. It starts by taking you through building your own tomcat from source (using ant and eclipse) and extensively explains the servlet spec, JNDI and all parts of the container. It also unravels a very dark corner of java (which directly relates to web containers), the classloader, in a way which does make sense.The book shows all the configuration details, in a pragmatic way. Some of the options and usage patterns are not that well written on the official tomcat documentation site.While reading it I improved my tomcat configuration on production by reducing the memory footprint of the container. I also vastly improved my understanding on the servlet spec, web containers and tomcat itself so I had a chance to improve parts of my production code.The book is very well written and the only disadvantage is that at some parts you feel like the author steps through the code describing it in English. Fortunately these parts are few and short.All in all, the amount of knowledge this book gives is great and nowhere else to be found is such cohesive way.
Amazon Verified review Amazon
Mark Petrovic Nov 10, 2012
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
In the course of porting Jon Brisbin's excellent RabbitMQ-based Tomcat session replication manager from Tomcat v6 to Tomcat v7, I discovered Mr. Chetty's book.Here is the port: [...]While I was able to get the port to work without reading the book, I in fact read the book in parallel with the port. And in so doing I was able to acquire a deeper appreciation and understanding of Tomcat internals and how Tomcat actually works. The book is very well written, and the information is paid-out wisely to bring the reader along in their understanding.The book is based on Tomcat 6, which is not the latest major version. But that really doesn't matter. The basics of Tomcat remain the same, and the reader can fill in specific Tomcat7 information by reading the source code. Is the book perfect? Probably not. But as a glass half full person, this book easily gets the reader to the requisite 80% mark in their understanding of Tomcat internals.I recommend this book to any curious, serious developer of Java webapps that run on Tomcat. It's one of those book I expect to own for a long time, and is likely on the "loan with care" list so I don't lose track of who has it.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.