如题,有没有什么api可以直接拿到这次访问所请求的action的类名。或者soring配置的哪个bean

解决方案 »

  1.   

    配置一个aop增强,就可以获得访问方法的类名
      

  2.   

    String requestUri = request.getRequestURI();
    String contextPath = request.getContextPath();
    String url = requestUri.substring(contextPath.length());url就是这次访问的action
      

  3.   

    自己写个拦截器
    public class CatchUrlInterceptor implements Interceptor{
    private static final long serialVersionUID = -4502868552994820483L; public void destroy() {

    } public void init() {

    } public String intercept(ActionInvocation invocation) throws Exception {
    ActionProxy proxy = invocation.getProxy();
    String namespace = proxy.getNamespace();
    String actionName = proxy.getActionName(); return invocation.invoke();
    }}
      

  4.   


    谢谢,用proxy.getAction().getClass()获得了具体地址。。