Обучалка в Телеграм

Jakarta Commons Cookbook, O Brien T.M., 2004


Jakarta Commons Cookbook, O'Brien T.M., 2004.

   This collection provides expert tips for using the utilities of the Java-based Jakarta Commons open source project. You don't have to be an expert, the book's solution-based format contains code examples for a wide variety of web, XML, network, testing, and application projects. If you want to learn how to use Jakarta Commons utilities to create powerful Java applications and tools, the Jakarta Commons Cookbook is for you.

Jakarta Commons Cookbook, O'Brien T.M., 2004

   In this book, you'll find information about a set of libraries developed within the Jakarta Commons (also referred to as "Commons"). Commons (http://jakarta.apache.org/commons) is a set of small, popular components from the Apache Software Foundation's Jakarta project. Ranging from the elementary to the complex, many would consider some of these libraries indispensable to any Java© project. These components are so widespread, they may already be on your classpath. If you develop an application using Jakarta Struts, Apache Tomcat, or Hibernate, you have Commons BeanUtils and Commons Logging in your classpath. If you just installed Red Hat Enterprise Linux with the default configuration, you've got Commons libraries somewhere in /usr. If you downloaded Sun's J2EE 1.4 SDK, you will have also downloaded Commons Logging and Commons Launcher. While Jakarta Commons may be everywhere, many are still unaware of the capabilities these components provide.
This book uses Jakarta Commons to focus on tactical implementation details, answering such questions as: How do we parse XML? How do we serialize beans? Is there an easier way to work with Collections? How do we work with HTTP and keep track of cookies? The tactical is often sacrificed for the strategic. Consider a complex J2EE system with a solid, well-conceived architecture. The strategic (or high-level) design appears reasonable from 40,000 feet, but as soon as you drill into the details, you notice that every Servlet or JSP contains pages upon pages of unmaintainable and unnecessary code because the developers were not aware of some valuable time-saver like BeanUtils, Collections, or the Digester. Or, worse, the developer may have spent a week reimplementing most of the capabilities of Commons BeanUtils even though BeanUtils was already in the classpath. Knowing what Jakarta Commons has to offer often helps to inform decisions made at the lowest level.

