我正在编写我的第一个javax.servlet.Filter
impl 并尝试编写doFilter
方法的一部分,以防止请求在链中进一步传播:
@Override
public void doFilter(ServletRequest request, ServletResponse response)
FilterChain chain) throws IOException, ServletException {
// Check for some stuff in the request...
boolean passesInspection = inspect(request);
if(!passesInspection)
// How do I prevent the request from going any further?
// I don't want it even getting to the servlet at this point!
}
我如何“阻止”请求甚至将其发送到侦听 servlet?提前致谢。