天天看點

Jersey 2.x JDK 上的用戶端應用

如應用是運作在 JDK 上的話,你隻需要使用 JAX-RS 中的用戶端部分就可以了,這個根據你使用的用戶端有所調整。

這裡有一系列的子產品是可以供你使用的,例如 grizzly 或 apache 或 jetty connector(請參考下面的的依賴表格)。Jersey 用戶端預設使用 JDK 進行運作(使用的是 HttpUrlConnection)。

請參考 

Chapter 5, Client API  獲得更多的細節。

<dependency>

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

<artifactId>jersey-client</artifactId>

<version>2.27</version>

</dependency>

目前可用的連接配接器:

<dependency>

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

<artifactId>jersey-grizzly-connector</artifactId>

<version>2.27</version>

</dependency>

<dependency>

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

<artifactId>jersey-apache-connector</artifactId>

<version>2.27</version>

</dependency>

<dependency>

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

<artifactId>jersey-jetty-connector</artifactId>

<version>2.27</version>

</dependency>

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