RESTful 项目中对 Cloudant 服务的封装使用(2)
 
- UID
- 1066743
|
RESTful 项目中对 Cloudant 服务的封装使用(2)
创建动态 Web 项目进入 File -> New -> Dynamic Web Project 创建动态 Web 项目
图 8.创建动态 Web 项目 点击 Modify,进入需要勾选 JAX-RS 并确保 Runtime 是 Liberty Profile
图 9.配置 runtime 一直 Next 至最后选择 JAX-RS Implementation Library,选择 IBM WebSphere Application Server Liberty JAX-RS Library.
图 10.IBM WebSphere Application Server Liberty JAX-RS Library 创建 RESTful 的 Web Service清单 1. 创建 Service 类1
2
3
4
5
6
7
8
9
10
11
12
13
14
| package libertydemo;
import java.io.File;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@Path("")
publicclass Service {
@GET
@Path("/test")
public String testGet(){
return "OK";
}
}
|
|
|
|
|
|
|