Skip to content

Commit c9f22bc

Browse files
committed
å¢注解测试
1 parent 69b2700 commit c9f22bc

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
![IM系统](https://raw.githubusercontent.com/baijiangLai/IM/master/images/IM%E7%B3%BB%E7%BB%9F.png)
66

7+
[客户端部分](https://github.com/baijiangLai/ITalker)
78
## 软件
89

910
- AndroidStudio
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.mengxiang.im.push.bean;
2+
3+
/**
4+
* @author lbj
5+
*/
6+
public class User {
7+
private String name;
8+
private int sex;
9+
10+
public String getName() {
11+
return name;
12+
}
13+
14+
public void setName(String name) {
15+
this.name = name;
16+
}
17+
18+
public int getSex() {
19+
return sex;
20+
}
21+
22+
public void setSex(int sex) {
23+
this.sex = sex;
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.mengxiang.im.push.service;
22

3-
import javax.ws.rs.GET;
4-
import javax.ws.rs.Path;
3+
import com.mengxiang.im.push.bean.User;
4+
5+
import javax.ws.rs.*;
6+
import javax.ws.rs.core.MediaType;
57

68
/**
79
* @author lbj
@@ -10,11 +12,23 @@
1012
public class AccountService {
1113

1214
/**
13-
*请求实际地址(127.0.0.1/api/account/login)
15+
*Get 请求实际地址(127.0.0.1/api/account/login)
1416
*/
1517
@GET
1618
@Path("/login")
1719
public String get(){
1820
return "get login";
1921
}
22+
23+
//POST 127.0.0.1/api/account/login
24+
@POST
25+
@Path("/login")
26+
// 返回的相应体为JSON
27+
@Produces(MediaType.APPLICATION_JSON)
28+
public User post() {
29+
User user = new User();
30+
user.setName("jack");
31+
user.setSex(2);
32+
return user;
33+
}
2034
}

0 commit comments

Comments
 (0)