Building reactive applications using asynchronous servlets
Servlets are probably one of most well-known Java EE technologies (perhaps even the most known). Actually, servlets existed even before J2EE became a real specification.
This recipe will show you how to use servlets asynchronously.
Getting ready
Let's first add our Java EE 8 dependency:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>How to do it...
- First, we create a
UserPOJO:
public class User implements Serializable{
private Long id;
private String name;
public User(long id, String name){
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName...