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
AU$14.99 AU$53.99
Paperback
AU$67.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
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

Billing Address

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 : 9781847197290
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
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

Billing Address

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.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
AU$249.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 AU$5 each
Feature tick icon Exclusive print discounts
AU$349.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 AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 204.97
Object-Oriented JavaScript - Second Edition
AU$75.99
Tomcat 6 Developer's Guide
AU$67.99
Apache Tomcat 7 Essentials
AU$60.99
Total AU$ 204.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

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.