Copyright
Preface
What's Inside
Conventions Used in This Book
What You'll Need
The Jakarta Commons Community
The Apache Software License
Using Code Examples
We'd Like to Hear from You
Acknowledgments
Chapter 1.Supplements to the Java 2 Platform
Introduction
Recipe 1.1.Obtaining Commons Lang
Recipe 1.2.Joining the Commons-User Mailing List
Recipe 1.3.Getting the Commons Lang Source Code
Recipe 1.4.Automating the Generation of toString( ) Content
Recipe 1.5.Customizing Generated toString( ) Content
Recipe 1.6.Automating hashCode( ) and equals( )
Recipe 1.7.Automating compareTo( )
Recipe 1.8.Printing an Array
Recipe 1.9.Cloning and Reversing Arrays
Recipe 1.10.Transforming Between Object Arraysand Primitive Arrays
Recipe 1.11.Finding Items in an Array
Recipe 1.12.Creating a Map from a Multidimensional Array
Recipe 1.13.Formatting Dates
Recipe 1.14.Rounding Date Objects
Recipe 1.15.Truncating Date Objects
Recipe 1.16.Creating an Enum
Recipe 1.17.Generating Unique Numeric Identifiers
Recipe 1.18.Validation of Method Parameters
Recipe 1.19.Measuring Time
Chapter 2.Manipulating Text
Introduction
Recipe 2.1.Setting Up StringUtils and WordUtils
Recipe 2.2.Checking for an Empty String
Recipe 2.3.Abbreviating Strings
Recipe 2.4.Splitting a String
Recipe 2.5.Finding Nested Strings
Recipe 2.6.Stripping and Trimming a String
Recipe 2.7.Chomping a String
Recipe 2.8.Creating an Emphasized Header
Recipe 2.9.Reversing a String
Recipe 2.10.Wrapping Words
Recipe 2.11.Testing the Contents of a String
Recipe 2.12.Measuring the Frequency of a String
Recipe 2.13.Parsing Formatted Strings
Recipe 2.14.Calculating String Difference
Recipe 2.15.Using Commons Codec
Recipe 2.16.Getting the Commons Codec Source Code
Recipe 2.17.Calculating Soundex
Chapter 3.JavaBeans
Introduction
Recipe 3.1.Representing Beans Graphically
Recipe 3.2.Obtaining Commons BeanUtils
Recipe 3.3.Getting the Commons BeanUtils Source Code
Recipe 3.4.Accessing Simple Bean Properties
Recipe 3.5.Accessing Nested Bean Properties
Recipe 3.6.Accessing Indexed Bean Properties
Recipe 3.7.Accessing Mapped Bean Properties
Recipe 3.8.Accessing a Simple, Nested, Indexed, and Mapped Bean Property
Recipe 3.9.Determining the Type of a Bean Property
Recipe 3.10.Comparing Beans
Recipe 3.11.Copying Bean Properties
Recipe 3.12.Cloning a Bean
Recipe 3.13.Setting a Bean Property
Recipe 3.14.Testing Property Access
Recipe 3.15.Validating Beans with Predicates
Recipe 3.16.Creating a Map of Bean Properties
Recipe 3.17.Wrapping a Bean with a Map
Recipe 3.18.Creating a Dynamic Bean
Recipe 3.19.Getting and Setting Properties as Strings
Chapter 4.Functors
Introduction
Recipe 4.1.Obtaining Commons Collections
Recipe 4.2.Getting the Commons Collections Source Code
Recipe 4.3.Reversing a Comparator
Recipe 4.4.Chaining Comparators
Recipe 4.5.Comparing Nulls
Recipe 4.6.Fixed-Order Comparison
Recipe 4.7.Using Simple Predicates
Recipe 4.8.Writing a Custom Predicate
Recipe 4.9.Creating Composite Predicates
Recipe 4.10.Transforming Objects
Recipe 4.11.Creating a Chain of Transformations
Recipe 4.12.Applying Conditional Transformations
Recipe 4.13.Writing a Closure
Recipe 4.14.Chaining Closures
Recipe 4.15.Modeling Conditional Statements with Closures
Recipe 4.16.Modeling Loops with Closures
Chapter 5.Collections
Introduction
Recipe 5.1.Obtaining Commons Collections
Recipe 5.2.Using a Looping Iterator
Recipe 5.3.Iterating Over an ArrayList
Recipe 5.4.Filtering a Collection with a Predicate
Recipe 5.5.Iterating Through Distinct Elements
Recipe 5.6.Using a Bag
Recipe 5.7.Using a Buffer
Recipe 5.8.Creating a Priority Queue
Recipe 5.9.Using a Blocking Buffer
Recipe 5.10.Storing Multiple Values in a Map
Recipe 5.11.Retrieving a Key by a Value
Recipe 5.12.Using a Case-Insensitive Map
Recipe 5.13.Creating Typed Collections and Maps
Recipe 5.14.Constraining Map Values
Recipe 5.15.Constraining List Contents
Recipe 5.16.Transforming Collections
Recipe 5.17.Creating a Least Recently Used Cache
Recipe 5.18.Using a Lazy Map
Recipe 5.19.Counting Objects in a Collection
Recipe 5.20.Performing Set Operations
Recipe 5.21.Retrieving Map Values Without Casting
Chapter 6.XML
Introduction
Recipe 6.1.Obtaining Jakarta Commons Digester
Recipe 6.2.Turning XML Documents into Objects
Recipe 6.3.Namespace-Aware Parsing
Recipe 6.4.Creating a Simple XML Command Language
Recipe 6.5.Variable Substitution and XML Parsing
Recipe 6.6.Obtaining Jakarta Commons Betwixt
Recipe 6.7.Turning Beans into XML Documents
Recipe 6.8.Customizing XML Generated from an Object
Recipe 6.9.Turning XML Documents into Beans
Chapter 7.Application Infrastructure
Introduction
Recipe 7.1.Obtaining Commons CLI
Recipe 7.2.Parsing a Simple Command Line
Recipe 7.3.Parsing a Complex Command Line
Recipe 7.4.Printing Usage Information
Recipe 7.5.Obtaining Commons Configuration
Recipe 7.6.Configuring Applications with Properties Files
Recipe 7.7.Configuring Applications with XML
Recipe 7.8.Using Composite Configuration
Recipe 7.9.Obtaining Commons Logging
Recipe 7.10.Using an Abstract Logging Interface
Recipe 7.11.Specifying a Logging Implementation
Recipe 7.12.Obtaining Apache Log4J
Recipe 7.13.Configuring Log4J with a Properties File
Recipe 7.14.Configuring Log4J with XML
Chapter 8.Math
Introduction
Recipe 8.1.Using Fractions
Recipe 8.2.Finding the Maximum and Minimum in an Array
Recipe 8.3.Using Number Ranges
Recipe 8.4.Generating Random Variables
Recipe 8.5.Obtaining Commons Math
Recipe 8.6.Calculating Simple Univariate Statistics
Recipe 8.7.Solving a System of Linear Equations
Recipe 8.8.Arithmetic with Complex Numbers
Recipe 8.9.Establishing Relationships Between Variables
Recipe 8.10.Estimating the Amount of Time Left in a Process
Chapter 9.Templating
Introduction
Recipe 9.1.Obtaining Commons JEXL
Recipe 9.2.Using an Expression Language
Recipe 9.3.Invoking Methods in an Expression
Recipe 9.4.Externalizing Logic with an Expression Language
Recipe 9.5.Obtaining Jakarta Velocity
Recipe 9.6.Using a Simple Templating Language
Recipe 9.7.Writing Templates with Conditionals and Loops
Recipe 9.8.Using Macros in a Templating Engine
Recipe 9.9.Invoking Methods in a Template
Recipe 9.10.Obtaining FreeMarker
Recipe 9.11.Using a Complex Scripting Engine
Recipe 9.12.Accessing XML Documents from a Templating Engine
Recipe 9.13.Using Velocity in a Web Application
Recipe 9.14.Using FreeMarker in a Web Application
Recipe 9.15.Writing Templates in Eclipse
Chapter 10.I/O and Networking
Introduction
Recipe 10.1.Obtaining Commons IO
Recipe 10.2.Copying Streams, byte[ ], Readers, and Writers
Recipe 10.3.Closing Streams, Readers, and Writers
Recipe 10.4.Printing a Human-Readable File Size
Recipe 10.5.Copying Files, Strings, and URLs
Recipe 10.6.Deleting Directories Recursively
Recipe 10.7.Obtaining the Size of a Directory
Recipe 10.8.Touching a File
Recipe 10.9.Filtering Files
Recipe 10.10.Measuring Stream Traffic
Recipe 10.11.Splitting an OutputStream
Recipe 10.12.Obtaining Jakarta ORO
Recipe 10.13.Using Globs and Perl5 Regular Expressions to List Files
Recipe 10.14.Obtaining Commons Net
Recipe 10.15.Writing an FTP Client
Recipe 10.16.Sending Mail with SMTP
Recipe 10.17.Checking a POP3 Mailbox
Chapter 11.HTTP and WebDAV
Introduction
Recipe 11.1.Obtaining Jakarta HttpClient
Recipe 11.2.Getting Jakarta HttpClient Source Code
Recipe 11.3.Performing an HTTP GET
Recipe 11.4.Sending Parameters in a Query String
Recipe 11.5.Retrieving Content with a Conditional GET
Recipe 11.6.Debugging HTTP Communications
Recipe 11.7.Making an HTTP POST Request
Recipe 11.8.Sending POST Data from a File
Recipe 11.9.Uploading Files with a Multipart POST
Recipe 11.10.Basic Authentication
Recipe 11.11.NTLM Authentication
Recipe 11.12.Working with Cookies
Recipe 11.13.Handling Redirects
Recipe 11.14.SSL
Recipe 11.15.Accepting a Self-Signed Certificate
Recipe 11.16.Obtaining Jakarta Slide
Recipe 11.17.Connecting to WebDAV Resources
Recipe 11.18.Modifying a WebDAV Resource
Chapter 12.Searching and Filtering
Introduction
Recipe 12.1.Obtaining Commons JXPath
Recipe 12.2.Querying an Object Graph with XPath
Recipe 12.3.Search a Collection of Simple Objects
Recipe 12.4.Applying XPath Queries to Complex Object Graphs
Recipe 12.5.Obtaining Jakarta Lucene
Recipe 12.6.Creating an Index of XML Documents
Recipe 12.7.Searching for a Specific Term in a Document Index
Recipe 12.8.Finding the Frequency of Terms in an Index
Colophon



Бесплатно скачать электронную книгу в удобном формате, смотреть и читать:
Скачать книгу Jakarta Commons Cookbook, O Brien T.M., 2004 - fileskachat.com, быстрое и бесплатное скачивание.

Скачать chm
Ниже можно купить эту книгу по лучшей цене со скидкой с доставкой по всей России.Купить эту книгу



Скачать книгу Jakarta Commons Cookbook, O'Brien T.M., 2004 - Яндекс Народ Диск.

Скачать книгу Jakarta Commons Cookbook, O'Brien T.M., 2004 - depositfiles.
Дата публикации:





Теги: :: :: ::


 


 

Книги, учебники, обучение по разделам




Не нашёл? Найди:





2024-12-21 23:22:37