Book Image

Java EE 7 Development with WildFly

Book Image

Java EE 7 Development with WildFly

Overview of this book

Table of Contents (21 chapters)
Java EE 7 Development with WildFly
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

WildFly, the newest release of the JBoss Application Server, provides developers with a full implementation of the Java EE 7 platform. It is built on solid foundations of the modular architecture introduced with JBoss AS 7, but it has grown in terms of flexibility and performance. The newest version of the Enterprise Java focuses on developers' productivity, and so does WildFly.

This book will introduce Java developers to the world of enterprise applications. We will use modern development techniques and tools that are battle-tested in real-life projects. We'll also utilize the features provided by the WildFly platform, such as security, caching, testing, and clustering. Finally, you will learn how to manage your server using dedicated tools, created specifically for WildFly.

The learning process will be concentrated around a ticket booking application, which is a sample project that will get more features (and sometimes completely different user interfaces) with every chapter.

What this book covers

Chapter 1, Getting Started with WildFly, is an introduction to the Java EE platform and new Java EE 7 version specifications. It also focuses on presenting WildFly's new features, the developer environment setup, and basic server management.

Chapter 2, Your First Java EE Application on WildFly, describes the basics of the WildFly server usage, presenting information required to deploy your first application.

Chapter 3, Introducing Java EE 7 – EJBs, introduces Java EE business objects called Enterprise Java Beans. In this chapter, we create the foundations of the ticket booking application.

Chapter 4, Learning Context and Dependency Injection, covers the CDI technology that connects the building blocks of your applications.

Chapter 5, Combining Persistence with CDI, is a look into the database world and object mapping in Java EE.

Chapter 6, Developing Applications with JBoss JMS Provider, is a dive into HornetQ and enterprise system integration using JCA.

Chapter 7, Adding Web Services to Your Applications, discusses not only the old-style SOAP web services but also the modern and popular approach based on JAX-RS (REST). We'll also take a look at how to integrate a Java EE 7 backend with an AngularJS browser application.

Chapter 8, Adding WebSockets, introduces a completely new asset to the Java EE 7 platform: WebSockets. We will look at them in our sample AngularJS application.

Chapter 9, Managing the Application Server, discusses WildFly management features.

Chapter 10, Securing WildFly Applications, focuses on security-related aspects of the server and your application.

Chapter 11, Clustering WildFly Applications, discusses making Java EE applications highly available and scalable.

Chapter 12, Long-term Tasks' Execution, describes the new area of enterprise Java batch applications and concurrency management on the server.

Chapter 13, Testing Your Applications, demonstrates how we can write integration tests for for our applications using Arquillian after covering the most important Java EE technologies.

Appendix, Rapid Development Using JBoss Forge, covers the JBoss Forge tool. It shows how you can use this application to speed up your work with its code generation features on starting Java EE-based projects.

What you need for this book

This book is a code-oriented guide into the Java EE and WildFly worlds. To fully benefit from this book, you will need access to an Internet connection in order to download all the required tools and libraries. Knowledge of Java is required. We will also use Maven as a build automation tool, but thanks to its verbosity, the examples provided in this book are self-explanatory.

Although we will use AngularJS, additional JS knowledge is not required. All examples for the framework will be showcase-based, and their aim is to show how different parties can interact with Java EE in typical scenarios.

Who this book is for

If you are a Java developer who wants to learn about Java EE basics or if you are already a Java EE developer who wants to learn what's new in WildFly or Java EE 7, this book is for you. This book covers basics of the described technologies and also ensures to bring some more interesting, advanced topics for those who already have some knowledge.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "After an MDB instance's onMessage() method returns, the request is complete, and the instance is placed back in the free pool."

A block of code is set as follows:

<jms-destinations>
   <jms-queue name="TicketQueue">
      <entry name="java:jboss/jms/queue/ticketQueue"/>
         <durable>false</durable>
   </jms-queue>
</jms-destinations>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

@Stateless
public class SampleEJB {

    @Resource(mappedName = "java:/ConnectionFactory")
    private ConnectionFactory cf; 
}

Any command-line input or output is written as follows:

CREATE DATABASE ticketsystem;
CREATE USER jboss WITH PASSWORD 'jboss';
GRANT ALL PRIVILEGES ON DATABASE ticketsystem TO jboss;

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, for example, appear in the text like this: "For example, the Eclipse's File menu includes an option JPA Entities from Table that (once a connection has been set up to the database) allows reversing your DB schema (or part of it) into Java entities."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.