Browse Source

延迟对 args 的获取,以便在拦截器中能让 inv.getController().setHttpServletRequest(...)
更好工作

James 8 years ago
parent
commit
643e6f51b7
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/main/java/com/jfinal/aop/Invocation.java

+ 3 - 1
src/main/java/com/jfinal/aop/Invocation.java

@@ -50,7 +50,7 @@ public class Invocation {
 		this.action = action;
 		this.inters = action.getInterceptors();
 		this.target = controller;
-		this.args = action.getParameterGetter().get(controller);
+		// this.args = action.getParameterGetter().get(controller);
 	}
 	
 	public Invocation(Object target, Method method, Object[] args, MethodProxy methodProxy, Interceptor[] inters) {
@@ -70,6 +70,8 @@ public class Invocation {
 			try {
 				// Invoke the action
 				if (action != null) {
+					// 延迟对 args 的获取,以便在拦截器中能让 inv.getController().setHttpServletRequest(...) 更好工作
+					args = action.getParameterGetter().get((Controller)target);
 					returnValue = action.getMethod().invoke(target, args);
 				}
 				// Invoke the method