Mastering Tomcat Development



Similar documents
Course Name: Course in JSP Course Code: P5

This training is targeted at System Administrators and developers wanting to understand more about administering a WebLogic instance.

JBS-102: Jboss Application Server Administration. Course Length: 4 days

Building Web Applications, Servlets, JSP and JDBC

Programming on the Web(CSC309F) Tutorial: Servlets && Tomcat TA:Wael Aboelsaadat

Oracle WebLogic Server

Tomcat 5 New Features

Complete Java Web Development

Apache Jakarta Tomcat

Spring Security 3. rpafktl Pen source. intruders with this easy to follow practical guide. Secure your web applications against malicious

In this chapter, we lay the foundation for all our further discussions. We start

How To Configure The Jasig Casa Single Sign On On A Workstation On Ahtml.Org On A Server On A Microsoft Server On An Ubuntu (Windows) On A Linux Computer On A Raspberry V

Configuring ActiveVOS Identity Service Using LDAP

Crawl Proxy Installation and Configuration Guide

Client-Server Architecture & J2EE Platform Technologies Overview Ahmed K. Ezzat

Course Number: IAC-SOFT-WDAD Web Design and Application Development

JAVA ENTERPRISE IN A NUTSHELL. Jim Farley and William Crawford. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo.

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Glassfish, JAVA EE, Servlets, JSP, EJB

LICENSE4J AUTO LICENSE GENERATION AND ACTIVATION SERVER USER GUIDE

WEBLOGIC ADMINISTRATION

enterprise^ IBM WebSphere Application Server v7.0 Security "publishing Secure your WebSphere applications with Java EE and JAAS security standards

Oracle WebLogic Server 11g: Administration Essentials

CatDV Pro Workgroup Serve r

WebLogic Server 11g Administration Handbook

Professional Portal Development with Open Source lools: Java' Portlet API, Lucene, James, SUde

WebSphere Training Outline

Core Java+ J2EE+Struts+Hibernate+Spring

Oracle WebLogic Server 11g Administration

Web Application Architecture (based J2EE 1.4 Tutorial)

Programma corso di formazione J2EE

JEE Web Applications Jeff Zhuk

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

Design Approaches of Web Application with Efficient Performance in JAVA

IBM WebSphere Server Administration

Japan Communication India Skill Development Center

24x7 Scheduler Multi-platform Edition 5.2

JAVA/J2EE DEVELOPER RESUME

No.1 IT Online training institute from Hyderabad URL: sriramtechnologies.com

Install guide for Websphere 7.0

CA Adapter. Installation and Configuration Guide for Windows. r2.2.9

CrownPeak Java Web Hosting. Version 0.20

Understanding Tomcat Security

Getting Started with Web Applications

Japan Communication India Skill Development Center

NetIQ Identity Manager Setup Guide

The Server.xml File. Containers APPENDIX A. The Server Container

Contents. Client-server and multi-tier architectures. The Java 2 Enterprise Edition (J2EE) platform

WebSphere Server Administration Course

DeskNow. Ventia Pty. Ltd. Advanced setup. Version : 3.2 Date : 4 January 2007

Japan Communication India Skill Development Center

Intro to Load-Balancing Tomcat with httpd and mod_jk

Japan Communication India Skill Development Center

Installation Guide for contineo

Portals, Portlets & Liferay Platform

NetBeans IDE Field Guide

Beginning POJOs. From Novice to Professional. Brian Sam-Bodden

Net-WMS FP Net-WMS SPECIFIC TARGETED RESEARCH OR INNOVATION PROJECT. Networked Businesses. D.8.1 Networked architecture J2EE compliant

Expert Oracle Application. Express Security. Scott Spendolini. Apress"

STREAMEZZO RICH MEDIA SERVER

Technical White Paper - JBoss Security

ServletExec TM 6.0 Installation Guide. for Microsoft Internet Information Server SunONE Web Server Sun Java System Web Server and Apache HTTP Server

DTS Web Developers Guide

Nicholas S. Williams. wrox. A Wiley Brand

Course Description. Course Audience. Course Outline. Course Page - Page 1 of 5

SSL CONFIGURATION GUIDE

Web Express Logon Reference

Java Platform, Enterprise Edition (Java EE) From Yes-M Systems LLC Length: Approx 3 weeks/30 hours Audience: Students with experience in Java SE

Windows 2000 / NT 4.0 / 95 / 98, MS-DOS, Suse Operating Systems

Geac Expense Management: An Architectural Overview

StreamServe Persuasion SP5 StreamStudio

HP Process Automation v6 Architecture/Technologies

Oracle Fusion Middleware

Basic TCP/IP networking knowledge of client/server concepts Basic Linux commands and desktop navigation (if don't know we will cover it )

Lucid Key Server v2 Installation Documentation.

Supplement IV.E: Tutorial for Tomcat. For Introduction to Java Programming By Y. Daniel Liang

As you learned about in Chapter 1, WebSphere Application Server V6 supports the

How To Develop An Application Developer For An Ubio Websphere Studio 5.1.1

Service Manager and the Heartbleed Vulnerability (CVE )

WHITE PAPER. Domo Advanced Architecture

By Wick Gankanda Updated: August 8, 2012

LiquidOffice v4 Architecture/Technologies

Customer Bank Account Management System Technical Specification Document

ServletExec TM 5.0 User Guide

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

MagDiSoft Web Solutions Office No. 102, Bramha Majestic, NIBM Road Kondhwa, Pune Tel: /

Cocoon 2 Programming: Web Publishing with XML and Java"

PRACTICAL ADF APPLICATION DEPLOYMENT FOR FUSION MIDDLEWARE ADMINISTRATORS

Java Web Programming with Eclipse

Web Applications. Originals of Slides and Source Code for Examples:

Xerox DocuShare Security Features. Security White Paper

PowerTier Web Development Tools 4

Apache Tomcat ISAPI Redirector and Canto Cumulus WPP

Transcription:

hep/ Mastering Tomcat Development Ian McFarland Peter Harrison '. \ Wiley Publishing, Inc. '

Part I Chapter 1 Chapter 2 Acknowledgments About the Author Introduction Tomcat Configuration and Management Introduction to Tomcat The Apache Software Foundation Tomcat Tomcat Versions Servlets What's New in the Servlet 2.3 Specification JavaServer Pages What's New in the JSP 1.2 Specification Installing Tomcat Installing the Java SDK Installing the Tomcat Files Windows Installation Linux, OS X, and Other Unix Installations Setting Up the Environment for Tomcat Windows 95/98/ME Windows NT/2000 Linux Mac OS X Starting Up Tomcat for the First Time Windows Linux, OS X, and other Unix xv xvii xix 1 2 3 4 5 6 7 7 9 10 10 10 12 12 12 13 14 14 14 15 vii

viii Contents Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Starting Tomcat on Boot Windows Linux Mac OS X Server Mac OS X Other Unix Flavors First Look at Tomcat Configuring Tomcat Tomcat Configuration Files The HTTP 1.1 Connector The WAEP Connector Other Connectors Webapp Contexts Web Application Configuration Configuring Tomcat with Apache Changes to Apache Configuring Tomcat with Microsoft IIS Adding Registry Entries Virtual Host Configuration Apache Virtual Hosting Tomcat Virtual Hosting Hello World Wide Web Handling a Request What's In a Response Anatomy and Life Cycle of a Servlet The Servlet Life Cycle Servlet Anatomy Life Cycle Events j avax. servlet. ServletContextlistener javax.servlet.servletcontextattributelistener javax.servlet.http.httpsessionlistener javax.servlet.http.httpsessionattributelistener Configuring Life Cycle Listeners Configuring Web Applications Installing in /webapps The Deployment Descriptor: web.xml WAR Files Configuring Servlets from the server.xml File The server.xml File in Depth New Features in Tomcat 4.1 The Basic Model The <Server/> Node The <Service/> Container 17 17 17 19 19 23 24 24 25 28 29 30 31 31 34 34 35 36 37 38 38 40 40 41 44 46 47 49 49 52 57 57 59 60 61 62 64 65 65 67 69 70 71 73 74 74 75 76

The <Engine/> Container 76 The <Realm/> Node 77 The <Logger/> Node 77 The <Host/> Container 78 The <Context/> Container 82 The <Valve/> Node 84 Access Log Valve 84 Remote Host Filter and Remote Address Filter 85 Request Dumper Valve 86 Single Sign On Valve 86 Additional Valves 86 The <Resources/> Node 87 The <Loader/> Node 87 The <Manager/> Node 89 The <Connector/> Node 91 The Coyote HTTP/1.1 Connector 92 Server Proxy Connectors 93 The JK 2 Connector 94 The Webapp Connector 94 The <Factory/> Node 95 The Tomcat Web Server Administration Tool 98 Setup 98 Security 99 Using the Administration Tool 99 99 Chapter 8 Managing Authentication with Realms 101 HTTP Authorization Schemes 101 Setting Up Realms on Tomcat 103 The MemoryRealm 103 JDBC Realms 107 JNDI Realms 111 Custom Realms 113 Scope of Realms 113 Single Sign-On 113 Security and Identity 114 117 Chapter 9 The Manager Application 119 Adding a Management User to the Default MemoryRealm 120 Listing Installed Web Applications 121 Starting and Stopping a Web Application 121 Reloading a Web Application 122 Displaying Statistics 123 Installing a Web Application 123 Removing a Web Application 125 The HTML Interface in Tomcat 4.1 126 The Ant Interface in Tomcat 4.1 126 128

Chapter 10 The Model-View-Controller Architecture 129 What Is MVC Architecture? 129 Model Objects 130 View Objects 130 Communication between Controller and View 130 Controller Objects 131 Advantages of MVC 131 Clean Design 131 Encapsulation 131 Extensibility 132 Reuse and Refactoring 132 Using MVC on the Web 132 134 Part II Tomcat Development Chapter 11 JavaServer Pages 155 What Does a JSP Page Look Like? 135 JSPs Are Really Servlets 137 Jasper: The Tomcat JSP Compiler 144 Expressions 145 Scriptlets and Declarations 145 Page Directives 146 Including Pages 148 Working with Beans 150 Scope 152 Debugging JSPs 152 154 Chapter 12 Tag Libraries 155_ Writing a Basic Tag Library 156 Packaging the Tag 157 Using the Tag 158 A Word about Namespaces 159 A Practical Tag Example 159 Tags with Bodies 167 JSTL: The JSP Standard Tag Library 178 Other Tag Libraries from the ASF 180 182 Chapter 13 MVC with Struts 185 Overview of Struts 184 A Typical Model 1-Style JSP Application 185 The Department Model 185 The Department Database Schema 193 The JSPs for the Model 1 Department Application 194 The MVC Struts Version of the Application 200 List Department Action 201 Action Details 203 The Struts Deptlisting View 203 The Struts Custom Tags 204

Chapter 14 Chapter 15 Chapter 16 Chapter 17 Employeelisting: Action and View Managing Form Data with Struts Templates Struts and XDoclet Template Systems Why Templates Rather than JSP? What Is Velocity? Installing Velocity An Example of Using Velocity The Velocity Template Language References Directives Setting Variables Conditionals Loops Including Files Macros Session Management State Management and HTTP Using HttpSession Expiring Sessions Setting Your Own Cookies Additional Cookie Attributes Databases, Connection Pools, and JDBC JDBC Drivers SQL Database Products MySQL PostgreSQL InterBase/Firebird Oracle DB2 MS SQL Others Building a Database Servlet A Simple Database Servlet Using Connection Pools Connection Pools for JDBC Datasources Database-Aware Objects 207 210 222 224 228 229 229 230 230 231 233 233 238 238 240 241 243 244 245 247 247 249 267 267 268 269 271 271 273 273 274 274 274 275 275 276 276 277 282 282 289 289 The Factory and Modified Singleton Design Patterns 290 The Design 294 Setting Up the Project 295 SmartObject.java 295 ObjectFactoryjava 299 Getting Existing Objects 300 Storing the Data 308

xii Contents Chapter 19 Automated Commits 312 Creating New Objects 316 Using the Framework 319 Adding the getobjects() Method 327 Some Remaining Issues 331 331 Chapter 18 Security 555 Configuring Tomcat 334 SSL, HTTPS, and TLS 334 Using Tomcat Behind Another Server to Provide HTTPS 335 Setting Up the HTTPS Connector 335 Digital Certificates 336 Configuring the Connector 338 The Security Manager 339 Bad Code 339 Pernicious Code 340 Weak, Dangerous, Badly Written, or Misconfigured Code 340 Tomcat and the Security Manager 341 Using the Security Manager with Tomcat 345 Debugging Permissions Issues 345 Permissions 345 Running as an Unprivileged User 346 Servlet Development 347 Using Onetime Passwords 347 Discovering the Protocol of Your Connection 348 Using Certificates as User Credentials 350 Other Techniques for Validating Identity 351 351 Chapter 20 The Development Cycle Structuring Your Workspace Version Control Build Management Running the Software You Build Testing Developing Unit Tests with JUnit Integration Tests Refactoring Staged Release Environment Setting Up Your Development and Testing Distances User Testing Load Testing and Profiling Profiling Your Code 555 354 355 358 361 361 361 366 369 369 369 370 370 371 372 Developing Web Applications with Ant and XDoclet 575 Setting Up Your Environment to Run Ant 374 What Does an Ant Build File Look Like? 375 Properties, File Sets, and Paths 375 Using Properties 377 Conditional Targets 378 Using Filters 378

xiii Creating a Master Build File 380 Using the War Task to Create a WAR File 381 Using XDoclet's webdoclet Task to Create Deployment Descriptors 382 Running Ant for the First Time 392 Using the XDoclet's webdoclet Task to Create Custom Tag TLDs 393 Standard Targets 400 The Hello World Model Project 402 Overview of Model Classes 402 Creating a Project Directory Structure for Model 403 Creating a Build File for a Shared Library 404 Analysis of the Model Project Build File 404 Running an Ant Build File 408 The Hello World Application Project 409 Overview of Application Java Classes 409 Creating a Project Directory Structure for the Application 409 Creating a Manifest File for a Stand-alone Application 410 Creating an Ant Build File for a Stand-Alone Application 410 The Hello World Main Project 413 Creating a Master Build File 413 Analysis of the Master Build File 414 The Applet Project 415 Overview of the Applet Class 415 Creating a Build File for the Applet 419 Building the Applet with Ant 420 Hello World Recap 421 Hello World Model 2 and J2EE 421 The Web Application Project 422 Building and Deploying the Web Application 432 Running the Web Application 434 437 Appendix A Server Configuration (server.xml) Reference 459 Appendix B The Deployment Descriptor (web.xml) Reference 451 Index 479