// // ======================================================================== // Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 // and Apache License v2.0 which accompanies this distribution. // // The Eclipse Public License is available at // http://www.eclipse.org/legal/epl-v10.html // // The Apache License v2.0 is available at // http://www.opensource.org/licenses/apache2.0.php // // You may elect to redistribute this code under either of these licenses. // ======================================================================== // package org.eclipse.jetty.servlets; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.Request; /** * This is an extension to {@link DoSFilter} that uses Jetty APIs to * abruptly close the connection when the request times out. */ public class CloseableDoSFilter extends DoSFilter { @Override protected void onRequestTimeout(HttpServletRequest request, HttpServletResponse response, Thread handlingThread) { Request base_request=Request.getBaseRequest(request); base_request.getHttpChannel().getEndPoint().close(); } }