Szczegóły ebooka

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

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

Brian Fitzpatrick, Damodar Chetty

Ebook
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.
  • Tomcat 6 Developers Guide
    • Table of Contents
    • Tomcat 6 Developer's Guide
    • Credits
    • About the author
    • Acknowledgement
    • About the reviewers
    • Preface
      • What this book covers
      • What you need for this book
      • Who this book is for
      • Conventions
      • Reader feedback
      • Customer support
        • Errata
        • Piracy
        • Questions
    • 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
            • Downloading dependencies
            • Building Tomcat
          • Starting up your shiny new Tomcat
        • Eclipse
      • Summary
    • 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
            • Request parameters and attributes
            • Protocol and URI details
            • Reading request data
            • Connection information
            • HTTP specific information
          • Response
          • Sessions
          • Filters
          • Listeners
        • Web applications
          • Deployment descriptors
      • Summary
    • 3. Servlet Container Overview
      • Component taxonomy
        • Architectural benefits
        • Top Level Components
          • Server
          • Service
        • Connectors
        • Container components
          • Engine
          • Virtual host
            • Basic concepts
            • Virtual host techniques
              • IP-based virtual hosting
              • Name-based virtual hosting
            • Virtual host aliasing
          • Context
            • Context configuration
          • Wrapper
        • Nested components
          • Valve
          • Realm
          • Executor
          • Listener
          • Manager
          • Loader
            • Delegation model
            • Java EE class loading
            • Tomcat's additional class loaders
            • Class reloading in web applications
          • Logger
          • Resources
      • Summary
    • 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
          • Commons Digester
            • The pattern
            • The rule
            • The object stack
          • Using the Digester
          • The server.xml Digester
          • Parsing the server.xml file
          • Initializing the Server
          • Adding a new web application to Tomcat in Eclipse
      • Summary
    • 5. The Server and Service Components
      • Setting up your project
        • Installing MySQL
        • Installing the MySQL driver
        • Enhancing the devguide web application
          • server.xml
          • Context fragment
          • Web application deployment descriptor
          • The contact list servlet
          • Additional notes
      • JNDI service
        • Basic JNDI concepts
          • Context
          • InitialContext
          • Environment naming context
          • JNDI URLs
          • Initializing an InitialContext
          • Looking up names
            • Using multiple naming implementations
            • URL context factory lookup implementation details
          • References
          • JNDI resources
        • Using JNDI
          • Component developer responsibilities
            • Using JNDI within a web application component
            • Publishing logical references
              • <resource-ref>
              • <resource-env-ref>
              • <env-entry>
          • Application deployer responsibilities
            • Resource definition levels
            • Binding logical references
              • <Environment>
              • <Resource>
              • <ResourceLink>
      • StandardServer
        • Lifecycle
        • Shutdown
        • JNDI implementation
          • Structural relationships
            • NamingContext
            • References
            • Factories
          • URL context factory
      • StandardService
      • Summary
    • 6. The Connector Component
      • Connector classification
        • Usage scenario
          • Tomcat with external web server
            • mod_jk
            • mod_proxy
          • Tomcat in standalone mode
          • Protocol
          • Implementation architecture
            • Apache Portable Runtime Connector
            • JIO Connector aka Coyote
            • NIO connector
        • Connector configuration
          • Binding attributes
          • Socket attributes
          • Thread parameters
        • The connector subsystema structural perspective
          • Objective 1: Collection point
          • Objective 2: Establishing relationships
          • Objective 3: Accept incoming connections
          • Objective 4: Maintain a pool of worker threads
          • Objective 5: Maintain a mapping of request processing components
          • Objective 6: Insulate the engine from the outside world
        • Modeling the Request and Response
          • Coyote and Catalina
          • Request classes
            • Coyote Request
            • Catalina Request
          • Response classes
          • HTTP classes
            • MimeHeaders
            • Parameters and ParameterMap
            • Cookies and ServerCookie
          • Stream classes
            • InternalInputBuffer
            • InternalOutputBuffer
            • InputBuffer
            • OutputBuffer
            • ServletInputStream and CoyoteInputStream
            • ServletOutputStream and CoyoteOutputStream
          • Helper classes
            • ByteChunk and CharChunk
            • MessageBytes
        • Socket programming
          • Socket options
            • SO_TIMEOUT
            • TCP_NODELAY
            • SO_LINGER
        • The connector subsystema dynamic perspective
          • Initializing the Apache Portable Runtime (APR)
          • Instantiating a Connector
          • Initializing the Mapper
        • Receiving a request
          • Thread notification
          • End point
          • Connection handler
            • ConcurrentLinkedQueue
          • Http11Processor
          • CoyoteAdapter
          • Completing the request
      • Summary
    • 7. The Engine Component
      • Containers
      • Nested components
      • Engine
        • Configuring an Engine
      • Implementation details
        • StandardEngine
        • Container interface
        • ContainerBase abstract class
          • Parent and child relationships
          • Nested components
          • Valve management
          • Life cycle methods
          • Listener management
          • Background processing
      • Pipeline
        • Pipeline execution scope
        • Valve execution order
        • StandardPipeline
          • Valve manipulation
          • Lifecycle methods
      • Valve
        • ValveBase
        • StandardEngineValve
        • Request Dumper Valve
        • Request Filter Valve
        • AccessLogValve
          • Valve instantiation
          • AccessLogElement
            • Named patterns
          • Valve startup
          • Valve invocation
      • Summary
    • 8. The Host Component
      • Virtual hosts
        • Tomcat virtual hosts
        • Virtual hosting scenarios
          • Case 1: Name-based virtual hosting
            • Aliasing: Multiple domains to a single set of content
          • Case 2: IP-based virtual hosting
      • Configuring a host
      • StandardHost
      • HostConfig
        • Contexts and context fragments
        • DeployedApplication
        • Lifecycle events
          • Deploying context fragments
          • Deploying WAR files and exploded directories
        • Periodic events
      • Examples of name-based virtual hosting
        • Web Application Deployment Descriptor (web.xml)
        • Context Fragment (context.xml)
        • webapp1/index.html
        • build.xml
        • Aliasing
        • Name-based virtual hosting
        • IP-based virtual hosting
      • StandardHostValve
        • The servlet error handling mechanism
        • Exception processing
          • Finding a custom error page by exception type
          • Finding a custom error page by response status code
          • Setting request attributes
          • Forwarding to the error resource
        • Method termination
      • ErrorReportValve
        • Error page mechanism example
      • Summary
    • 9. The Context Component
      • Aspects of the Context component
        • The Context aspect
          • Configuration files
            • Document base and context path
          • Context children
            • WatchedResource
            • Loader
            • Resources
            • ResourceLink
            • Context parameters
            • Environment variables
            • Valves
            • Manager
            • Realm
        • Web application aspect
          • Configuration files
      • Web application resources
        • Resources
        • Resource cache
        • Resource retrieval
          • BaseDirContext
          • FileDirContext
          • ProxyDirContext
            • Looking up resources
            • Cache lookup
            • Miscellaneous methods
      • Shared library mechanism
        • Manifest file format
      • URLs and protocol handlers
        • Accessing resources
        • Protocol handlers
          • java.net.URL
          • java.net.URLStreamHandler
          • java.net.URLConnection
          • java.net.URLStreamHandlerFactory
        • Protocol handler implementation
          • Locating a stream handler
          • The jndi protocol
            • DirContextURLStreamHandlerFactory
            • DirContextURLStreamHandler
            • DirContextURLConnection
      • 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
            • The Mapper
          • 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
          • HelloWorldServlet.java
          • Message.java
          • Listeners
            • MyServletContextListener.java
            • MyServletRequestListener.java
          • MyFilter.java
      • Summary
    • 10. The Wrapper Component
      • StandardWrapper
      • Servlet lifecycle
        • Loading a servlet
      • Mappers
        • Mapping rules
          • Partial URLs
        • Tomcat mappers
          • The connector's mapper
            • Locating the host and context
            • Locating the wrapper
          • Setting up the StandardContext mapper
      • Request processing
      • Filters
        • Filter chain construction
        • Filter chain invocation
      • Request dispatcher
        • Obtaining a request dispatcher
        • Using a request dispatcher
          • Forwards
          • Includes
        • Wrapper classes
          • Wrapper class structure
          • Processing a forward
          • Including a resource
      • Examples
        • Servlets
          • Declaration
        • ForwardingServlet.java
        • Static resources
        • IncludingServlet.java
        • TemplateServlet.java
      • Summary
    • 11. The Manager Component
      • Session propagation mechanisms
        • Cookies
        • URL rewriting
      • Session
        • Session identifiers
        • Session attributes
        • Session lifetime
          • Session creation and access
          • Session validity
          • Session expiry
          • Session cleanup
        • Session lifecycle events
          • Object binding events
          • Session lifecycle events
          • Attribute change events
          • Session migration events
        • Session serialization
          • Serialization
            • Versioning
            • Class loading
          • Serialization in a StandardSession
        • Session multi threading
      • Manager
        • ManagerBase
          • Session security
            • Employing a cryptographic Random Number Generator
            • Generating a session identifier of adequate length
            • Using an inactive timeout to expire sessions
          • Generating a session identifier
          • Session construction
          • Background processing
          • Other methods
        • StandardManager
          • Manager element attributes
            • Session identifier generation attributes
            • Session attributes
          • Session persistence mechanism
        • Persistent manager
          • Persisting sessions
          • Finding a session
          • Background processing
        • Store
          • FileStore
      • Summary
    • Index
  • Tytuł: 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
  • Autor: Brian Fitzpatrick, Damodar Chetty
  • Tytuł oryginału: 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.
  • ISBN: 9781847197290, 9781847197290
  • Data wydania: 2009-12-10
  • Format: Ebook
  • Identyfikator pozycji: e_3bg5
  • Wydawca: Packt Publishing