Java Enterprise Best Practices 1 O’Reilly – Java Enterprise Best Practices 2
Total Page:16
File Type:pdf, Size:1020Kb
O’Reilly – Java Enterprise Best Practices 1 O’Reilly – Java Enterprise Best Practices 2 Table of Contents Preface ............................................................................................................................................................. 5 Audience .................................................................................................................................................. 5 Organization ............................................................................................................................................ 5 Conventions Used in This Book............................................................................................................ 7 How to Contact Us.................................................................................................................................. 8 Acknowledgments................................................................................................................................... 9 Chapter 1. Introduction to Java Enterprise Best Practices................................................................... 11 1.1 How Does a Best Practice Come About?................................................................................. 11 1.2 Can Best Practices Be Arguable? ............................................................................................. 13 1.3 What's in This Book? ................................................................................................................... 14 1.4 About the Practices Themselves................................................................................................ 15 1.5 Enterprise Java Programming Resources Online................................................................... 16 Chapter 2. EJB Best Practices ................................................................................................................. 18 2.1 Design............................................................................................................................................ 18 2.2 Implementation............................................................................................................................. 25 2.3 Deployment and Packaging ....................................................................................................... 44 Chapter 3. Servlet Best Practices ............................................................................................................ 46 3.1 Working Effectively with Servlets ............................................................................................... 46 3.2 Caching with Servlets .................................................................................................................. 67 3.3 Other Servlet Tips......................................................................................................................... 72 Chapter 4. JDBC Best Practices .............................................................................................................. 75 4.1 Configuration ................................................................................................................................ 75 4.2 Design............................................................................................................................................ 80 4.3 Code............................................................................................................................................... 92 4.4 General Database.................................................................................................................... 102 Chapter 5. XML Best Practices............................................................................................................. 105 5.1 XML Authoring .......................................................................................................................... 105 .2 SAX .............................................................................................................................................. 111 5.3 DOM........................................................................................................................................... 118 5.4 JAXP .......................................................................................................................................... 128 Chapter 6. RMI Best Practices ............................................................................................................. 132 6.1 Marshalling and Unmarshalling Objects ............................................................................... 132 6.2 Making Applications More Robust ......................................................................................... 147 6.3 Improving Application Performance....................................................................................... 162 6.4 Further Reading........................................................................................................................ 171 Chapter 7. Java Management Extensions.......................................................................................... 173 7.1 Naming ...................................................................................................................................... 173 7.2 Instrumentation......................................................................................................................... 176 Chapter 8. Enterprise Internationalization........................................................................................... 203 8.1 Internationalization and Localization..................................................................................... 204 8.2 Presentation Layer................................................................................................................... 205 8.3 Business Object Layer............................................................................................................. 221 8.4 Data Access Layer ................................................................................................................... 227 O’Reilly – Java Enterprise Best Practices 3 Chapter 9. JSP Best Practices ............................................................................................................. 233 9.1 Appropriate Usage of JSP in an Enterprise Application..................................................... 233 9.2 Page Design ............................................................................................................................. 237 9.3 Caching ..................................................................................................................................... 246 9.4 Error Handling........................................................................................................................... 252 9.5 Custom Component Development ........................................................................................ 255 9.6 Deployment............................................................................................................................... 264 Chapter 10. JavaMail Best Practices................................................................................................... 266 10.1 Understanding Enterprise Email.......................................................................................... 267 10.2 Sending Email ........................................................................................................................ 268 10.3 Email for System Integration................................................................................................ 276 10.4 Performance Optimization.................................................................................................... 287 Chapter 11. Enterprise Performance Tuning Best Practices............................................................ 292 11.1 Performance Planning ........................................................................................................... 292 11.2 The Performance Environment ............................................................................................ 294 11.3 Proactive Performance Management in Production ......................................................... 298 11.4 Efficient Distributed Computing Architecture ..................................................................... 301 11.5 Tuning Procedure................................................................................................................... 303 11.6 User Perceptions.................................................................................................................... 304 11.7 Tuning Techniques ................................................................................................................. 305 11.8 Miscellaneous Best Practices............................................................................................... 307 Chapter 12. List of Contributors............................................................................................................ 310 O’Reilly – Java Enterprise Best Practices 4 Copyright © 2003 O'Reilly & Associates, Inc. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O'Reilly & Associates books may be purchased for educational, business, or sales promotional use.