Java Reference
In-Depth Information
Note that the input fields in our markup are bound to properties of a CDI named
bean with a name of person. The Person bean looks like this:
package com.ensode.websocket;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
public class Person {
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
public void setFirstName(String firstName) {
this.firstName = firstName;
public String getLastName() {
return lastName;
public void setLastName(String lastName) {
this.lastName = lastName;
As we can see, the Person bean is a simple request scoped CDI named bean.
Now that we have a simple JSF application that uses HTML5-friendly markup, the
next step is to modify it to take advantage of the Java API for WebSocket.
Developing the WebSocket server endpoint
Once we have our JSF code in place, we can add a WebSocket server endpoint to
our project by going to File | New File , selecting the Web category, and selecting
WebSocket Endpoint as the file type.
Search WWH ::

Custom Search