Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java 9 Programming Blueprints

You're reading from   Java 9 Programming Blueprints Master features like modular programming, Java HTTP 2.0, and REPL by building numerous applications

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781786460196
Length 466 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jason Lee Jason Lee
Author Profile Icon Jason Lee
Jason Lee
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introduction FREE CHAPTER 2. Managing Processes in Java 3. Duplicate File Finder 4. Date Calculator 5. Sunago - A Social Media Aggregator 6. Sunago - An Android Port 7. Email and Spam Management with MailFilter 8. Photo Management with PhotoBeans 9. Taking Notes with Monumentum 10. Serverless Java 11. DeskDroid - A Desktop Client for Your Android Phone 12. What is Next?

Server-sent events

SSE, or server-sent events, is a means by which we can stream data from the server to the client. Typically, a REST request is very short-lived--make a connection, send the request, get a response, close the connection. Sometimes, though, the REST server may not have all of the data that the client wants at the time of the request (for example, reading data from another data source such as a log file or network socket). So, it would be nice to be able to push that data to the client as it becomes available. That's exactly what SSE allows us to do. We'll look into that in more detail later.

Finally, we start the server instance with a call to JettyHttpContainerFactory.createServer(). Since we need to be able to stop the server later, we capture the server instance, and store it in an instance variable. We call startServer() from onStartCommand() as...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime