1 / 26

Introductions

Delve into Tomcat's inner workings, from Java EE components to Servlet Container interactions. Understand advanced Java class loading principles and explore web application class loading. Discover key containment structures and Tomcat-specific configurations.

lilat
Download Presentation

Introductions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.

  2. 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?

  3. Pieces of the Puzzle • Java EE • HTML over HTTP • Servlet Container.

  4. Java EE

  5. Uniform Resource Locators context path servlet path path info query string path parameters scheme host port http:// www.swengsol.com :80 /myWebApp ?id=x123 ;jsessionid=… /invoices/EditInvoice /adobe

  6. HTML over HTTP

  7. Servlet Specification • WAR file format • Servlet • Filter • Listener • Session • web.xml

  8. Servlet Container Interaction

  9. Concurrency

  10. The Tomcat Servlet Container Nested Components Top Level Components Containers Connectors

  11. Container Overview • A valve: • Extends Tomcat functionality • Is Tomcat-specific • Must be super-efficient Note the shading … Pipeline pattern Context helpers our “baby server”

  12. Containment: Server and Service Protocol-specific processing Protocol-agnostic processing <Server port="8005" shutdown="SHUTDOWN"> <Service name="Catalina">

  13. Containment: Connectors <Connector port="80" protocol="HTTP/1.1" … />

  14. Containment: Catalina Engine <Engine name="Catalina" defaultHost="localhost” baseDir=“…”> … </Engine>

  15. Containment: Virtual Host • Each FQHN resolves to a specific IP address • Needs dedicated IP addresses IP-based

  16. Containment: Virtual Host • Multiple FQHNs resolve to a single IP address • Host: request header interrogated • Simple but requires help with SSL Name-based

  17. Containment: Virtual Host Relative to CATALINA_BASE <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" … >

  18. Containment: Context Vendor-agnostic Vendor-specific <Context path="/examples" ...> Relative to appBase Context Fragment locations: META-INF/context.xml CATALINA_HOME/conf/<EngineName>/<HostName>/<contextPath>.xml

  19. Containment: Another View

  20. 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

  21. Advanced Topics: Java Class Loading First Principles • Rules • Consistency (always return same instance) • Delegation (security) • Visibility (Delegation hierarchy + CL inversion)

  22. 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();

  23. Advanced Topics: Java Class Loading • Lets you override core JDK classes • JAVA_HOME/lib/endorsed • No parent • Native code in JVM • Core Java classes from rt.jar • JRE_HOME/jre/lib/ext(implicit CLASSPATH) • 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

  24. Advanced Topics: Web Application Class Loading [1] [3] [2]

  25. Thank You! • damodarchetty@gmail.com • www.swengsol.com • 651 270 8457for training/consulting opportunities.

More Related