Removed redundant code and cleaned up.
This commit is contained in:
parent
bb0a320102
commit
297625b446
|
@ -1,5 +1,3 @@
|
||||||
package org.eclipse.jetty.rewrite.handler;
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
//Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
|
//Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
@ -12,12 +10,10 @@ package org.eclipse.jetty.rewrite.handler;
|
||||||
//http://www.opensource.org/licenses/apache2.0.php
|
//http://www.opensource.org/licenses/apache2.0.php
|
||||||
//You may elect to redistribute this code under either of these licenses.
|
//You may elect to redistribute this code under either of these licenses.
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
package org.eclipse.jetty.rewrite.handler;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -35,6 +31,8 @@ import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class ProxyRuleTest
|
public class ProxyRuleTest
|
||||||
{
|
{
|
||||||
private static ProxyRule _rule;
|
private static ProxyRule _rule;
|
||||||
|
|
|
@ -4,35 +4,31 @@
|
||||||
// All rights reserved. This program and the accompanying materials
|
// All rights reserved. This program and the accompanying materials
|
||||||
// are made available under the terms of the Eclipse Public License v1.0
|
// are made available under the terms of the Eclipse Public License v1.0
|
||||||
// and Apache License v2.0 which accompanies this distribution.
|
// and Apache License v2.0 which accompanies this distribution.
|
||||||
// The Eclipse Public License is available at
|
// The Eclipse Public License is available at
|
||||||
// http://www.eclipse.org/legal/epl-v10.html
|
// http://www.eclipse.org/legal/epl-v10.html
|
||||||
// The Apache License v2.0 is available at
|
// The Apache License v2.0 is available at
|
||||||
// http://www.opensource.org/licenses/apache2.0.php
|
// http://www.opensource.org/licenses/apache2.0.php
|
||||||
// You may elect to redistribute this code under either of these licenses.
|
// You may elect to redistribute this code under either of these licenses.
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jetty.server.nio;
|
package org.eclipse.jetty.server.nio;
|
||||||
|
|
||||||
import org.eclipse.jetty.io.Buffers.Type;
|
import org.eclipse.jetty.io.Buffers.Type;
|
||||||
import org.eclipse.jetty.server.AbstractConnector;
|
import org.eclipse.jetty.server.AbstractConnector;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public abstract class AbstractNIOConnector extends AbstractConnector implements NIOConnector
|
public abstract class AbstractNIOConnector extends AbstractConnector implements NIOConnector
|
||||||
{
|
{
|
||||||
|
public AbstractNIOConnector()
|
||||||
{
|
{
|
||||||
_buffers.setRequestBufferType(Type.DIRECT);
|
_buffers.setRequestBufferType(Type.DIRECT);
|
||||||
_buffers.setRequestHeaderType(Type.INDIRECT);
|
_buffers.setRequestHeaderType(Type.INDIRECT);
|
||||||
_buffers.setResponseBufferType(Type.DIRECT);
|
_buffers.setResponseBufferType(Type.DIRECT);
|
||||||
_buffers.setResponseHeaderType(Type.INDIRECT);
|
_buffers.setResponseHeaderType(Type.INDIRECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
public boolean getUseDirectBuffers()
|
public boolean getUseDirectBuffers()
|
||||||
{
|
{
|
||||||
|
@ -49,5 +45,4 @@ public abstract class AbstractNIOConnector extends AbstractConnector implements
|
||||||
_buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT);
|
_buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT);
|
||||||
_buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT);
|
_buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import java.net.Socket;
|
||||||
import java.nio.channels.SelectionKey;
|
import java.nio.channels.SelectionKey;
|
||||||
import java.nio.channels.ServerSocketChannel;
|
import java.nio.channels.ServerSocketChannel;
|
||||||
import java.nio.channels.SocketChannel;
|
import java.nio.channels.SocketChannel;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.continuation.Continuation;
|
import org.eclipse.jetty.continuation.Continuation;
|
||||||
import org.eclipse.jetty.io.AsyncEndPoint;
|
import org.eclipse.jetty.io.AsyncEndPoint;
|
||||||
|
@ -32,9 +31,6 @@ import org.eclipse.jetty.io.nio.SelectorManager;
|
||||||
import org.eclipse.jetty.io.nio.SelectorManager.SelectSet;
|
import org.eclipse.jetty.io.nio.SelectorManager.SelectSet;
|
||||||
import org.eclipse.jetty.server.AsyncHttpConnection;
|
import org.eclipse.jetty.server.AsyncHttpConnection;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
|
||||||
import org.eclipse.jetty.util.log.Log;
|
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
|
||||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
@ -65,8 +61,6 @@ import org.eclipse.jetty.util.thread.ThreadPool;
|
||||||
*/
|
*/
|
||||||
public class SelectChannelConnector extends AbstractNIOConnector
|
public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(SelectChannelConnector.class);
|
|
||||||
|
|
||||||
protected ServerSocketChannel _acceptChannel;
|
protected ServerSocketChannel _acceptChannel;
|
||||||
private int _lowResourcesConnections;
|
private int _lowResourcesConnections;
|
||||||
private int _lowResourcesMaxIdleTime;
|
private int _lowResourcesMaxIdleTime;
|
||||||
|
@ -126,7 +120,6 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
@Override
|
@Override
|
||||||
public void customize(EndPoint endpoint, Request request) throws IOException
|
public void customize(EndPoint endpoint, Request request) throws IOException
|
||||||
{
|
{
|
||||||
AsyncEndPoint aEndp = ((AsyncEndPoint)endpoint);
|
|
||||||
request.setTimeStamp(System.currentTimeMillis());
|
request.setTimeStamp(System.currentTimeMillis());
|
||||||
endpoint.setMaxIdleTime(_maxIdleTime);
|
endpoint.setMaxIdleTime(_maxIdleTime);
|
||||||
super.customize(endpoint, request);
|
super.customize(endpoint, request);
|
||||||
|
@ -182,9 +175,8 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
_localPort=_acceptChannel.socket().getLocalPort();
|
_localPort=_acceptChannel.socket().getLocalPort();
|
||||||
if (_localPort<=0)
|
if (_localPort<=0)
|
||||||
throw new IOException("Server channel not bound");
|
throw new IOException("Server channel not bound");
|
||||||
|
|
||||||
addBean(_acceptChannel);
|
|
||||||
|
|
||||||
|
addBean(_acceptChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,17 +251,6 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
super.doStart();
|
super.doStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.jetty.server.server.AbstractConnector#doStop()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void doStop() throws Exception
|
|
||||||
{
|
|
||||||
close();
|
|
||||||
super.doStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException
|
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException
|
||||||
{
|
{
|
||||||
|
@ -336,5 +317,4 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||||
return SelectChannelConnector.this.newEndPoint(channel,selectSet,sKey);
|
return SelectChannelConnector.this.newEndPoint(channel,selectSet,sKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue