You are previewing Apache Jakarta and Beyond: A Java Programmer’s Introduction.
O'Reilly logo
Apache Jakarta and Beyond: A Java Programmer’s Introduction

Book Description

"If you're a Java developer interested in leveraging open source tools to build multitier applications, Larne Pekowsky can help--this book will walk you all the way through development, build, testing, and deployment. This soup-to-nuts coverage is a rare find."

--Angela Yochem, author of J2EE Applications and BEA WebLogic Server, Second Edition (Prentice Hall, 2004)

The Jakarta project consists of many powerful open source tools for the Java platform, but most lack tutorials or clear online help documentation. Apache Jakarta and Beyond is the definitive guide to using Jakarta and other Java open source tools to develop Web applications more efficiently and effectively.

In this example-packed book, readers will find

  • An introduction to the philosophy behind the Jakarta project

  • Details on many ready-to-use Java toolkits, including Ant, JUnit, Cactus, Log4J, POI, Tomcat, James, Struts, and more

  • In-depth guidelines on how to develop with multiple toolkits

  • A guide to splitting work along lines of "what is available" and "what must be written"

  • Best practices for development, such as the model/view/controller paradigm

  • Numerous examples that can serve as templates for readers' own projects

  • The accompanying CD-ROM contains templates and complete code examples from the book.

    Whether you are developing client applications, Web applications, or Web services, Apache Jakarta and Beyond will help you use existing code to simplify the task at hand.



    Table of Contents

    1. Copyright
      1. Dedication
    2. Preface
      1. Who Should Read This Book?
      2. Organization
      3. A Few Words on Development Environments
    3. Acknowledgments
    4. 1. Introduction
      1. 1.1. On Tools
      2. 1.2. On Open Source
      3. 1.3. The Apache Software Foundation and the Jakarta Project
      4. 1.4. On Application Development
        1. 1.4.1. Modularity in Java
        2. 1.4.2. Model/View/Controller
      5. 1.5. Further Reading
    5. 2. Ant
      1. 2.1. Introduction to Ant
      2. 2.2. Dependencies
      3. 2.3. Sets of Files as Task Arguments
        1. 2.3.1. Including and Excluding Sets of Files
        2. 2.3.2. Patterns
        3. 2.3.3. Other Tools to Build File Sets
      4. 2.4. Global Variables
      5. 2.5. Paths
      6. 2.6. Properties
        1. 2.6.1. Checking for Properties
      7. 2.7. Command-Line Arguments
      8. 2.8. Built-In Tasks
        1. 2.8.1. AntCall
        2. 2.8.2. Copy
        3. 2.8.3. Delete
        4. 2.8.4. Exec
        5. 2.8.5. Get
        6. 2.8.6. Jar
        7. 2.8.7. Java
        8. 2.8.8. Javac
        9. 2.8.9. Javadoc
        10. 2.8.10. A More Complete Example
      9. 2.9. Creating New Tasks
      10. 2.10. Beyond This Book
      11. 2.11. Summary
    6. 3. Eclipse
      1. 3.1. Getting Started with Eclipse
      2. 3.2. Using Ant with Eclipse
      3. 3.3. Beyond This Book
      4. 3.4. Summary
    7. 4. Testing with JUnit
      1. 4.1. An Introduction to Automated Testing
      2. 4.2. JUnit—A Testing Framework
      3. 4.3. More on JUnit
      4. 4.4. How and What to Test
      5. 4.5. Integrating JUnit with Ant
        1. 4.5.1. Integrating JUnit with Eclipse
      6. 4.6. Summary
    8. 5. Testing Web Sites with HTTPUnit
      1. 5.1. An Introduction to HTTPUnit
      2. 5.2. A More Sophisticated Example
      3. 5.3. Testing with ServletRunner
      4. 5.4. Beyond This Book
      5. 5.5. Summary
    9. 6. Further Web Testing with Jakarta Cactus
      1. 6.1. An Introduction to Cactus
      2. 6.2. Writing and Running Cactus Tests
        1. 6.2.1. Testing through a Browser
      3. 6.3. Using Cactus with Eclipse
      4. 6.4. Beyond This Book
      5. 6.5. Summary
    10. 7. Stress Testing with Jakarta JMeter
      1. 7.1. Using JMeter
      2. 7.2. Distributed Testing
      3. 7.3. More Sophisticated Test Plans
      4. 7.4. Using JMeter with Ant
      5. 7.5. How to Stress Test
      6. 7.7. Summary
    11. 8. Simplifying Bean Development with BeanUtils
      1. 8.1. Introduction to BeanUtils
      2. 8.2. Simple Properties
      3. 8.3. Indexed Properties
      4. 8.4. Mapped Properties
      5. 8.5. Nested Properties
      6. 8.6. Converters
      7. 8.7. Adding New Converters
      8. 8.8. Dynamic Beans
      9. 8.9. Enhancing DynaBeans
      10. 8.10. Summary
    12. 9. Traversing Hierarchical Data with JXPath
      1. 9.1. Introduction to XPath
      2. 9.2. Using JXPath
      3. 9.3. Setting Values
      4. 9.4. Creating New Structures
        1. 9.4.1. Extending JXPath
      5. 9.5. A Few Notes on Defining New Contexts
      6. 9.6. Summary
    13. 10. Chapter Database Tools
      1. 10.1. Hsqldb
      2. 10.1.1. Extending Hsqldb
      3. 10.2. Pooling Connections with DBCP
      4. 10.3. Mapping Databases to Objects with OJB
      5. 10.3.1. Defining the Database and Objects
      6. 10.3.2. Defining the Object-Relational Mapping
      7. 10.4. Using OJB
      8. 10.5. Retrieving Data
      9. 10.6. More Sophisticated Queries
      10. 10.7. Lazy Evaluation
      11. 10.8. Related Tools
      12. 10.9. Hiding Persistence from Applications
      13. 10.10. Beyond This Book
      14. 10.11. Summary
      15. Endnotes
    14. 11. Logging
      1. 11.1. The Java.util.logging Package
        1. 11.1.1. Logging Messages
        2. 11.1.2. How Logging Is Handled
        3. 11.1.3. Filtering
        4. 11.1.4. Configuring Logging through the API
        5. 11.1.5. Using Configuration Files
        6. 11.1.6. Creating New Handlers
        7. 11.1.7. More on Formatting
      2. 11.2. Log4j
        1. 11.2.1. Using Log4j
        2. 11.2.2. Configuring Log4j
        3. 11.2.3. The Log4j Appenders
          1. RollingFileAppender
          2. DailyRollingFileAppender
          3. SocketAppender
          4. TelnetAppender
          5. SMTPAppender
          6. NTEventLogAppender
          7. SyslogAppender
          8. JDBCAppender
          9. AsyncAppender
        4. 11.2.4. Extending Log4j
      3. 11.3. Beyond This Book
      4. 11.4. Summary
    15. 12. Configuring Program Options
      1. 12.1. Jakarta CLI
      2. 12.2. Jakarta Digester
        1. 12.2.1. Custom Handlers
      3. 12.3. Beyond This Book
      4. 12.4. Summary
    16. 13. Working with Text 1: Regular Expressions
      1. 13.1. Regular Expressions
      2. 13.2. ORO Regular Expressions
        1. 13.2.1. Subpatterns
        2. 13.2.2. Greediness and Reluctance
        3. 13.2.3. Substitutions
      3. 13.3. Jakarta Regexp
      4. 13.4. The JDK1.4 Pattern Matching Classes
        1. 13.4.1. Two Longer Examples
      5. 13.5. Beyond This Book
      6. 13.6. Summary
    17. 14. Working with Text 2: Searching
      1. 14.1. Creating Indices
      2. 14.2. Using Indices
      3. 14.3. Indexing Web Pages
      4. 14.4. Beyond This Book
      5. 14.5. Summary
    18. 15. Creating Office Documents with POI
      1. 15.1. Poifs
      2. 15.2. Excel
      3. 15.3. Creating Spreadsheets
        1. 15.3.1. Formatting
      4. 15.4. Templating
      5. 15.5. Word
      6. 15.6. Beyond This Book
      7. 15.7. Summary
    19. 16. Scripting
      1. 16.1. Running BeanShell
      2. 16.2. The BeanShell Language
      3. 16.3. Functions
      4. 16.4. Implementing Interfaces
      5. 16.5. Full Java Compatibility
      6. 16.6. Calling BeanShell from Java
      7. 16.7. Motivation for Scripting
        1. Experimenting with New APIs
        2. Rapid Testing
        3. Rapid Development
        4. Configurable Behavior
      8. 16.8. Beyond This Book
      9. 16.9. Summary
    20. 17. Tomcat
      1. 17.1. Starting Tomcat
      2. 17.2. A Tour of Tomcat
      3. 17.3. Creating a Web Application
      4. 17.3.1. The web.xml File
      5. 17.4. Security
      6. 17.4.1. Authentication
      7. 17.5. Realms
        1. 17.5.1. File-Based Realm
        2. 17.5.2. JDBC Realm
        3. 17.5.3. Encrypting Passwords
      8. 17.6. Encryption and Server Validation
      9. 17.7. Client Certificates
      10. 17.8. Certificate-Based Authentication
      11. 17.9. Global Resources
      12. 17.10. Web-Based Management and Administration
      13. 17.11. Beyond This Book
      14. 17.12. Summary
    21. 18. The Standard Tag Library
      1. 18.1. Tag Libraries
      2. 18.2. Tags with Bodies
      3. 18.3. Dynamic Attributes in Tags
      4. 18.4. Displaying Expressions
      5. 18.5. Formatting Output
      6. 18.6. Iteration in a Page
      7. 18.7. Conditionally Including Sections of a Page
      8. 18.8. Browser Detection
      9. 18.9. Combining Tags
      10. 18.10. Selecting between Multiple Choices
      11. 18.11. The SQL Tags
        1. 18.11.1. Inserting Data from JSPs
        2. 18.11.2. SQL and Beans
      12. 18.12. The XML Tags
        1. 18.12.1. Selecting Data from an XML Document
        2. 18.12.2. Formatting XML
      13. 18.13. Beyond This Book
      14. 18.14. Summary
    22. 19. Struts
      1. 19.1. Some Common Controller Tasks
      2. 19.2. Struts: An Application Toolkit
      3. 19.3. Using Struts
      4. 19.4. Simplifying Form Beans with the Validator
      5. 19.5. Eliminating Form Beans
      6. 19.6. The Pros and Cons of Struts
      7. 19.7. Beyond This Book
      8. 19.8. Summary
    23. 20. Cocoon
      1. 20.1. Building and Configuring Cocoon
      2. 20.2. Using Cocoon
      3. 20.3. Accessing Databases
      4. 20.4. Writing to Databases
      5. 20.5. The Pros and Cons of Cocoon
      6. 20.6. Beyond This Book
      7. 20.7. Summary
    24. Appendix A
      1. A.1 Dynamic Proxies