HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
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.
Understanding BeanUtils in Apache Jakarta Commons
Preface
Acknowledgments
About the Author
1. Overview.
Proper versus Sandbox
License
Obtaining and Installing
Configuration Under Eclipse
From Here
2. FileUpload.
Web and User Interfaces
Fileupload Design
Building an Application with Fileupload
FileUpload Application User Interface
Sample Fileupload Application Code
Application Presentation
Application Logic
Limitations and Security Issues
Summary
3. HttpClient.
A Simple Cookie-Based Web Site
Understanding Httpclient
Simple Swing Client
Swing Client User Interface
Swing Client Code
Summary
4. Net.
Net Overview
FTP Functionality
FTP Implementation
NNTP Functionality
NNTP Implementation
Summary
5. Pool.
Interfaces and Implementation
Thread Pool Example
Object Factory Example
Worker Thread
Summary
6. DBCP (Database Connection Pool).
Standalone DataSources
Client Connectivity
Building the DataSource
Legacy JDBC Driver
Summary
7. BeanUtils.
Understanding Beanutils
Using Beanutils to Generate Forms
Sample JavaBeans
Presenting the Form
FormBean
FormBeanUtils
Summary
8. JXPath.
Setting up the Example Object Graph
Exploring the Hierarchy
XPath and JXPath Syntax
Basic XPath
Complex XPath
JXPath Extensions
Supported Data Types
Summary
9. Logging.
Trace Levels
Using Logging
Logging Output
Summary
10. Lang.
Base Lang Classes
ArrayUtils
BitField
BooleanUtils
CharRange, CharSet, and CharSetUtils
ClassUtils
ObjectUtils and ObjectUtils.Null
RandomStringUtils
SerializationUtils
StringEscapeUtils
StringUtils
SystemUtils
Validate
WordUtils
Builder
Enum
Exception
Math
Time
Summary
11. Collections.
Collections Concepts
Bag
Bean
BidiMap
Blocking
Bounded
Buffer
Circular
Closure
Collating
Comparator
Composite
Cursorable
Factory
Fast
Fifo
FixedSize
Flat3
Functor
Hash
Identity
Lazy
Linked
List
LRU
Map
Multi
NodeCaching
ObjectGraph
Ordered
Predicate
Reference
Set
Singleton
StaticBucket
Synchronized
Transformed/Transformer
Typed
Unmodifiable
Summary
12. Codec.
Character Encodings
Base64 Encoding
URL Form Encoding
Hash Generation
Phonetic Analysis
Summary
13. CLI (Command-line Interface).
ClassPathTool Overview
Building a Command-Line Interface
Running Command Line
Behind the Scenes with ClassPathTool
Summary
14. Other Projects.
Additional Commons Proper Projects
Betwixt
Chain
Configuration
Daemon
DbUtils
Digester
Discovery
EL
IO
Jelly
Jexl
Latka
Launcher
Math
Modeler
Primitives
Validator
Sandbox Projects
Attributes
Cache
Clazz
Compress
Convert
Events
FeedParser
Functor
Id
JJar
Mapper
Messenger
Resources
Scaffold
SQL
ThreadPool
Transaction
VFS
Workflow
Summary
A. Lang Reference.
B. Apache License, Version 2.0.
Index.
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: OverviewThis 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 UploadThis chapter shows how to easily add file upload capabilities to your web application.
Chapter 3: HttpClientThis 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: NetThis chapter shows how a wide variety of common Internet protocols can be accessed, including FTP, NNTP, and others.
Chapter 5: PoolThis 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: BeanUtilsThis chapter shows how the information provided by JavaBeans-style objects can easily be accessed at run-time.
Chapter 8: JXPathAs 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: LoggingVirtually every application can benefit from configurable logging—and the logging package is a good place to get started.
Chapter 10: LangLang 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: CollectionsThis chapter covers powerful tools for working with collections—richer object relationships.
Chapter 12: CodecThis 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 ProjectsThis chapter provides a roadmap for a broad suite of other Commons packages—both the proper and sandbox packages.
Downloading the CodeThe code presented in this book is available for download from http://www.cascadetg.com/commons/ .
© Copyright Pearson Education. All rights reserved