|
@@ -42,17 +42,6 @@ public class ActionMapping {
|
|
|
this.routes = routes;
|
|
this.routes = routes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /*
|
|
|
|
|
- protected Set<String> buildExcludedMethodName() {
|
|
|
|
|
- Set<String> excludedMethodName = new HashSet<String>();
|
|
|
|
|
- Method[] methods = Controller.class.getMethods();
|
|
|
|
|
- for (Method m : methods) {
|
|
|
|
|
- // if (m.getParameterTypes().length == 0)
|
|
|
|
|
- excludedMethodName.add(m.getName());
|
|
|
|
|
- }
|
|
|
|
|
- return excludedMethodName;
|
|
|
|
|
- } */
|
|
|
|
|
-
|
|
|
|
|
protected List<Routes> getRoutesList() {
|
|
protected List<Routes> getRoutesList() {
|
|
|
List<Routes> routesList = Routes.getRoutesList();
|
|
List<Routes> routesList = Routes.getRoutesList();
|
|
|
List<Routes> ret = new ArrayList<Routes>(routesList.size() + 1);
|
|
List<Routes> ret = new ArrayList<Routes>(routesList.size() + 1);
|
|
@@ -63,39 +52,36 @@ public class ActionMapping {
|
|
|
|
|
|
|
|
protected void buildActionMapping() {
|
|
protected void buildActionMapping() {
|
|
|
mapping.clear();
|
|
mapping.clear();
|
|
|
- // Set<String> excludedMethodName = buildExcludedMethodName();
|
|
|
|
|
|
|
+ Class<?> dc;
|
|
|
InterceptorManager interMan = InterceptorManager.me();
|
|
InterceptorManager interMan = InterceptorManager.me();
|
|
|
for (Routes routes : getRoutesList()) {
|
|
for (Routes routes : getRoutesList()) {
|
|
|
for (Route route : routes.getRouteItemList()) {
|
|
for (Route route : routes.getRouteItemList()) {
|
|
|
Class<? extends Controller> controllerClass = route.getControllerClass();
|
|
Class<? extends Controller> controllerClass = route.getControllerClass();
|
|
|
Interceptor[] controllerInters = interMan.createControllerInterceptor(controllerClass);
|
|
Interceptor[] controllerInters = interMan.createControllerInterceptor(controllerClass);
|
|
|
|
|
|
|
|
- boolean sonOfController = (controllerClass.getSuperclass() == Controller.class);
|
|
|
|
|
- Method[] methods = (sonOfController ? controllerClass.getDeclaredMethods() : controllerClass.getMethods());
|
|
|
|
|
|
|
+ boolean declaredMethods = routes.getMappingSuperClass()
|
|
|
|
|
+ ? controllerClass.getSuperclass() == Controller.class
|
|
|
|
|
+ : true;
|
|
|
|
|
+
|
|
|
|
|
+ Method[] methods = (declaredMethods ? controllerClass.getDeclaredMethods() : controllerClass.getMethods());
|
|
|
for (Method method : methods) {
|
|
for (Method method : methods) {
|
|
|
- String methodName = method.getName();
|
|
|
|
|
-
|
|
|
|
|
- // if (excludedMethodName.contains(methodName) /* || method.getParameterTypes().length != 0 */)
|
|
|
|
|
- // continue ;
|
|
|
|
|
- // if (sonOfController && !Modifier.isPublic(method.getModifiers()))
|
|
|
|
|
- // continue ;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if (sonOfController) {
|
|
|
|
|
|
|
+ if (declaredMethods) {
|
|
|
if (!Modifier.isPublic(method.getModifiers()))
|
|
if (!Modifier.isPublic(method.getModifiers()))
|
|
|
continue ;
|
|
continue ;
|
|
|
} else {
|
|
} else {
|
|
|
- if (method.getDeclaringClass() == Controller.class || method.getDeclaringClass() == Object.class)
|
|
|
|
|
|
|
+ dc = method.getDeclaringClass();
|
|
|
|
|
+ if (dc == Controller.class || dc == Object.class)
|
|
|
continue ;
|
|
continue ;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- if (method.getAnnotation(NotAction.class) != null)
|
|
|
|
|
|
|
+ if (method.getAnnotation(NotAction.class) != null) {
|
|
|
continue ;
|
|
continue ;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
Interceptor[] actionInters = interMan.buildControllerActionInterceptor(routes.getInterceptors(), controllerInters, controllerClass, method);
|
|
Interceptor[] actionInters = interMan.buildControllerActionInterceptor(routes.getInterceptors(), controllerInters, controllerClass, method);
|
|
|
String controllerKey = route.getControllerKey();
|
|
String controllerKey = route.getControllerKey();
|
|
|
|
|
|
|
|
|
|
+ String methodName = method.getName();
|
|
|
ActionKey ak = method.getAnnotation(ActionKey.class);
|
|
ActionKey ak = method.getAnnotation(ActionKey.class);
|
|
|
String actionKey;
|
|
String actionKey;
|
|
|
if (ak != null) {
|
|
if (ak != null) {
|