CHAPTER 1: Introducing Java Web Development 39
A few examples of the applications that require real-time functionality are chat applications,
multiplayer online games, stock trading applications, and so on.
Note The Java API for WebSocket is defined as JSR 356; see Table 1-3.
Reactive Web Application
Reactive applications are a new class of applications that are fundamentally different from traditional
web-based applications and are driven by the Typesafe^26 Reactive Platform. The Typesafe Reactive
Platform is a suite of integrated products consisting of the Play 2 framework, Akka,^27 and Scala,
along with the Typesafe Console for command and control. Reactive programming is becoming
crucial because of multicore processors and because it advocates asynchronous and event-based
programming. The Play framework is an alternative to the enterprise Java stacks. Play is built for
the needs of modern web and mobile applications, leveraging technologies such as REST, JSON,
and WebSocket, to name a few. These technologies allow the creation of rich, highly interactive
user interfaces rendered via any modern browser, while at the same time making it easier to render
portions of the page in parallel and to do partial-page updates or progressive enhancements.
Mashups and Web Services
A mashup is a web application that uses content from more than one source to create a new service
displayed in a single graphical interface. With mashups you can develop powerful applications by
combining web services. You can find popular APIs for mashups at http://www.programmableweb.com/apis/
directory/1?sort=mashups. This section will focus on web services and then touch on a fascinating
trend, which is still an area of research: the Semantic Web.
A web service is a software component stored on one machine that can be accessed over the
network by an application (or other software component) on another machine. The machine on
which a web service resides is referred to as a web service host. The client application sends
a request over a network to the web service host, which processes the request and returns the
response. Making a web service available to receive client requests is known as publishing a web
service; using a web service from a client application is known as consuming a web service.
Web services use technologies such as XML and JSON^28 for data interchange.
JavaScript Object Notation
JavaScript Object Notation (JSON) is used for representing data as an alternative to XML. JSON
reduces the payload of web requests, improving the overall performance of a web application. JSON
is a text-based data-interchange format used to represent objects in JavaScript as collections of
name-value pairs represented as Strings.
(^26) http://typesafe.com/
(^27) http://akka.io/
(^28) http://www.json.org/