我需要为我的Jersey代码制作一个自定义过滤器......所以,在这个类中
package com.test.security;
@Path("/secured")
public class Test {
@POST
public void postData() {}
}
我想在下面创建这个类,找出哪个类处理/secured
public class SecurityFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
//
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest http = (HttpServletRequest) request;
System.out.println("session: " + http.getSession().getId());
System.out.println("method: " + http.getMethod());
System.out.println("url: " + http.getContextPath());
System.out.println("class handler: " + <?????> );
chain.doFilter(request, response);
}
@Override
public void destroy() {
//
}
}
那应该输出
method: POST
url: /secured
class handler: com.test.security.Test
简而言之,当客户端请求URL时,我想找出哪个类负责它。