官术网_书友最值得收藏!

Getting ready

Let's start by adding the right dependency to our project:

<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>2.28</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.28</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-sse</artifactId>
<version>2.28</version>
</dependency>
</dependencies>

You surely noticed that we are using Jersey here. Why? Because Jersey is one of the reference implementations for JAX-RS, which means that it implements all JAX-RS specifications.

Moreover, with Jersey, we can use Grizzly to start a small local server, which will be useful for this recipe, as we need just a few server features to show the SSE behavior.

Further on in this book, we will use a full GlassFish to build more JAX-RS recipes.

主站蜘蛛池模板: 含山县| 海晏县| 五河县| 阜阳市| 景东| 富宁县| 夏邑县| 西丰县| 翁源县| 兴城市| 青神县| 安庆市| 自治县| 普定县| 巨野县| 鄂托克旗| 汉沽区| 湖北省| 浮山县| 泗水县| 扎囊县| 武宣县| 富源县| 涞源县| 页游| 花莲县| 平罗县| 新津县| 梓潼县| 河源市| 太白县| 金阳县| 潍坊市| 太原市| 措美县| 青川县| 孝义市| 简阳市| 长乐市| 溧阳市| 五寨县|