From f9287d7738b32b4d0b5c92b6e9d3d5a829966263 Mon Sep 17 00:00:00 2001
From: Redkale <22250530@qq.com>
Date: Sat, 13 May 2017 14:27:26 +0800
Subject: [PATCH]
---
convert.html | 1 -
net.html | 6 ------
service.html | 12 ++++--------
3 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/convert.html b/convert.html
index 5ed159268..7eef7fc1b 100644
--- a/convert.html
+++ b/convert.html
@@ -180,7 +180,6 @@
}
// 获取他人基本信息
- @AuthIgnore
@HttpMapping(url = "/user/info/")
public void info(HttpRequest req, HttpResponse resp) throws IOException {
int userid = Integer.parseInt(req.getRequstURILastPath());
diff --git a/net.html b/net.html
index 55e222634..b79c078ab 100644
--- a/net.html
+++ b/net.html
@@ -84,7 +84,6 @@
response.nextEvent();
}
- //标记为@AuthIgnore 的方法将不会调用authenticate方法
//一般用于判断用户的登录态, 返回false表示鉴权失败
//moduleid值来自 @WebServlet.moduleid()用于定义模块ID; actionid值自来@HttpMapping.actionid()用于定义操作ID; 需要系统化的鉴权需要定义这两个值
@Override
@@ -115,7 +114,6 @@
private UserService service;
//登录操作
- @AuthIgnore //登录操作不要判断登录态,所以需要标记为@AuthIgnore,不会调用 BaseSerlvet.authenticate 方法
//因为HttpMapping的判断规则用的是String.startsWith,所以HttpMapping.url不能用正则表达式,只能是getRequestURI的前缀
//且同一个HttpServlet类内的所有HttpMapping不能存在包含关系, 如 /user/myinfo 和 /user/myinforecord 不能存在同一HttpServlet中。
@HttpMapping(url = "/user/login", comment = "用户登录")
@@ -136,11 +134,7 @@
}
//获取指定用户ID的用户信息, 请求如: /user/username/43565443
- @AuthIgnore
- // 默认缓存时间是15秒,HttpServlet会将每个进入该方法的请求的响应结果缓存15秒,缓存命中时不会再进入该方法,过期会清空。
- // @HttpCacheable 必须配合 @AuthIgnore 使用, 因为跟当前用户有关的请求一般不适合所有用户请求。
// 翻页查询想缓存就需要将翻页信息带进url: /user/query/page:2/size:50 。
- @HttpCacheable(seconds = 30) //有效期30秒
@HttpMapping(url = "/user/userinfo/", comment = "获取指定用户ID的用户信息")
@HttpParam(name = "#", type = int.class, comment = "用户ID")
public void userinfo(HttpRequest req, HttpResponse resp) throws IOException {
diff --git a/service.html b/service.html
index a3d9fb4de..b7f2c5427 100644
--- a/service.html
+++ b/service.html
@@ -356,9 +356,9 @@
String comment() default ""; //备注描述, 对应@HttpMapping.comment
- boolean authignore() default true; //是否鉴权,默认不鉴权, 对应@AuthIgnore
+ boolean auth() default true; //是否鉴权,默认不鉴权, 对应@HttpMapping.auth
- int cacheseconds() default 0; //结果缓存的秒数, 为0表示不缓存, 对应@HttpCacheable.seconds
+ int cacheseconds() default 0; //结果缓存的秒数, 为0表示不缓存, 对应@HttpMapping.cacheseconds
int actionid() default 0; //操作ID值,鉴权时用到, 对应@HttpMapping.actionid
@@ -383,6 +383,8 @@
int radix() default 10; //转换数字byte/short/int/long时所用的进制数, 默认10进制
+ boolean required() default 0; //参数是否必传
+
String comment() default ""; //备注描述, 对应@HttpMapping.comment
}
@@ -557,7 +559,6 @@
@Resource
private Map<String, HelloService> _servicemap;
- @AuthIgnore
@HttpMapping(url = "/hello/create", comment = "创建Hello对象")
@HttpParam(name = "bean", type = HelloEntity.class, comment = "Hello对象")
public void create(HttpRequest req, HttpResponse resp) throws IOException {
@@ -570,7 +571,6 @@
resp.finishJson(result);
}
- @AuthIgnore
@HttpMapping(url = "/hello/delete/", comment = "根据id删除Hello对象")
@HttpParam(name = "#", type = int.class, comment = "Hello对象id")
public void delete(HttpRequest req, HttpResponse resp) throws IOException {
@@ -580,7 +580,6 @@
resp.finishJson(RetResult.success());
}
- @AuthIgnore
@HttpMapping(url = "/hello/update", comment = "修改Hello对象")
@HttpParam(name = "bean", type = HelloEntity.class, comment = "Hello对象")
public void update(HttpRequest req, HttpResponse resp) throws IOException {
@@ -592,7 +591,6 @@
resp.finishJson(RetResult.success());
}
- @AuthIgnore
@HttpMapping(url = "/hello/query", comment = "查询Hello对象列表")
@HttpParam(name = "bean", type = HelloBean.class, comment = "过滤条件")
public void query(HttpRequest req, HttpResponse resp) throws IOException {
@@ -607,7 +605,6 @@
resp.finishJson(result);
}
- @AuthIgnore
@HttpMapping(url = "/hello/find/", comment = "根据id查找单个Hello对象")
@HttpParam(name = "#", type = int.class, comment = "Hello对象id")
public void find(HttpRequest req, HttpResponse resp) throws IOException {
@@ -617,7 +614,6 @@
resp.finishJson(bean);
}
- @AuthIgnore
@HttpMapping(url = "/hello/asyncfind/", comment = "根据id查找单个Hello对象")
@HttpParam(name = "#", type = int.class, comment = "Hello对象id")
public void asyncfind(HttpRequest req, HttpResponse resp) throws IOException {