javassist,获取doGet方法的第二个参数
javassist, get second param of doGet method
我将我的代码注入 doGet
方法
val replace = "" +
" System.out.println(\"[before] " + className + "\");" +
" $proceed($$);" +
" try{System.out.println(\"$args[2] = \" + $args[1].toString());}catch(Exception ex){System.out.println(\"ERROR\");}"
" System.out.println(\"[after] " + className + "\");".stripMargin
这里我得到第二个参数,我希望该参数将是 HttpServletResponse class 的实例,但我看到以下 class
org.springframework.security.web.context
.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper@398ce9f7
后面的动作在DefaultServlet、FrameworkServlet
我的现实有什么问题?
HttpServletResponse
是 an interface, so there can be anything there that correctly inmplements the given interface. As you are in Spring, the framework is using its own implementation, as you can see from .toString
mehotd, it is a SaveToSessionResponseWrapper
class.
在第二个 link 上,您可以找到替换的确切位置:
SaveToSessionResponseWrapper wrappedResponse =
new SaveToSessionResponseWrapper(response, request, httpSession != null, context);
requestResponseHolder.setResponse(wrappedResponse);
您可以在此处找到有关此 class 的更多信息:
我将我的代码注入 doGet
方法
val replace = "" +
" System.out.println(\"[before] " + className + "\");" +
" $proceed($$);" +
" try{System.out.println(\"$args[2] = \" + $args[1].toString());}catch(Exception ex){System.out.println(\"ERROR\");}"
" System.out.println(\"[after] " + className + "\");".stripMargin
这里我得到第二个参数,我希望该参数将是 HttpServletResponse class 的实例,但我看到以下 class
org.springframework.security.web.context
.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper@398ce9f7
后面的动作在DefaultServlet、FrameworkServlet
我的现实有什么问题?
HttpServletResponse
是 an interface, so there can be anything there that correctly inmplements the given interface. As you are in Spring, the framework is using its own implementation, as you can see from .toString
mehotd, it is a SaveToSessionResponseWrapper
class.
在第二个 link 上,您可以找到替换的确切位置:
SaveToSessionResponseWrapper wrappedResponse =
new SaveToSessionResponseWrapper(response, request, httpSession != null, context);
requestResponseHolder.setResponse(wrappedResponse);
您可以在此处找到有关此 class 的更多信息: