Mercurial Hosting > luan
changeset 976:0697c1219e70
remove IdleTimeoutHandler
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 16 Oct 2016 01:14:44 -0600 |
parents | 53b3f7d9714c |
children | d35b0a3a7a4a |
files | src/org/eclipse/jetty/server/handler/IdleTimeoutHandler.java |
diffstat | 1 files changed, 0 insertions(+), 108 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/IdleTimeoutHandler.java Sun Oct 16 01:10:02 2016 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2014 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.server.handler; - -import java.io.IOException; - -import javax.servlet.AsyncEvent; -import javax.servlet.AsyncListener; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.server.AbstractHttpConnection; -import org.eclipse.jetty.server.Request; - -/** - * Handler to adjust the idle timeout of requests while dispatched. - * - * <p>Can be applied in jetty.xml with - * <pre> - * <Get id='handler' name='Handler'/> - * <Set name='Handler'> - * <New id='idleTimeoutHandler' class='org.eclipse.jetty.server.handler.IdleTimeoutHandler'> - * <Set name='Handler'><Ref id='handler'/></Set> - * <Set name='IdleTimeoutMs'>5000</Set> - * </New> - * </Set> - * </pre> - */ -public class IdleTimeoutHandler extends HandlerWrapper -{ - private int _idleTimeoutMs = 1000; - private boolean _applyToAsync = false; - - - public boolean isApplyToAsync() - { - return _applyToAsync; - } - - /** - * Should the adjusted idle time be maintained for asynchronous requests - * @param applyToAsync true if alternate idle timeout is applied to asynchronous requests - */ - public void setApplyToAsync(boolean applyToAsync) - { - _applyToAsync = applyToAsync; - } - - public long getIdleTimeoutMs() - { - return _idleTimeoutMs; - } - - /** - * @param idleTimeoutMs The idle timeout in MS to apply while dispatched or async - */ - public void setIdleTimeoutMs(int _idleTimeoutMs) - { - this._idleTimeoutMs = _idleTimeoutMs; - } - - - @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - AbstractHttpConnection connection = AbstractHttpConnection.getCurrentConnection(); - final EndPoint endp = connection==null?null:connection.getEndPoint(); - - final int idle_timeout; - if (endp==null) - idle_timeout=-1; - else - { - idle_timeout=endp.getMaxIdleTime(); - endp.setMaxIdleTime(_idleTimeoutMs); - } - - try - { - super.handle(target,baseRequest,request,response); - } - finally - { - if (endp!=null) - { - endp.setMaxIdleTime(idle_timeout); - } - } - } -}