Java Reference
In-Depth Information
On this WebResource , we can call the request method to execute the request, followed by the get(Class clazz)
method, and supply a class parameter. The result of the REST call will then be parsed into an instance of the supplied
class, which is also what we did using JAXB in our example in Listing 11-11.
QuestionResponse response = target.request(MediaType.APPLICATION_JSON).get(QuestionResponse.class);
The response now contains a list of Question s, and we can use the exact same code as in Listing 11-4 to render
the questions.
Summary
In this chapter, we explained briefly two options for integrating JavaFX applications and enterprise applications.
We demonstrated a number of techniques for retrieving data available via web services, and also showed how to
render the data in typical JavaFX controls such as ListView and TableView .
We used a number of third-party tools that facilitate the process of retrieving, parsing, and rendering data. We
demonstrated some JavaFX-specific issues related to remote web services (i.e., updating the UI should happen on the
JavaFX application thread).
It is important to realize that the decoupling between JavaFX client applications and web services allows for a
large degree of freedom. There are different tools and techniques for dealing with web services, and developers are
encouraged to use their favorite tools in their JavaFX application.
 
Search WWH ::




Custom Search