Tomcat 6 Developer's Guide Build better web applications by learning how a servlet container actually works Damodar Chetty BIRMINGHAM - MUMBAI This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 Tomcat 6 Developer's Guide Copyright © 2009 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: December 2009 Production Reference: 1091209 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847197-28-3 www.packtpub.com Cover Image by Vinayak Chittar ([email protected]) This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 Credits Author Editorial Team Leader Damodar Chetty Akshara Aware Reviewers Project Team Leader David O'Meara Manjiri Nadkarni Michael Besosa Karl Espe Project Coordinator Leena Purkait Alok Gupta Arun Lakkakula Indexer Giridhar Reddy Hemangini Bari David Gordhamer Monica Ajmera Chad LaVigne Vladan Pulec Proofreader Raghu Ramakrishnan Jeff Orloff Dan Syrstad Graphics Nilesh R. Mohite Acquisition Editor Sarah Cullington Production Coordinator Shantanu Zagade Development Editor Swapna Verlekar Cover Work Shantanu Zagade Technical Editor Akash Johari Copy Editor Leonard D'Silva This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 About the author Damodar Chetty is a lifelong programmer with almost two decades in the computer software industry. During that period he’s worked in a variety of languages, tools, and technologies, journeying from programming in assembly language, all the way through to Java and Ruby, making some interesting side trips along the way. He has also been fortunate to have worked in a number of Fortune 500 organizations, and to have engaged with a number of world class software engineers, all of which have helped him perfect his craft. He is also the recipient of the US Department of Interior Information Technology award for 2001. Damodar has an undergraduate degree in Electronics & Telecommunications Engineering from the University of Bombay and graduate degrees in Management Sciences from the University of Goa and in Computer Engineering from the University of Minnesota. He is the owner of Software Engineering Solutions, Inc., a provider of Java EE web development consulting services. He is an avid blogger on his web site at www.swengsol.com. He currently lives in Woodbury, Minnesota with his wife Devi, his children Ashwin and Anita, and a passion for photography. This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 Acknowledgement No book is the product of just the author. He just happens to be the one with his name on the cover. A number of people contributed to the success of this book, and it would take more space than I have to thank each one individually. A special shout out goes to Sarah Cullington, my editor, who is the reason that this book exists. Thank you Sarah for believing in me and for being a wonderful guide through this process. Thank you also to the entire Packt Publishing team for working so diligently to help bring out a high quality product. No words can express my gratitude to my amazing development cohort, with whom it is my privilege to work. In particular, thanks are due to Michael Besosa, Karl Espe, David Gordhamer, Alok Gupta, Arun Lakkakula, Chad LaVigne, Vladan Pulec, Raghu Ramakrishnan, Giridhar Reddy, and Dan Syrstad. Your encouragement and support were invaluable to me. You guys are the best! I must also thank the talented team of developers who have contributed to the Apache Tomcat project. This product is truly an engineering marvel, and it was an instructive experience to rummage through its source. It is a credit to this team that the Tomcat mailing lists are not just civil places, but are also full of interesting tips and tricks, and well worth a visit. Finally, I'd like to acknowledge Joginder Nahil, who provided me with an early taste for the written word. This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 About the reviewers David O'Meara is an experienced developer, architect, and technical manager with over 10 years based in Australia and the USA. Primarily focusing on the Java language and related technologies, his experience is mainly based on web, distributed, and integration projects. He has previously worked on many business domains, but currently devotes the bulk of his time in the maintenance and programming of highly adaptive, semi-autonomous, self-aware bipedal hominids, also known as child raising. The rest of his spare time is often spent answering questions on the JavaRanch, moderating on DZone, or working on open source projects. Michael Besosa is a Principal Architect at Pearson VUE, Inc. Karl Espe and Alok Gupta are Web Engineering Leads at Pearson VUE, Inc. Arun Lakkakula and Giridhar Reddy are Senior Web Software Developers at Pearson VUE, Inc. David Gordhamer is a Web Software Developer at Pearson VUE, Inc. Chad LaVigne, Vladan Pulec, Raghu Ramakrishnan, and Dan Syrstad are web development consultants based in Minnesota. This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111 This book is dedicated to: • My wife Devi, every day with you is a joy and a blessing • My children, Ashwin and Anita, you are the lights of my world • My parents, Nagarathnam and Shanmugam, who taught me all that is important This book would not have been possible without your love and understanding. Thank you from the bottom of my heart. This material is copyright and is licensed for the sole use by ALESSANDRO CAROLLO on 18th December 2009 6393 south jamaica court, , englewood, , 80111