You canimplement the text decoder that you will use in your application. Learn about the methods that should be implemented and the logic necessary to decode a message from JSON to a message object. You can use the knowledge gained so far and use the JSON reader to extract the JSON data in a message object.
- [Instructor] Now let's have a look at…how to code the decoder.…Load up the class message decoder…and you will see that the text subclass…of the decoder class has been implemented,…and our message type has been specified…as a type from which to decode.…There are four methods to implement,…the innit method, the destroy method,…the willCode method, and the decode method.…As before, we will leave the innit and destroy methods empty…and only implement the decode method.…In the code method, we need to write code…that constructs a message object…from the JSON string that is passed to the method…in the text message parameter.…
For this, we use a JSON reader,…which can be created from a static factory method…on the JSON class.…So let's create the reader now.…So we start with the jsonReader object, like so,…and then we call on the JSON class,…the createReader method, and we pass it a new StringReader…with our textMessage inside, like so.…
The reader is passed an instance of the…Java.io.StringReader class,…prepopulated with the textMessage string,…
Join Alex Theedom as he guides you through the lifecycle of a WebSocket connection, and discusses the Java EE WebSocket programming methodologies: annotation and programmatic. He shows how to secure and encrypt WebSocket endpoints and use simple techniques to test their implementation. In addition, he explains how to integrate the JSON-processing API and build a front-end and server based WebSocket client.
- WebSocket usage
- WebSocket lifecycle and topology
- WebSocket front end and back end
- WebSocket methodologies
- Annotation methodology and programmatic methodology
- Coding a client API
- Using the JSON Processing API
- Coding the encoder and decoder
- Building the front end
- Testing WebSocket endpoints
Skill Level Intermediate
Java Platforms Compared: SE vs EE vs MEwith Peggy Fisher25m 38s Intermediate
1. Introduction to WebSocket
2. WebSockets Front End and Back End
3. Project Application and Structure
4. Java EE WebSocket API
5. Messages and Encoding
6. Build Web Front End
7. WebSocket Security
8. Testing WebSocket Endpoints
Next steps1m 37s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.