All modern rich client platforms provide ways to communicate with external servers. The Web and its associated protocols have become de facto technologies for building client-server applications. This recipe shows how to use JavaFX to communicate with web servers over HTTP using the HttpRequest
object from JavaFX's IO API. You will learn how to submit a request to a remote web server and use HttpRequest's event-driven callback functions to handle responses from the server.
Prior to getting started with HttpRequest
, you should have an understanding of the basic mechanics behind the Web and its HTTP protocol (see the HTTP reference at the end of this recipe). JavaFX's HttpRequest
class, located in the javafx.io.http
package, provides ways to manage communication between your JavaFX client application and a remote web server. To illustrate the use of the HttpRequest
class, we will use it to pull down information from Wikipedia's entry...