This commit is contained in:
Redkale
2017-05-16 20:14:35 +08:00
parent 85c708b075
commit 3dcc6ea28f
4 changed files with 3 additions and 23 deletions

View File

@@ -164,7 +164,6 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
private HashMap<String, Entry> load() {
WebServlet module = this.getClass().getAnnotation(WebServlet.class);
final int serviceid = module == null ? 0 : module.moduleid();
final boolean typeIgnore = module == null ? true : !module.auth();
final HashMap<String, Entry> map = new HashMap<>();
HashMap<String, Class> nameset = new HashMap<>();
final Class selfClz = this.getClass();
@@ -196,7 +195,7 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
throw new RuntimeException(this.getClass().getSimpleName() + " have two same " + HttpMapping.class.getSimpleName() + "(" + name + ")");
}
nameset.put(name, clz);
map.put(name, new Entry(typeIgnore, serviceid, actionid, name, methods, method, createHttpServlet(method)));
map.put(name, new Entry(serviceid, actionid, name, methods, method, createHttpServlet(method)));
}
} while ((clz = clz.getSuperclass()) != HttpServlet.class);
return map;
@@ -283,7 +282,7 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
private static final class Entry {
public Entry(boolean typeIgnore, int moduleid, int actionid, String name, String[] methods, Method method, HttpServlet servlet) {
public Entry(int moduleid, int actionid, String name, String[] methods, Method method, HttpServlet servlet) {
this.moduleid = moduleid;
this.actionid = actionid;
this.name = name;
@@ -291,7 +290,7 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
this.method = method;
this.servlet = servlet;
HttpMapping mapping = method.getAnnotation(HttpMapping.class);
this.ignore = typeIgnore || (mapping == null || !mapping.auth());
this.ignore = mapping == null || !mapping.auth();
this.cacheseconds = mapping == null ? 0 : mapping.cacheseconds();
this.cache = cacheseconds > 0 ? new ConcurrentHashMap() : null;
this.cacheHandler = cacheseconds > 0 ? (HttpResponse response, ByteBuffer[] buffers) -> {

View File

@@ -164,7 +164,6 @@ public final class Rest {
{ //注入 @WebServlet 注解
String urlpath = "/" + defmodulename + "/*";
int moduleid = controller == null ? 0 : controller.moduleid();
boolean auth = controller == null ? false : controller.auth();
boolean repair = controller == null ? true : controller.repair();
String comment = controller == null ? "" : controller.comment();
av0 = cw.visitAnnotation(webServletDesc, true);
@@ -174,13 +173,11 @@ public final class Rest {
av1.visitEnd();
}
av0.visit("moduleid", moduleid);
av0.visit("auth", auth);
av0.visit("repair", repair);
av0.visit("comment", comment);
av0.visitEnd();
classMap.put("type", serviceType.getName());
classMap.put("url", urlpath);
classMap.put("auth", auth);
classMap.put("moduleid", moduleid);
classMap.put("repair", repair);
classMap.put("comment", comment);

View File

@@ -50,14 +50,6 @@ public @interface RestService {
*/
boolean ignore() default false;
/**
* 是否鉴权,默认不鉴权 <br>
* 同&#64;WebServlet的auth属性
*
* @return boolean
*/
boolean auth() default false;
/**
* 同&#64;WebServlet的repair属性
*

View File

@@ -49,14 +49,6 @@ public @interface WebServlet {
*/
int moduleid() default 0;
/**
* 是否鉴权,默认不鉴权 <br>
* 标记为不鉴权的HttpServlet 其内部所有方法都将不进行鉴权
*
* @return boolean
*/
boolean auth() default false;
/**
* 备注描述
*