Jakarta EE Recipes - A Problem-Solution Approach.
Book information
Description
Take a problem-solution approach to programming enterprise Java applications and microservices for cloud-based solutions, enterprise database applications, and even small business web applications. This book provides effective and proven code snippets that you can immediately use to accomplish just about any task that you may encounter. You can feel confident using the reliable solutions that are demonstrated in this book in your personal or corporate environment. Java EE was made open source under the Eclipse Foundation, and Jakarta EE is the new name for what used to be termed the Java Enterprise Edition Platform. This book helps you rejuvenate your Java expertise and put the platform’s latest capabilities to use in quickly developing robust applications. If you are new to Jakarta EE, this book will help you learn features of the platform, and benefit from one of the most widely used and powerful technologies available for application development today. Examples in Jakarta EE Recipes highlight Jakarta EE’s capabilities, helping you to build streamlined and reliable applications using the latest in Java technologies. The book takes a problem-solution approach in which each section introduces a common programming problem, showing you how to best solve that problem using the latest features in Jakarta EE. Solutions are presented in the form of working code examples that you can download and use immediately in your own projects. Clear descriptions are given so you can understand and learn to build further on the solutions that are provided. This is the ideal book for the code-focused programmer interested in keeping up with the future of enterprise development on the Java Platform. What You Will Learn * Develop enterprise Java applications using the now open source Jakarta EE platform * Create great-looking user interfaces using Jakarta Server Faces and the Eclipse Krazo framework * Build database applications using Jakarta Enterprise Beans and Jakarta RESTFul web services * Automate testing through cohesive test suites built on Arquillian for Jakarta EE applications * Deploy microservices applications in cloud environments using Docker * Secure applications utilizing the Jakarta EE Security API and JSON Web Tokens Who This Book Is For Java developers interested in quickly finding effective and proven solutions without reading through a lengthy manual and scrubbing for techniques. Table of Contents About the Author About the Technical Reviewer Acknowledgments Introduction Chapter 1: Servlets and JavaServer Pages 1-1. Developing a Servlet Problem Solution How It Works 1-2. Packaging, Compiling, and Deploying a Servlet Problem Solution Quick Start How It Works 1-3. Registering a Servlet Without Web.xml Problem Solution How It Works 1-4. Displaying Dynamic Content with a Servlet Problem Solution How It Works 1-5. Handling Requests and Responses Problem Solution How It Works 1-6. Listening for Servlet Container Events Problem Solution How It Works 1-7. Reading and Writing with Nonblocking I/O Problem Solution How It Works 1-8. Pushing Resources from a Server to a Client Problem Solution How It Works 1-9. Creating a Simple JSP Page Problem Solution How It Works Life Cycle of a JSP Page 1-10. Embedding Java into a JSP Page Problem Solution How It Works 1-11. Separating Business Logic from View Code Problem Solution How It Works 1-12. Yielding or Setting Values Problem Solution How It Works 1-13. Invoking a Function in a Conditional Expression Problem Solution How It Works 1-14. Creating a JSP Document Problem Solution How It Works 1-15. Embedding Expressions in EL Problem Solution How It Works 1-16. Accessing Parameters in Multiple Pages Problem Solution How It Works 1-17. Creating a Custom JSP Tag Problem Solution How It Works 1-18. Including Other JSPs into a Page Problem Solution How It Works 1-19. Creating an Input Form for a Database Record Problem Solution How It Works 1-20. Looping Through Database Records Within a Page Problem Solution How It Works 1-21. Handling JSP Errors Problem Solution How It Works 1-22. Disabling Scriptlets in Pages Problem Solution How It Works 1-23. Ignoring EL in Pages Problem Solution #1 Solution #2 Solution #3 How It Works Chapter 2: JavaServer Faces Fundamentals 2-1. Writing a Simple JSF Application Problem Solution #1 Displaying a JSF Controller Field Value Examining the JSF Controller Solution #2 How It Works Breaking Down a JSF Application 2-2. Writing a Controller Class Problem Solution Controller Class JSF View How It Works Scopes 2-3. Building Sophisticated JSF Views with Components Problem Solution How It Works 2-4. Displaying Messages in JSF Pages Problem Solution How It Works 2-5. Updating Messages Without Recompiling Problem Solution How It Works 2-6. Navigation Based upon Conditions Problem Solution How It Works 2-7. Validating User Input Problem Solution How It Works 2-8. Evaluation of Page Expressions Immediately Problem Solution How It Works 2-9. Passing Page Parameters to Methods Problem Solution How It Works 2-10. Operators and Reserved Words in Expressions Problem Solution How It Works 2-11. Creating Bookmarkable URLs Problem Solution How It Works 2-12. Displaying Lists of Objects Problem Solution How It Works 2-13. Developing with HTML5 Problem Solution How It Works 2-14. Creating Page Templates Problem Solution How It Works 2-15. Applying Templates Problem Solution View #1: recipe02_15a.xhtml View #2: recipe02_15b.xhtml View #3: recipe02_15c.xhtml Managed Bean Controller: AuthorController How It Works Applying Templates 2-16. Adding Resources into the Mix Problem Solution How It Works 2-17. Handling Variable-Length Data Problem Solution How It Works 2-18. Invoking Controller Class Actions on Life-Cycle Phase Events Problem Solution How It Works Chapter 3: Advanced JavaServer Faces Component and Tag Primer Common Component Tag Attributes Common JavaScript Component Tags Binding Components to Properties 3-1. Creating an Input Form Problem Solution The View: recipe03_01.xhtml Controller Class: ContactController.java How It Works 3-2. Invoking Actions from Within a Page Problem Solution The View: recipe03_02.xhtml Controller Class: ContactController.java How It Works 3-3. Displaying Output Problem Solution The View: recipe03_03.xhtml Controller Class: ContactController.java How It Works 3-4. Adding Form Validation Problem Solution #1 Solution #2 Solution #3 How It Works 3-5. Validating Input with Ajax Problem Solution How It Works 3-6. Submitting Pages Without Page Reloads Problem Solution How It Works 3-7. Making Partial-Page Updates Problem Solution How It Works 3-8. Applying Ajax Functionality to a Group of Components Problem Solution How It Works 3-9. Custom Processing of Ajax Functionality Problem Solution How It Works 3-10. Listening for System-Level Events Problem Solution How It Works 3-11. Listening for Component Events Problem Solution How It Works 3-12. Developing a Page Flow Problem Solution How It Works Defining a Flow The Flow Controller Class Navigating Flow View Nodes Flow EL 3-13. Broadcasting Messages from the Server to All Clients Problem Solution How It Works 3-14. Programmatically Searching for Components Problem Solution #1 Solution #2 How It Works Chapter 4: Eclipse Krazo 4-1. Configure an Application for the Eclipse Krazo Framework Problem Solution How It Works 4-2. Making Data Available for the Application Problem Solution #1 Solution #2 How It Works 4-3. Writing a Controller Class Problem Solution How It Works 4-4. Using a Model to Expose Data to a View Problem Solution How It Works 4-5. Utilizing CDI for Exposing Data Problem Solution How It Works 4-6. Supplying Message Feedback to the User Problem Solution How It Works 4-7. Inserting and Updating Data Problem Solution How It Works 4-8. Applying a Different View Engine Problem Solution #1 Solution #2 How It Works Chapter 5: JDBC with Jakarta EE 5-1. Obtaining Database Drivers and Adding Them to the CLASSPATH Problem Solution How It Works 5-2. Connecting to a Database Problem Solution #1 Solution #2 How It Works 5-3. Handling Database Connection Exceptions Problem Solution How It Works 5-4. Simplifying Connection Management Problem Solution How It Works 5-5. Querying a Database Problem Solution How It Works 5-6. Performing CRUD Operations Problem Solution How It Works 5-7. Preventing SQL Injection Problem Solution How It Works 5-8. Utilizing Java Objects for Database Access Problem Solution How It Works 5-9. Calling PL/SQL Stored Procedures Problem Solution How It Works 5-10. Querying and Storing Large Objects Problem Solution How It Works 5-11. Querying with a REF_CURSOR Problem Solution How It Works Chapter 6: Object-Relational Mapping 6-1. Creating an Entity Problem Solution How It Works 6-2. Mapping Data Types Problem Solution How It Works 6-3. Creating a Persistence Unit Problem Solution How It Works 6-4. Using Database Sequences to Create Primary Key Values Problem Solution How It Works 6-5. Generating Primary Keys Using More Than One Attribute Problem Solution #1 Solution #2 How It Works 6-6. Defining a One-to-One Relationship Problem Solution How It Works 6-7. Defining One-to-Many and Many-to-One Relationships Problem Solution How It Works 6-8. Defining a Many-to-Many Relationship Problem Solution How It Works 6-9. Querying with Named Queries Problem Solution How It Works 6-10. Performing Validation on Entity Fields Problem Solution How It Works 6-11. Generating Database Schema Objects Automatically Problem Solution How It Works 6-12. Mapping Date-Time Values Problem Solution How it Works 6-13. Using the Same Annotation Many Times Problem Solution How It Works Chapter 7: Jakarta NoSQL 7-1. Configuring for Jakarta NoSQL Problem Solution How It Works 7-2. Writing a Query for a Document Database Problem Solution How It Works 7-3. Inserting, Updating, and Deleting from a Document-Oriented Database Problem Solution Inserting Updating Deleting How It Works 7-4. Working with a Key-Value Database Problem Solution How It Works Chapter 8: Enterprise JavaBeans 8-1. Obtaining an Entity Manager Problem Solution #1 Solution #2 How It Works 8-2. Developing a Stateless Session Bean Problem Solution #1 Solution #2 How It Works 8-3. Developing a Stateful Session Bean Problem Solution How It Works 8-4. Utilizing Session Beans with JSF Problem Solution How It Works 8-5. Persisting an Object Problem Solution How It Works 8-6. Updating an Object Problem Solution How It Works 8-7. Returning Data to Display in a Table Problem Solution #1 Solution #2 How It Works 8-8. Creating a Singleton Bean Problem Solution How It Works 8-9. Scheduling a Timer Service Problem Solution #1 Solution #2 How It Works 8-10. Performing Optional Transaction Life-Cycle Callbacks Problem Solution How It Works 8-11. Ensuring a Stateful Session Bean Is Not Passivated Problem Solution How It Works 8-12. Denoting Local and Remote Interfaces Problem Solution How It Works 8-13. Processing Messages Asynchronously from Enterprise Beans Problem Solution How It Works Chapter 9: Java Persistence Query Language 9-1. Querying All Instances of an Entity Problem Solution #1 Solution #2 How It Works 9-2. Setting Parameters to Filter Query Results Problem Solution #1 Solution #2 How It Works 9-3. Returning a Single Object Problem Solution How It Works 9-4. Creating Native Queries Problem Solution #1 Solution #2 How It Works 9-5. Querying More Than One Entity Problem Solution #1 Solution #2 How It Works 9-6. Calling JPQL Aggregate Functions Problem Solution How It Works 9-7. Invoking Database Stored Procedures Natively Problem Solution How It Works 9-8. Joining to Retrieve Instances from Multiple Entities Problem Solution How It Works 9-9. Joining to Retrieve All Rows Regardless of Match Problem Solution How It Works 9-10. Applying JPQL Functional Expressions Problem Solution How It Works 9-11. Forcing Query Execution Rather Than Cache Use Problem Solution How It Works 9-12. Performing Bulk Updates and Deletes Problem Solution How It Works 9-13. Retrieving Entity Subclasses Problem Solution How It Works 9-14. Joining with ON Conditions Problem Solution How It Works 9-15. Processing Query Results with Streams Problem Solution How It Works 9-16. Converting Attribute Data Types Problem Solution How It Works Chapter 10: Bean Validation 10-1. Validating Fields with Built-in Constraints Problem Solution #1 Solution #2 How It Works 10-2. Writing Custom Constraint Validators Problem Solution How It Works 10-3. Validating at the Class Level Problem Solution How It Works 10-4. Validating Parameters Problem Solution How It Works 10-5. Constructor Validation Problem Solution How It Works 10-6. Validating Return Values Problem Solution How It Works 10-7. Defining a Dynamic Validation Error Message Problem Solution How It Works 10-8. Manually Invoking the Validator Engine Problem Solution How It Works 10-9. Grouping Validation Constraints Problem Solution How It Works Chapter 11: Contexts and Dependency Injection 11-1. Injecting a Contextual Bean or Other Object Problem Solution How It Works 11-2. Binding a Bean to a Web View Problem Solution How It Works 11-3. Allocating a Specific Bean for Injection Problem Solution How It Works 11-4. Determining Scope of a Bean Problem Solution How It Works 11-5. Injecting Non-bean Objects Problem Solution How It Works 11-6. Ignoring Classes Problem Solution #1 Solution #2 How It Works 11-7. Disposing of Producer Fields Problem Solution How It Works 11-8. Specifying an Alternative Implementation at Deployment Time Problem Solution How It Works 11-9. Injecting a Bean and Obtaining Metadata Problem Solution How It Works 11-10. Invoking and Processing Events Problem Solution How It Works 11-11. Intercepting Method Invocations Problem Solution How It Works 11-12. Bootstrapping Java SE Environments Problem Solution How It Works 11-13. Enhancing Business Logic of a Method Problem Solution How It Works Chapter 12: Java Message Service 12-1. Creating JMS Resources Problem Solution #1 Solution #2 How It Works 12-2. Creating a Session Problem Solution Running the Example How It Works 12-3. Creating and Sending a Message Problem Solution #1 Solution #2 Running the Examples How It Works 12-4. Receiving Messages Problem Solution #1 Solution #2 Running the Example How It Works 12-5. Filtering Messages Problem Solution Running the Example How It Works 12-6. Inspecting Message Queues Problem Solution Running the Example How It Works 12-7. Creating Durable Message Subscribers Problem Solution The Topic Connection Creating the Initial Durable Subscriber Creating and Publishing a Message Receiving the Message Unsubscribing from the Subscription Running the Example How It Works 12-8. Delaying Message Delivery Problem Solution How It Works Chapter 13: RESTful Web Services 13-1. Developing a RESTful Web Service Problem Solution #1 Solution #2 How It Works 13-2. Consuming and Producing with REST Problem Solution Producing Output Producing List Output Accepting Input How It Works 13-3. Writing a Jakarta RESTful Web Services Client Problem Solution How It Works Web Resource Targets Obtaining a Response Returning Entities Invoking at a Later Time WebTarget Injection 13-4. Filtering Requests and Responses Problem Solution How It Works Filters Entity Interceptors Binding Filters and Interceptors Setting Priorities 13-5. Processing Long-Running Operations Asynchronously Problem Solution How It Works 13-6. Pushing One-Way Asynchronous Updates from Servers Problem Solution How It Works 13-7. Receiving Server-Sent Events As a Client Problem Solution How It Works Chapter 14: WebSockets and JSON 14-1. Creating a WebSocket Endpoint Problem Solution How It Works 14-2. Sending Messages to a WebSocket Endpoint Problem Solution How It Works 14-3. Building a JSON Object Problem Solution How It Works 14-4. Writing a JSON Object to Disk Problem Solution How It Works 14-5. Reading JSON from an Input Source Problem Solution How It Works Parsing Content 14-6. Converting Between JSON and Java Objects Problem Solution How It Works 14-7. Custom Mapping with JSON-B Problem Solution How It Works 14-8. Replacing a Specified Element in a JSON Document Problem Solution How It Works Chapter 15: Security 15-1. Setting Up Application Users and Groups in GlassFish Problem Solution How It Works 15-2. Performing Basic Web Application Authorization Problem Solution #1 Solution #2 How It Works 15-3. Developing a Programmatic Login Form with Custom Authentication Validation Problem Solution Creating the Login Form Coding the Authentication Backend EJB: (Custom Solution) JSF Controller User Entity How It Works 15-4. Authentication with the Security API Using Database Credentials Problem Solution How It Works 15-5. Managing Page Access Within a JSF Application Problem Solution How It Works 15-6. Configuring LDAP Authentication Within GlassFish/Payara Problem Solution How It Works 15-7. Configuring Custom Security Certificates Within GlassFish/Payara Problem Solution How It Works Chapter 16: Concurrency and Batch 16-1. Creating Resources for Processing Tasks Asynchronously in an Application Server Problem Solution #1 Solution #2 How It Works 16-2. Configuring and Creating a Reporter Task Problem Solution How It Works 16-3. Running More Than One Task Concurrently Problem Solution How It Works 16-4. Utilizing Transactions Within a Task Problem Solution How It Works 16-5. Running Concurrent Tasks at Scheduled Times Problem Solution How It Works 16-6. Creating Thread Instances Problem Solution How It Works 16-7. Creating an Item-Oriented Batch Process Problem Solution How It Works Chapter 17: Deploying to Containers 17-1. Creating a Docker Image and Running Java Problem Solution How It Works 17-2. Deploying Images to Payara Server Utilizing an Official Payara Docker Image Problem Solution How It Works 17-3. Creating a Docker Container Running a Basic Jakarta EE Application Problem Solution How It Works 17-4. Enabling Communication Between Containers Problem Solution How It Works Index
Similar books
Java EE to Jakarta EE 10 Recipes: A Problem-Solution Approach for Enterprise Java
2022 · PDF
Java 17 Recipes: A Problem-Solution Approach
2022 · EPUB
Java EE to Jakarta EE 10 Recipes: A Problem-Solution Approach for Enterprise Java
2022 · PDF
Java EE to Jakarta EE 10 Recipes: A Problem-Solution Approach for Enterprise Java
2022 · EPUB
Java 17 Recipes: A problem-solution approach
2022 · PDF
Java 17 Recipes - A problem-solution approach
2022 · PDF
Java 9 Recipes: A Problem-Solution Approach
2017 · EPUB
Java 7 Recipes: A Problem-Solution Approach
2011 · PDF