Transcript Slide 1

Introductions
Two decades in software development
 Software Engineering Solutions, Inc.
www.swengsol.com
 Technical Reviewer:
Core JavaServer Faces 3rd Edition
 “Top 1000” reviewer at Amazon.com.

Why another Tomcat book?
Current focus is on administrators
 Tend to view Tomcat as a black box
 Exactly HOW does it do what it does?

Pieces of the Puzzle
Java EE
 HTML over HTTP
 Servlet Container.

Java EE
Uniform Resource Locators
scheme
host
port
context
path
servlet
path
path
info
query
string
path
parameters
http:// www.swengsol.com :80/myWebApp /invoices/EditInvoice /adobe ?id=x123;jsessionid=…
HTML over HTTP
Servlet Specification
WAR file format
 Servlet
 Filter
 Listener
 Session
 web.xml

Servlet Container Interaction
Concurrency
The Tomcat Servlet Container
Nested Components
Top Level Components
Containers
Connectors
Container Overview
Note the shading …
Pipeline pattern
Context helpers
our “baby server”
Containment: Server and Service
Protocol-specific processing
Protocol-agnostic processing
<Server
<Service
port="8005"
name="Catalina">
shutdown="SHUTDOWN">
Containment: Connectors
<Connector port="80" protocol="HTTP/1.1"
… />
Containment: Catalina Engine
<Engine name="Catalina"
defaultHost="localhost”
baseDir=“…”>
…
</Engine>
Containment: Virtual Host
IP-based


Each FQHN resolves to a specific IP
address
Needs dedicated IP addresses
Containment: Virtual Host
Name-based



Multiple FQHNs resolve to a single
IP address
Host: request header interrogated
Simple but requires help with SSL
Containment: Virtual Host
Relative to CATALINA_BASE
<Host
name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" … >
Containment: Context
Vendor-specific
Vendor-agnostic
<Context path="/examples" ...>
Relative
to appBase
Context Fragment
locations:
META-INF/context.xml
CATALINA_HOME/conf/<EngineName>/<HostName>/<contextPath>.xml
Containment: Another View
Advanced Topics:
Java Class Loading First Principles

Benefits
 Late Binding (assembly of functionality)
 Security (single choke point)
 Customization (encrypt, generate, locate)
 Variance across Time
 Variance across Space
 Isolation Zones
Advanced Topics:
Java Class Loading First Principles

Rules
 Consistency (always return same instance)
 Delegation (security)
 Visibility (Delegation hierarchy + CL inversion)
Advanced Topics:
Java Class Loading First Principles

Available Options
 Implicit class loading:
MyClass myClass = new MyClass()
 Explicit class loading:
ClassLoader ldr =
ClassLoader.getSystemClassLoader();
Class cls = ldr.loadClass("MyClass");
MyClass myClass = (MyClass)
cls.newInstance();
Advanced Topics:
Java Class Loading











No parent
Native code in JVM
Core Java classes from rt.jar
JRE_HOME/jre/lib/ext
(implicit CLASSPATH)

Lets you override core
JDK classes
JAVA_HOME
/lib/endorsed
Classes on CLASSPATH
Truncated by Tomcat
CATALINA_HOME/lib
Visible to web apps and
Tomcat code
Directory configured in
[catalina.properties]
Visible only to Tomcat
code




Directory configured in
catalina.properties
Visible to all web apps
WEB-INF/classes and
WEB-INF/lib
Delegates to parent for
standard Java classes
Advanced Topics:
Web Application Class Loading
Thank You!
[email protected]
 www.swengsol.com
 651 270 8457
for training/consulting opportunities.
