This commit is contained in:
@@ -219,8 +219,11 @@ public abstract class HttpBaseServlet extends HttpServlet {
|
|||||||
WebServlet module = this.getClass().getAnnotation(WebServlet.class);
|
WebServlet module = this.getClass().getAnnotation(WebServlet.class);
|
||||||
final int serviceid = module == null ? 0 : module.moduleid();
|
final int serviceid = module == null ? 0 : module.moduleid();
|
||||||
final HashMap<String, Entry> map = new HashMap<>();
|
final HashMap<String, Entry> map = new HashMap<>();
|
||||||
Set<String> nameset = new HashSet<>();
|
HashMap<String, Class> nameset = new HashMap<>();
|
||||||
for (final Method method : this.getClass().getMethods()) {
|
Class clz = this.getClass();
|
||||||
|
do {
|
||||||
|
if (Modifier.isAbstract(clz.getModifiers())) break;
|
||||||
|
for (final Method method : clz.getMethods()) {
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
String methodname = method.getName();
|
String methodname = method.getName();
|
||||||
if ("service".equals(methodname) || "preExecute".equals(methodname) || "execute".equals(methodname) || "authenticate".equals(methodname)) continue;
|
if ("service".equals(methodname) || "preExecute".equals(methodname) || "execute".equals(methodname) || "authenticate".equals(methodname)) continue;
|
||||||
@@ -237,11 +240,14 @@ public abstract class HttpBaseServlet extends HttpServlet {
|
|||||||
if (action == null) continue;
|
if (action == null) continue;
|
||||||
final int actionid = action.actionid();
|
final int actionid = action.actionid();
|
||||||
final String name = action.url().trim();
|
final String name = action.url().trim();
|
||||||
|
if (nameset.containsKey(name)) {
|
||||||
if (nameset.contains(name)) throw new RuntimeException(this.getClass().getSimpleName() + " has two same " + WebAction.class.getSimpleName() + "(" + name + ")");
|
if (nameset.get(name) != clz) continue;
|
||||||
nameset.add(name);
|
throw new RuntimeException(this.getClass().getSimpleName() + " has two same " + WebAction.class.getSimpleName() + "(" + name + ")");
|
||||||
|
}
|
||||||
|
nameset.put(name, clz);
|
||||||
map.put(name, new Entry(typeIgnore, serviceid, actionid, name, action.methods(), method, createHttpServlet(method)));
|
map.put(name, new Entry(typeIgnore, serviceid, actionid, name, action.methods(), method, createHttpServlet(method)));
|
||||||
}
|
}
|
||||||
|
} while ((clz = clz.getSuperclass()) != HttpBaseServlet.class);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user