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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
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.
Estimated delivery fee Deliver to Colombia

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Colombia

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

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 the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela