天天看點

Jersey 2.x Glassfish 中基于 Servlet 的應用

如果你使用的是 Glassfish 作為你應用伺服器,你不需要在你的引用中包含引用任何東西,所有你需要的都已經包含進去了。

你隻需要定義 JAX-RS API 以便于你能夠對你的應用進行編輯,使用 (provided)依賴。

<dependency>

<groupId>javax.ws.rs</groupId>

<artifactId>javax.ws.rs-api</artifactId>

<version>2.1</version>

<scope>provided</scope>

</dependency>

如果你需要使用 Jersey 的一些特定特性,你需要基于你的 Jersey 目錄進行添加。

1

2

3

4

5

6

7

8

9

10

11

12

13

<dependency>

<groupId>org.glassfish.jersey.containers</groupId>

<artifactId>jersey-container-servlet</artifactId>

<version>2.27</version>

<scope>provided</scope>

</dependency>

<!-- if you are using Jersey client specific features without the server side -->

<dependency>

<groupId>org.glassfish.jersey.core</groupId>

<artifactId>jersey-client</artifactId>

<version>2.27</version>

<scope>provided</scope>

</dependency>

https://www.cwiki.us/display/JERSEYZH/Common+Jersey+Use+Cases

繼續閱讀