Book Image

Advanced Java EE Development with WildFly

By : Deepak Vohra
Book Image

Advanced Java EE Development with WildFly

By: Deepak Vohra

Overview of this book

<p>This book starts with an introduction to EJB 3 and how to set up the environment, including the configuration of a MySQL database for use with WildFly. We will then develop object-relational mapping with Hibernate 4, build and package the application with Maven, and then deploy it in&nbsp;WildFly 8.1, followed by a demonstration of the use of Facelets in a web application.</p> <p>Moving on from that, we will create an Ajax application in the Eclipse IDE, compile and package it using Maven, and run the web application on WildFly 8.1 with a MySQL database. In the final leg of this book, we will discuss support for generating and parsing JSON with WildFly 8.1.</p>
Table of Contents (18 chapters)
Advanced Java EE Development with WildFly
Credits
About the Author
About the Reviewers
www.PacktPub.com
Disclaimer
Preface
Index

Running the Java client


In this section, we will run the Java client. First, run the client to test outputting just the media type TEXT_PLAIN. The acceptable media type in the client class must match a MIME media type produced in the resource class. In the JAXRSClient class, uncomment only the System.out statement that accepts the TEXT_PLAIN media type. Uncomment all the resource methods in the HelloWorldResource class. Then right-click on JAXRSClient.java and select Run As | Java Application, as shown here:

The resource response gets displayed in the TEXT_PLAIN media type, as shown here:

An acceptable media type must match a media type produced by the resource class. If a produced MIME media type in the root resource class is not found for an acceptable media type, a com.sun.jersey.api.client.UniformInterfaceException exception is generated. For example, set an acceptable media type to MediaType.TEXT_XML by uncommenting the following System.out statement in the JAXRSClient class:

System.out...