Easy-to-follow coverage of twelve indispensable Jakarta Commons packages
Code examples that show innovative uses of Commons components, including using HttpClient to access Web resources, FileUpload for handling HTTP file uploads, and BeanUtils for easy form generation
Detailed instructions for combining the Commons project libraries with the popular Eclipse IDE
Save time and money with reusable open source Java™ components
Master the Jakarta Commons Library of Open Source JavaTM Components
Using the Apache Jakarta Commons reusable Java™ components, you can leverage the work of the global open-source community to solve common programming problems reliably, quickly, and inexpensively. But, to use the Commons libraries effectively, you need far more guidance than the official documentation offers. In Apache Jakarta Commons: Reusable Java™ Components, Will Iverson covers what Java developers need to know to take full advantage of Jakarta Commonsstarting right now.
Iverson begins with a definitive overview of the Commons project: goals, installation, and getting started with Commons components. Next, he presents example-rich chapters on the twelve most useful Commons packages, covering topics ranging from HTTP FileUpload to database connectivity. Iverson provides detailed code samples for every component he describes. After you've mastered the core Jakarta Commons packages, you'll constantly rely on this book's handy seventy-five page quick-reference. Iverson's coverage includes
Downloading Commons project libraries and installing them into Eclipse
Programmatically accessing resources via HTTP, FTP, NNTP, and other Internet protocols
Using the Jakarta Commons suite of configurable object pools
Managing database connectivity in Swing applicationsand anywhere containers aren't doing it for you
Using BeanUtils to generate forms and gain runtime access to information provided by JavaBeans-style objects
Traversing complex object graphs with JXPath
Using Jakarta Commons' advanced collections tools to establish richer object relationships
Extending java.lang with better methods for manipulating core classes
Implementing conversion routines, configurable logging, command-line help, and more
Exploring the newest packages, including emerging "sandbox" packages
Whether you're building code for front-end Web applications, client-side software, or back-end servers, learning Jakarta Commons will make you far more efficient. Apache Jakarta Commons is the fastest way to master and get results with Commons.
About the Web Site
All of the book's sample Java programs are available for download from: http://www.cascadetg.com/commons/.
© Copyright Pearson Education. All rights reserved.
About the Author
Proper versus Sandbox
Obtaining and Installing
Configuration Under Eclipse
Web and User Interfaces
Building an Application with Fileupload
FileUpload Application User Interface
Sample Fileupload Application Code
Limitations and Security Issues
A Simple Cookie-Based Web Site
Simple Swing Client
Swing Client User Interface
Swing Client Code
Interfaces and Implementation
Thread Pool Example
Object Factory Example
6. DBCP (Database Connection Pool).
Building the DataSource
Legacy JDBC Driver
Using Beanutils to Generate Forms
Presenting the Form
Setting up the Example Object Graph
Exploring the Hierarchy
XPath and JXPath Syntax
Supported Data Types
Base Lang Classes
CharRange, CharSet, and CharSetUtils
ObjectUtils and ObjectUtils.Null
URL Form Encoding
13. CLI (Command-line Interface).
Building a Command-Line Interface
Running Command Line
Behind the Scenes with ClassPathTool
14. Other Projects.
Additional Commons Proper Projects
A. Lang Reference.
B. Apache License, Version 2.0.
I originally noticed the Jakarta Commons libraries while working with Apache Jakarta Tomcat. At some point, Tomcat started to include a suite of small libraries with commons in the name. They started to show up everywhere, in all sorts of other open source projects. At first, it was slightly off-putting—what exactly is commons-lang.jar, and why is this tiny library showing up in all of my software?
Exploring the Jakarta Commons, I first found a broad suite of what I would characterize as "utility" code—things that often wound up in my software in packages named things like "util." Digging deeper, I found useful libraries to solve common problems, interesting algorithms, and more. In brief, by using the Jakarta Commons, I found I spent less time reinventing the wheel, and more time solving the problem at hand.
Virtually every Java developer can take advantage of various Jakarta Commons components—from the utilities provided by the Collections and Lang packages, through the networking components afforded by the HttpClient and Net packages. These components underlie Apache Tomcat, Struts, and countless other projects, helping move forward both the Java industry and the Java platform.
The first few chapters cover the more web-specific packages, including FileUpload, HttpClient, and the Net suite of protocol implementations. The Pool and DBCP packages are useful for a broader range of applications. BeanUtils and JXPath provide easier ways to work with objects. Logging, Lang, and Collections are a suite of tools applicable to almost every application. Finally, Codec provides a suite of specialized conversion routines, useful for data transfer, security, and (interestingly) phonetic analysis. Finally, the CLI package provides support for building command-line applications.Chapter 1: Overview
This chapter shows you where to download the various Commons components, and also how to install both the libraries and the documentation into Eclipse.Chapter 2: File Upload
This chapter shows how to easily add file upload capabilities to your web application.Chapter 3: HttpClient
This chapter shows how to programmatically access HTTP resources. HttpClient provides many features, including cookie management and support for a broad range of features.Chapter 4: Net
This chapter shows how a wide variety of common Internet protocols can be accessed, including FTP, NNTP, and others.Chapter 5: Pool
This chapter demonstrates the use of a suite of configurable object pools.Chapter 6: DBCP (Database Connection Pool)
This chapter covers the DBCP package, useful for Swing applications and other situations in which a container is not managing database connectivity for you.Chapter 7: BeanUtils
This chapter shows how the information provided by JavaBeans-style objects can easily be accessed at run-time.Chapter 8: JXPath
As you build applications composed of complex graphs of objects, traversing those objects can become tedious. JXPath provides an easy mechanism for walking through these graphs.Chapter 9: Logging
Virtually every application can benefit from configurable logging—and the logging package is a good place to get started.Chapter 10: Lang
Lang is one of the most useful packages, but one of the hardest to get started with. This chapter provides an overview of the Lang package, helping you get oriented.Chapter 11: Collections
This chapter covers powerful tools for working with collections—richer object relationships.Chapter 12: Codec
This chapter shows how to use a suite of specialized conversion routines useful for data transfer, security, and phonetic analysis.Chapter 13: CLI (Command Line Interface)
Learn how to present consistent, useful command-line configuration and help information—with a bonus class path search tool.Chapter 14: Other Projects
This chapter provides a roadmap for a broad suite of other Commons packages—both the proper and sandbox packages.Downloading the Code
The code presented in this book is available for download from http://www.cascadetg.com/commons/ .
© Copyright Pearson Education. All rights reserved