mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-27 18:39:13 +00:00
Merge remote-tracking branch 'origin/master' into jetty-8
This commit is contained in:
commit
691efcc7ca
@ -16,20 +16,20 @@ package org.eclipse.jetty.client;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.eclipse.jetty.client.security.Authentication;
|
||||
import org.eclipse.jetty.client.security.RealmResolver;
|
||||
import org.eclipse.jetty.client.security.SecurityListener;
|
||||
import org.eclipse.jetty.http.HttpBuffers;
|
||||
import org.eclipse.jetty.http.HttpBuffersImpl;
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.io.Buffers;
|
||||
import org.eclipse.jetty.io.Buffers.Type;
|
||||
import org.eclipse.jetty.util.Attributes;
|
||||
import org.eclipse.jetty.util.AttributesMap;
|
||||
@ -66,7 +66,7 @@ import org.eclipse.jetty.util.thread.Timeout;
|
||||
* @see HttpExchange
|
||||
* @see HttpDestination
|
||||
*/
|
||||
public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
public class HttpClient extends AggregateLifeCycle implements HttpBuffers, Attributes, Dumpable
|
||||
{
|
||||
public static final int CONNECTOR_SOCKET = 0;
|
||||
public static final int CONNECTOR_SELECT_CHANNEL = 2;
|
||||
@ -91,44 +91,46 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
private int _maxRedirects = 20;
|
||||
private LinkedList<String> _registeredListeners;
|
||||
|
||||
private SslContextFactory _sslContextFactory;
|
||||
private final SslContextFactory _sslContextFactory;
|
||||
|
||||
private RealmResolver _realmResolver;
|
||||
|
||||
private AttributesMap _attributes=new AttributesMap();
|
||||
|
||||
private final HttpBuffersImpl _buffers= new HttpBuffersImpl();
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
private void setBufferTypes()
|
||||
{
|
||||
if (_connectorType==CONNECTOR_SOCKET)
|
||||
{
|
||||
setRequestBufferType(Type.BYTE_ARRAY);
|
||||
setRequestHeaderType(Type.BYTE_ARRAY);
|
||||
setResponseBufferType(Type.BYTE_ARRAY);
|
||||
setResponseHeaderType(Type.BYTE_ARRAY);
|
||||
_buffers.setRequestBufferType(Type.BYTE_ARRAY);
|
||||
_buffers.setRequestHeaderType(Type.BYTE_ARRAY);
|
||||
_buffers.setResponseBufferType(Type.BYTE_ARRAY);
|
||||
_buffers.setResponseHeaderType(Type.BYTE_ARRAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
setRequestBufferType(Type.DIRECT);
|
||||
setRequestHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT);
|
||||
setResponseBufferType(Type.DIRECT);
|
||||
setResponseHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT);
|
||||
_buffers.setRequestBufferType(Type.DIRECT);
|
||||
_buffers.setRequestHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT);
|
||||
_buffers.setResponseBufferType(Type.DIRECT);
|
||||
_buffers.setResponseHeaderType(_useDirectBuffers?Type.DIRECT:Type.INDIRECT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
public HttpClient()
|
||||
{
|
||||
this(new SslContextFactory());
|
||||
setBufferTypes();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
public HttpClient(SslContextFactory sslContextFactory)
|
||||
{
|
||||
_sslContextFactory = sslContextFactory;
|
||||
setBufferTypes();
|
||||
addBean(_sslContextFactory);
|
||||
addBean(_buffers);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
@ -149,25 +151,6 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
_connectBlocking = connectBlocking;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.component.Dumpable#dump()
|
||||
*/
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see org.eclipse.jetty.util.component.Dumpable#dump(java.lang.Appendable, java.lang.String)
|
||||
*/
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append("\n");
|
||||
AggregateLifeCycle.dump(out,indent,Arrays.asList(_threadPool,_connector),_destinations.values());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
public void send(HttpExchange exchange) throws IOException
|
||||
{
|
||||
@ -183,25 +166,20 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
*/
|
||||
public ThreadPool getThreadPool()
|
||||
{
|
||||
if (_threadPool==null)
|
||||
{
|
||||
QueuedThreadPool pool = new QueuedThreadPool();
|
||||
pool.setMaxThreads(16);
|
||||
pool.setDaemon(true);
|
||||
pool.setName("HttpClient");
|
||||
_threadPool = pool;
|
||||
}
|
||||
|
||||
return _threadPool;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
/** Set the ThreadPool.
|
||||
* The threadpool passed is added via {@link #addBean(Object)} so that
|
||||
* it's lifecycle may be managed as a {@link AggregateLifeCycle}.
|
||||
* @param threadPool the threadPool to set
|
||||
*/
|
||||
public void setThreadPool(ThreadPool threadPool)
|
||||
{
|
||||
removeBean(_threadPool);
|
||||
_threadPool = threadPool;
|
||||
addBean(_threadPool);
|
||||
}
|
||||
|
||||
|
||||
@ -338,6 +316,7 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Registers a listener that can listen to the stream of execution between the client and the
|
||||
* server and influence events. Sequential calls to the method wrapper sequentially wrap the preceding
|
||||
@ -422,33 +401,26 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
setBufferTypes();
|
||||
super.doStart();
|
||||
|
||||
_timeoutQ.setDuration(_timeout);
|
||||
_timeoutQ.setNow();
|
||||
_idleTimeoutQ.setDuration(_idleTimeout);
|
||||
_idleTimeoutQ.setNow();
|
||||
|
||||
if (_threadPool == null)
|
||||
getThreadPool();
|
||||
|
||||
if (_threadPool instanceof LifeCycle)
|
||||
if (_threadPool==null)
|
||||
{
|
||||
((LifeCycle)_threadPool).start();
|
||||
QueuedThreadPool pool = new LocalQueuedThreadPool();
|
||||
pool.setMaxThreads(16);
|
||||
pool.setDaemon(true);
|
||||
pool.setName("HttpClient");
|
||||
_threadPool = pool;
|
||||
addBean(_threadPool,true);
|
||||
}
|
||||
|
||||
_sslContextFactory.start();
|
||||
_connector=(_connectorType == CONNECTOR_SELECT_CHANNEL)?new SelectConnector(this):new SocketConnector(this);
|
||||
addBean(_connector,true);
|
||||
|
||||
if (_connectorType == CONNECTOR_SELECT_CHANNEL)
|
||||
{
|
||||
|
||||
_connector = new SelectConnector(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_connector = new SocketConnector(this);
|
||||
}
|
||||
_connector.start();
|
||||
super.doStart();
|
||||
|
||||
_threadPool.dispatch(new Runnable()
|
||||
{
|
||||
@ -462,7 +434,7 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
{
|
||||
Thread.sleep(200);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
catch (InterruptedException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -470,32 +442,25 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
});
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
long getNow()
|
||||
{
|
||||
return _timeoutQ.getNow();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
_connector.stop();
|
||||
_connector = null;
|
||||
_sslContextFactory.stop();
|
||||
|
||||
if (_threadPool instanceof LifeCycle)
|
||||
{
|
||||
((LifeCycle)_threadPool).stop();
|
||||
}
|
||||
for (HttpDestination destination : _destinations.values())
|
||||
{
|
||||
destination.close();
|
||||
}
|
||||
|
||||
_timeoutQ.cancelAll();
|
||||
_idleTimeoutQ.cancelAll();
|
||||
|
||||
super.doStop();
|
||||
|
||||
if (_threadPool instanceof LocalQueuedThreadPool)
|
||||
{
|
||||
removeBean(_threadPool);
|
||||
_threadPool = null;
|
||||
}
|
||||
|
||||
removeBean(_connector);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -667,6 +632,96 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
_maxRedirects = redirects;
|
||||
}
|
||||
|
||||
public int getRequestBufferSize()
|
||||
{
|
||||
return _buffers.getRequestBufferSize();
|
||||
}
|
||||
|
||||
public void setRequestBufferSize(int requestBufferSize)
|
||||
{
|
||||
_buffers.setRequestBufferSize(requestBufferSize);
|
||||
}
|
||||
|
||||
public int getRequestHeaderSize()
|
||||
{
|
||||
return _buffers.getRequestHeaderSize();
|
||||
}
|
||||
|
||||
public void setRequestHeaderSize(int requestHeaderSize)
|
||||
{
|
||||
_buffers.setRequestHeaderSize(requestHeaderSize);
|
||||
}
|
||||
|
||||
public int getResponseBufferSize()
|
||||
{
|
||||
return _buffers.getResponseBufferSize();
|
||||
}
|
||||
|
||||
public void setResponseBufferSize(int responseBufferSize)
|
||||
{
|
||||
_buffers.setResponseBufferSize(responseBufferSize);
|
||||
}
|
||||
|
||||
public int getResponseHeaderSize()
|
||||
{
|
||||
return _buffers.getResponseHeaderSize();
|
||||
}
|
||||
|
||||
public void setResponseHeaderSize(int responseHeaderSize)
|
||||
{
|
||||
_buffers.setResponseHeaderSize(responseHeaderSize);
|
||||
}
|
||||
|
||||
public Type getRequestBufferType()
|
||||
{
|
||||
return _buffers.getRequestBufferType();
|
||||
}
|
||||
|
||||
public Type getRequestHeaderType()
|
||||
{
|
||||
return _buffers.getRequestHeaderType();
|
||||
}
|
||||
|
||||
public Type getResponseBufferType()
|
||||
{
|
||||
return _buffers.getResponseBufferType();
|
||||
}
|
||||
|
||||
public Type getResponseHeaderType()
|
||||
{
|
||||
return _buffers.getResponseHeaderType();
|
||||
}
|
||||
|
||||
public void setRequestBuffers(Buffers requestBuffers)
|
||||
{
|
||||
_buffers.setRequestBuffers(requestBuffers);
|
||||
}
|
||||
|
||||
public void setResponseBuffers(Buffers responseBuffers)
|
||||
{
|
||||
_buffers.setResponseBuffers(responseBuffers);
|
||||
}
|
||||
|
||||
public Buffers getRequestBuffers()
|
||||
{
|
||||
return _buffers.getRequestBuffers();
|
||||
}
|
||||
|
||||
public Buffers getResponseBuffers()
|
||||
{
|
||||
return _buffers.getResponseBuffers();
|
||||
}
|
||||
|
||||
public void setMaxBuffers(int maxBuffers)
|
||||
{
|
||||
_buffers.setMaxBuffers(maxBuffers);
|
||||
}
|
||||
|
||||
public int getMaxBuffers()
|
||||
{
|
||||
return _buffers.getMaxBuffers();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Deprecated
|
||||
public String getTrustStoreLocation()
|
||||
@ -839,4 +894,8 @@ public class HttpClient extends HttpBuffers implements Attributes, Dumpable
|
||||
{
|
||||
_sslContextFactory.setSecureRandomAlgorithm(secureRandomAlgorithm);
|
||||
}
|
||||
|
||||
private static class LocalQueuedThreadPool extends QueuedThreadPool
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,8 @@ import java.net.SocketTimeoutException;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.channels.UnresolvedAddressException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
||||
import org.eclipse.jetty.io.AsyncEndPoint;
|
||||
@ -32,7 +30,6 @@ import org.eclipse.jetty.io.nio.AsyncConnection;
|
||||
import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
|
||||
import org.eclipse.jetty.io.nio.SelectorManager;
|
||||
import org.eclipse.jetty.io.nio.SslConnection;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
@ -41,7 +38,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.Timeout;
|
||||
import org.eclipse.jetty.util.thread.Timeout.Task;
|
||||
|
||||
class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector, Dumpable
|
||||
class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector, Dumpable
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(SelectConnector.class);
|
||||
|
||||
@ -49,39 +46,16 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||
private final Manager _selectorManager=new Manager();
|
||||
private final Map<SocketChannel, Timeout.Task> _connectingChannels = new ConcurrentHashMap<SocketChannel, Timeout.Task>();
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param httpClient the HttpClient this connector is associated to
|
||||
* @param httpClient the HttpClient this connector is associated to. It is
|
||||
* added via the {@link #addBean(Object, boolean)} as an unmanaged bean.
|
||||
*/
|
||||
SelectConnector(HttpClient httpClient)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
super.doStart();
|
||||
|
||||
_selectorManager.start();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
_selectorManager.stop();
|
||||
}
|
||||
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append("\n");
|
||||
AggregateLifeCycle.dump(out, indent, Arrays.asList(_selectorManager));
|
||||
addBean(_httpClient,false);
|
||||
addBean(_selectorManager,true);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -97,9 +71,9 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||
|
||||
if (_httpClient.isConnectBlocking())
|
||||
{
|
||||
channel.socket().connect(address.toSocketAddress(), _httpClient.getConnectTimeout());
|
||||
channel.configureBlocking(false);
|
||||
_selectorManager.register( channel, destination );
|
||||
channel.socket().connect(address.toSocketAddress(), _httpClient.getConnectTimeout());
|
||||
channel.configureBlocking(false);
|
||||
_selectorManager.register( channel, destination );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -451,11 +425,10 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||
{
|
||||
return _endp.isCheckForIdle();
|
||||
}
|
||||
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Upgradable:"+_endp.toString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +139,12 @@ public class DeploymentManager extends AggregateLifeCycle
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Set the AppProviders.
|
||||
* The providers passed are added via {@link #addBean(Object)} so that
|
||||
* their lifecycles may be managed as a {@link AggregateLifeCycle}.
|
||||
* @param providers
|
||||
*/
|
||||
public void setAppProviders(Collection<AppProvider> providers)
|
||||
{
|
||||
if (isRunning())
|
||||
|
@ -19,211 +19,85 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Abstract Buffer pool.
|
||||
* simple unbounded pool of buffers for header, request and response sizes.
|
||||
*
|
||||
*/
|
||||
public class HttpBuffers extends AbstractLifeCycle
|
||||
public interface HttpBuffers
|
||||
{
|
||||
private int _requestBufferSize=16*1024;
|
||||
private int _requestHeaderSize=6*1024;
|
||||
private int _responseBufferSize=32*1024;
|
||||
private int _responseHeaderSize=6*1024;
|
||||
private int _maxBuffers=1024;
|
||||
|
||||
private Buffers.Type _requestBufferType=Buffers.Type.BYTE_ARRAY;
|
||||
private Buffers.Type _requestHeaderType=Buffers.Type.BYTE_ARRAY;
|
||||
private Buffers.Type _responseBufferType=Buffers.Type.BYTE_ARRAY;
|
||||
private Buffers.Type _responseHeaderType=Buffers.Type.BYTE_ARRAY;
|
||||
|
||||
private Buffers _requestBuffers;
|
||||
private Buffers _responseBuffers;
|
||||
|
||||
|
||||
public HttpBuffers()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the requestBufferSize
|
||||
*/
|
||||
public int getRequestBufferSize()
|
||||
{
|
||||
return _requestBufferSize;
|
||||
}
|
||||
public int getRequestBufferSize();
|
||||
|
||||
/**
|
||||
* @param requestBufferSize the requestBufferSize to set
|
||||
*/
|
||||
public void setRequestBufferSize(int requestBufferSize)
|
||||
{
|
||||
_requestBufferSize = requestBufferSize;
|
||||
}
|
||||
public void setRequestBufferSize(int requestBufferSize);
|
||||
|
||||
/**
|
||||
* @return the requestHeaderSize
|
||||
*/
|
||||
public int getRequestHeaderSize()
|
||||
{
|
||||
return _requestHeaderSize;
|
||||
}
|
||||
public int getRequestHeaderSize();
|
||||
|
||||
/**
|
||||
* @param requestHeaderSize the requestHeaderSize to set
|
||||
*/
|
||||
public void setRequestHeaderSize(int requestHeaderSize)
|
||||
{
|
||||
_requestHeaderSize = requestHeaderSize;
|
||||
}
|
||||
public void setRequestHeaderSize(int requestHeaderSize);
|
||||
|
||||
/**
|
||||
* @return the responseBufferSize
|
||||
*/
|
||||
public int getResponseBufferSize()
|
||||
{
|
||||
return _responseBufferSize;
|
||||
}
|
||||
public int getResponseBufferSize();
|
||||
|
||||
/**
|
||||
* @param responseBufferSize the responseBufferSize to set
|
||||
*/
|
||||
public void setResponseBufferSize(int responseBufferSize)
|
||||
{
|
||||
_responseBufferSize = responseBufferSize;
|
||||
}
|
||||
public void setResponseBufferSize(int responseBufferSize);
|
||||
|
||||
/**
|
||||
* @return the responseHeaderSize
|
||||
*/
|
||||
public int getResponseHeaderSize()
|
||||
{
|
||||
return _responseHeaderSize;
|
||||
}
|
||||
public int getResponseHeaderSize();
|
||||
|
||||
/**
|
||||
* @param responseHeaderSize the responseHeaderSize to set
|
||||
*/
|
||||
public void setResponseHeaderSize(int responseHeaderSize)
|
||||
{
|
||||
_responseHeaderSize = responseHeaderSize;
|
||||
}
|
||||
public void setResponseHeaderSize(int responseHeaderSize);
|
||||
|
||||
/**
|
||||
* @return the requestBufferType
|
||||
*/
|
||||
public Buffers.Type getRequestBufferType()
|
||||
{
|
||||
return _requestBufferType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestBufferType the requestBufferType to set
|
||||
*/
|
||||
protected void setRequestBufferType(Buffers.Type requestBufferType)
|
||||
{
|
||||
_requestBufferType = requestBufferType;
|
||||
}
|
||||
public Buffers.Type getRequestBufferType();
|
||||
|
||||
/**
|
||||
* @return the requestHeaderType
|
||||
*/
|
||||
public Buffers.Type getRequestHeaderType()
|
||||
{
|
||||
return _requestHeaderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestHeaderType the requestHeaderType to set
|
||||
*/
|
||||
protected void setRequestHeaderType(Buffers.Type requestHeaderType)
|
||||
{
|
||||
_requestHeaderType = requestHeaderType;
|
||||
}
|
||||
public Buffers.Type getRequestHeaderType();
|
||||
|
||||
/**
|
||||
* @return the responseBufferType
|
||||
*/
|
||||
public Buffers.Type getResponseBufferType()
|
||||
{
|
||||
return _responseBufferType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseBufferType the responseBufferType to set
|
||||
*/
|
||||
protected void setResponseBufferType(Buffers.Type responseBufferType)
|
||||
{
|
||||
_responseBufferType = responseBufferType;
|
||||
}
|
||||
public Buffers.Type getResponseBufferType();
|
||||
|
||||
/**
|
||||
* @return the responseHeaderType
|
||||
*/
|
||||
public Buffers.Type getResponseHeaderType()
|
||||
{
|
||||
return _responseHeaderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseHeaderType the responseHeaderType to set
|
||||
*/
|
||||
protected void setResponseHeaderType(Buffers.Type responseHeaderType)
|
||||
{
|
||||
_responseHeaderType = responseHeaderType;
|
||||
}
|
||||
public Buffers.Type getResponseHeaderType();
|
||||
|
||||
/**
|
||||
* @param requestBuffers the requestBuffers to set
|
||||
*/
|
||||
public void setRequestBuffers(Buffers requestBuffers)
|
||||
{
|
||||
_requestBuffers = requestBuffers;
|
||||
}
|
||||
public void setRequestBuffers(Buffers requestBuffers);
|
||||
|
||||
/**
|
||||
* @param responseBuffers the responseBuffers to set
|
||||
*/
|
||||
public void setResponseBuffers(Buffers responseBuffers)
|
||||
{
|
||||
_responseBuffers = responseBuffers;
|
||||
}
|
||||
public void setResponseBuffers(Buffers responseBuffers);
|
||||
|
||||
@Override
|
||||
protected void doStart()
|
||||
throws Exception
|
||||
{
|
||||
_requestBuffers=BuffersFactory.newBuffers(_requestHeaderType,_requestHeaderSize,_requestBufferType,_requestBufferSize,_requestBufferType,getMaxBuffers());
|
||||
_responseBuffers=BuffersFactory.newBuffers(_responseHeaderType,_responseHeaderSize,_responseBufferType,_responseBufferSize,_responseBufferType,getMaxBuffers());
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop()
|
||||
throws Exception
|
||||
{
|
||||
_requestBuffers=null;
|
||||
_responseBuffers=null;
|
||||
}
|
||||
public Buffers getRequestBuffers();
|
||||
|
||||
public Buffers getRequestBuffers()
|
||||
{
|
||||
return _requestBuffers;
|
||||
}
|
||||
|
||||
public Buffers getResponseBuffers();
|
||||
|
||||
public Buffers getResponseBuffers()
|
||||
{
|
||||
return _responseBuffers;
|
||||
}
|
||||
public void setMaxBuffers(int maxBuffers);
|
||||
|
||||
public void setMaxBuffers(int maxBuffers)
|
||||
{
|
||||
_maxBuffers = maxBuffers;
|
||||
}
|
||||
|
||||
public int getMaxBuffers()
|
||||
{
|
||||
return _maxBuffers;
|
||||
}
|
||||
public int getMaxBuffers();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,233 @@
|
||||
// ========================================================================
|
||||
// Copyright (c) 2004-2009 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.http;
|
||||
|
||||
import org.eclipse.jetty.io.Buffers;
|
||||
import org.eclipse.jetty.io.BuffersFactory;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Abstract Buffer pool.
|
||||
* simple unbounded pool of buffers for header, request and response sizes.
|
||||
*
|
||||
*/
|
||||
public class HttpBuffersImpl extends AbstractLifeCycle implements HttpBuffers
|
||||
{
|
||||
private int _requestBufferSize=16*1024;
|
||||
private int _requestHeaderSize=6*1024;
|
||||
private int _responseBufferSize=32*1024;
|
||||
private int _responseHeaderSize=6*1024;
|
||||
private int _maxBuffers=1024;
|
||||
|
||||
private Buffers.Type _requestBufferType=Buffers.Type.BYTE_ARRAY;
|
||||
private Buffers.Type _requestHeaderType=Buffers.Type.BYTE_ARRAY;
|
||||
private Buffers.Type _responseBufferType=Buffers.Type.BYTE_ARRAY;
|
||||
private Buffers.Type _responseHeaderType=Buffers.Type.BYTE_ARRAY;
|
||||
|
||||
private Buffers _requestBuffers;
|
||||
private Buffers _responseBuffers;
|
||||
|
||||
|
||||
public HttpBuffersImpl()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the requestBufferSize
|
||||
*/
|
||||
public int getRequestBufferSize()
|
||||
{
|
||||
return _requestBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestBufferSize the requestBufferSize to set
|
||||
*/
|
||||
public void setRequestBufferSize(int requestBufferSize)
|
||||
{
|
||||
_requestBufferSize = requestBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the requestHeaderSize
|
||||
*/
|
||||
public int getRequestHeaderSize()
|
||||
{
|
||||
return _requestHeaderSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestHeaderSize the requestHeaderSize to set
|
||||
*/
|
||||
public void setRequestHeaderSize(int requestHeaderSize)
|
||||
{
|
||||
_requestHeaderSize = requestHeaderSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the responseBufferSize
|
||||
*/
|
||||
public int getResponseBufferSize()
|
||||
{
|
||||
return _responseBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseBufferSize the responseBufferSize to set
|
||||
*/
|
||||
public void setResponseBufferSize(int responseBufferSize)
|
||||
{
|
||||
_responseBufferSize = responseBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the responseHeaderSize
|
||||
*/
|
||||
public int getResponseHeaderSize()
|
||||
{
|
||||
return _responseHeaderSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseHeaderSize the responseHeaderSize to set
|
||||
*/
|
||||
public void setResponseHeaderSize(int responseHeaderSize)
|
||||
{
|
||||
_responseHeaderSize = responseHeaderSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the requestBufferType
|
||||
*/
|
||||
public Buffers.Type getRequestBufferType()
|
||||
{
|
||||
return _requestBufferType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestBufferType the requestBufferType to set
|
||||
*/
|
||||
public void setRequestBufferType(Buffers.Type requestBufferType)
|
||||
{
|
||||
_requestBufferType = requestBufferType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the requestHeaderType
|
||||
*/
|
||||
public Buffers.Type getRequestHeaderType()
|
||||
{
|
||||
return _requestHeaderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestHeaderType the requestHeaderType to set
|
||||
*/
|
||||
public void setRequestHeaderType(Buffers.Type requestHeaderType)
|
||||
{
|
||||
_requestHeaderType = requestHeaderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the responseBufferType
|
||||
*/
|
||||
public Buffers.Type getResponseBufferType()
|
||||
{
|
||||
return _responseBufferType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseBufferType the responseBufferType to set
|
||||
*/
|
||||
public void setResponseBufferType(Buffers.Type responseBufferType)
|
||||
{
|
||||
_responseBufferType = responseBufferType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the responseHeaderType
|
||||
*/
|
||||
public Buffers.Type getResponseHeaderType()
|
||||
{
|
||||
return _responseHeaderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseHeaderType the responseHeaderType to set
|
||||
*/
|
||||
public void setResponseHeaderType(Buffers.Type responseHeaderType)
|
||||
{
|
||||
_responseHeaderType = responseHeaderType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestBuffers the requestBuffers to set
|
||||
*/
|
||||
public void setRequestBuffers(Buffers requestBuffers)
|
||||
{
|
||||
_requestBuffers = requestBuffers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param responseBuffers the responseBuffers to set
|
||||
*/
|
||||
public void setResponseBuffers(Buffers responseBuffers)
|
||||
{
|
||||
_responseBuffers = responseBuffers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart()
|
||||
throws Exception
|
||||
{
|
||||
_requestBuffers=BuffersFactory.newBuffers(_requestHeaderType,_requestHeaderSize,_requestBufferType,_requestBufferSize,_requestBufferType,getMaxBuffers());
|
||||
_responseBuffers=BuffersFactory.newBuffers(_responseHeaderType,_responseHeaderSize,_responseBufferType,_responseBufferSize,_responseBufferType,getMaxBuffers());
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop()
|
||||
throws Exception
|
||||
{
|
||||
_requestBuffers=null;
|
||||
_responseBuffers=null;
|
||||
}
|
||||
|
||||
public Buffers getRequestBuffers()
|
||||
{
|
||||
return _requestBuffers;
|
||||
}
|
||||
|
||||
|
||||
public Buffers getResponseBuffers()
|
||||
{
|
||||
return _responseBuffers;
|
||||
}
|
||||
|
||||
public void setMaxBuffers(int maxBuffers)
|
||||
{
|
||||
_maxBuffers = maxBuffers;
|
||||
}
|
||||
|
||||
public int getMaxBuffers()
|
||||
{
|
||||
return _maxBuffers;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return _requestBuffers+"/"+_responseBuffers;
|
||||
}
|
||||
}
|
@ -58,7 +58,7 @@ public abstract class AbstractBuffers implements Buffers
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Create a new content Buffer
|
||||
@ -77,7 +77,7 @@ public abstract class AbstractBuffers implements Buffers
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Create a new content Buffer
|
||||
@ -142,4 +142,9 @@ public abstract class AbstractBuffers implements Buffers
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/* ------------------------------------------------------------ */
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s [%d,%d]", getClass().getSimpleName(), _headerSize, _bufferSize);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class PooledBuffers extends AbstractBuffers
|
||||
_otherBuffers=bufferType==otherType;
|
||||
_maxSize=maxSize;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Buffer getHeader()
|
||||
{
|
||||
@ -55,17 +55,17 @@ public class PooledBuffers extends AbstractBuffers
|
||||
return getHeader();
|
||||
if (_otherBuffers && size==getBufferSize())
|
||||
return getBuffer();
|
||||
|
||||
|
||||
// Look for an other buffer
|
||||
Buffer buffer = _others.poll();
|
||||
|
||||
|
||||
// consume all other buffers until one of the right size is found
|
||||
while (buffer!=null && buffer.capacity()!=size)
|
||||
{
|
||||
_size.decrementAndGet();
|
||||
buffer = _others.poll();
|
||||
}
|
||||
|
||||
|
||||
if (buffer==null)
|
||||
buffer=newBuffer(size);
|
||||
else
|
||||
@ -89,7 +89,16 @@ public class PooledBuffers extends AbstractBuffers
|
||||
else if (isBuffer(buffer))
|
||||
_buffers.add(buffer);
|
||||
else
|
||||
_others.add(buffer);
|
||||
_others.add(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s [%d/%d@%d,%d/%d@%d,%d/%d@-]",
|
||||
getClass().getSimpleName(),
|
||||
_headers.size(),_maxSize,_headerSize,
|
||||
_buffers.size(),_maxSize,_bufferSize,
|
||||
_others.size(),_maxSize);
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||
for (int i=0;i<getSelectSets();i++)
|
||||
{
|
||||
final int id=i;
|
||||
dispatch(new Runnable()
|
||||
boolean selecting=dispatch(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
@ -303,6 +303,9 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (!selecting)
|
||||
throw new IllegalStateException("!Selecting");
|
||||
}
|
||||
}
|
||||
|
||||
@ -957,6 +960,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
||||
{
|
||||
LOG.ignore(e);
|
||||
}
|
||||
|
||||
AggregateLifeCycle.dump(out,indent,dump);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,6 @@
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>${javax-mail-version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.activation</groupId>
|
||||
|
@ -4,17 +4,15 @@
|
||||
// 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
|
||||
// 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.
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.monitor;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
@ -22,7 +20,6 @@ import java.lang.management.ManagementFactory;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -35,13 +32,12 @@ import org.eclipse.jetty.client.security.SimpleRealmResolver;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.monitor.JMXMonitor;
|
||||
import org.eclipse.jetty.monitor.jmx.ConsoleNotifier;
|
||||
import org.eclipse.jetty.monitor.jmx.EventNotifier;
|
||||
import org.eclipse.jetty.monitor.jmx.EventState;
|
||||
import org.eclipse.jetty.monitor.jmx.EventState.TriggerState;
|
||||
import org.eclipse.jetty.monitor.jmx.EventTrigger;
|
||||
import org.eclipse.jetty.monitor.jmx.MonitorAction;
|
||||
import org.eclipse.jetty.monitor.jmx.EventState.TriggerState;
|
||||
import org.eclipse.jetty.monitor.triggers.AndEventTrigger;
|
||||
import org.eclipse.jetty.monitor.triggers.AttrEventTrigger;
|
||||
import org.eclipse.jetty.monitor.triggers.EqualToAttrEventTrigger;
|
||||
@ -61,6 +57,8 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
@ -81,93 +79,93 @@ public class AttrEventTriggerTest
|
||||
File docRoot = new File("target/test-output/docroot/");
|
||||
docRoot.mkdirs();
|
||||
docRoot.deleteOnExit();
|
||||
|
||||
|
||||
System.setProperty("org.eclipse.jetty.util.log.DEBUG","");
|
||||
_server = new Server();
|
||||
|
||||
|
||||
SelectChannelConnector connector = new SelectChannelConnector();
|
||||
_server.addConnector(connector);
|
||||
|
||||
|
||||
_handler = new TestHandler();
|
||||
_server.setHandler(_handler);
|
||||
|
||||
|
||||
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
|
||||
MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
|
||||
mBeanContainer.addBean(Log.getLog());
|
||||
|
||||
_counter = _handler.getRequestCounter();
|
||||
mBeanContainer.addBean(_counter);
|
||||
|
||||
_server.addBean(mBeanContainer);
|
||||
_server.getContainer().addEventListener(mBeanContainer);
|
||||
|
||||
_server.addBean(mBeanContainer, true);
|
||||
_server.getContainer().addEventListener(mBeanContainer);
|
||||
_server.start();
|
||||
|
||||
|
||||
startClient(null);
|
||||
|
||||
|
||||
_monitor = new JMXMonitor();
|
||||
|
||||
int port = _server.getConnectors()[0].getLocalPort();
|
||||
|
||||
int port = connector.getLocalPort();
|
||||
_requestUrl = "http://localhost:"+port+ "/";
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
stopClient();
|
||||
|
||||
|
||||
if (_server != null)
|
||||
{
|
||||
_server.stop();
|
||||
_server = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNoCondition()
|
||||
throws Exception
|
||||
{
|
||||
long requestCount = 10;
|
||||
|
||||
AttrEventTrigger<Long> trigger =
|
||||
|
||||
AttrEventTrigger<Long> trigger =
|
||||
new AttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter");
|
||||
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(1,requestCount);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEqual_TRUE()
|
||||
throws Exception
|
||||
{
|
||||
long requestCount = 10;
|
||||
long testValue = 5;
|
||||
|
||||
EqualToAttrEventTrigger<Long> trigger =
|
||||
|
||||
EqualToAttrEventTrigger<Long> trigger =
|
||||
new EqualToAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",testValue);
|
||||
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(testValue);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEqual_FALSE()
|
||||
throws Exception
|
||||
{
|
||||
long requestCount = 10;
|
||||
long testValue = 11;
|
||||
|
||||
EqualToAttrEventTrigger<Long> trigger =
|
||||
|
||||
EqualToAttrEventTrigger<Long> trigger =
|
||||
new EqualToAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testValue);
|
||||
|
||||
@ -175,19 +173,19 @@ public class AttrEventTriggerTest
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet();
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLowerLimit()
|
||||
throws Exception
|
||||
{
|
||||
long requestCount = 10;
|
||||
long testRangeLow = 5;
|
||||
|
||||
GreaterThanAttrEventTrigger<Long> trigger =
|
||||
|
||||
GreaterThanAttrEventTrigger<Long> trigger =
|
||||
new GreaterThanAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeLow);
|
||||
|
||||
@ -195,27 +193,27 @@ public class AttrEventTriggerTest
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(6,10);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLowerLimitIncl()
|
||||
throws Exception
|
||||
{
|
||||
long requestCount = 10;
|
||||
long testRangeLow = 5;
|
||||
|
||||
GreaterThanOrEqualToAttrEventTrigger<Long> trigger =
|
||||
|
||||
GreaterThanOrEqualToAttrEventTrigger<Long> trigger =
|
||||
new GreaterThanOrEqualToAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeLow);
|
||||
|
||||
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(5,10);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
@ -226,8 +224,8 @@ public class AttrEventTriggerTest
|
||||
{
|
||||
long requestCount = 10;
|
||||
long testRangeHigh = 5;
|
||||
|
||||
LessThanAttrEventTrigger<Long> trigger =
|
||||
|
||||
LessThanAttrEventTrigger<Long> trigger =
|
||||
new LessThanAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeHigh);
|
||||
|
||||
@ -235,11 +233,11 @@ public class AttrEventTriggerTest
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(1,4);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testUpperLimitIncl()
|
||||
@ -247,8 +245,8 @@ public class AttrEventTriggerTest
|
||||
{
|
||||
long requestCount = 10;
|
||||
long testRangeHigh = 5;
|
||||
|
||||
LessThanOrEqualToAttrEventTrigger<Long> trigger =
|
||||
|
||||
LessThanOrEqualToAttrEventTrigger<Long> trigger =
|
||||
new LessThanOrEqualToAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeHigh);
|
||||
|
||||
@ -256,11 +254,11 @@ public class AttrEventTriggerTest
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(1,5);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRangeInclusive()
|
||||
throws Exception
|
||||
@ -268,20 +266,20 @@ public class AttrEventTriggerTest
|
||||
long requestCount = 10;
|
||||
long testRangeLow = 3;
|
||||
long testRangeHigh = 8;
|
||||
|
||||
RangeInclAttrEventTrigger<Long> trigger =
|
||||
|
||||
RangeInclAttrEventTrigger<Long> trigger =
|
||||
new RangeInclAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeLow, testRangeHigh);
|
||||
|
||||
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(testRangeLow,testRangeHigh);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInsideRangeExclusive()
|
||||
throws Exception
|
||||
@ -289,20 +287,20 @@ public class AttrEventTriggerTest
|
||||
long requestCount = 10;
|
||||
long testRangeLow = 3;
|
||||
long testRangeHigh = 8;
|
||||
|
||||
RangeAttrEventTrigger<Long> trigger =
|
||||
|
||||
RangeAttrEventTrigger<Long> trigger =
|
||||
new RangeAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeLow, testRangeHigh);
|
||||
|
||||
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(testRangeLow+1,testRangeHigh-1);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRangeComposite()
|
||||
throws Exception
|
||||
@ -310,23 +308,23 @@ public class AttrEventTriggerTest
|
||||
long requestCount = 10;
|
||||
long testRangeLow = 4;
|
||||
long testRangeHigh = 7;
|
||||
|
||||
GreaterThanAttrEventTrigger<Long> trigger1 =
|
||||
|
||||
GreaterThanAttrEventTrigger<Long> trigger1 =
|
||||
new GreaterThanAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeLow);
|
||||
LessThanOrEqualToAttrEventTrigger<Long> trigger2 =
|
||||
LessThanOrEqualToAttrEventTrigger<Long> trigger2 =
|
||||
new LessThanOrEqualToAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeHigh);
|
||||
AndEventTrigger trigger = new AndEventTrigger(trigger1, trigger2);
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(testRangeLow+1,testRangeHigh);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRangeOuter()
|
||||
throws Exception
|
||||
@ -334,23 +332,23 @@ public class AttrEventTriggerTest
|
||||
long requestCount = 10;
|
||||
long testRangeLow = 4;
|
||||
long testRangeHigh = 7;
|
||||
|
||||
LessThanOrEqualToAttrEventTrigger<Long> trigger1 =
|
||||
|
||||
LessThanOrEqualToAttrEventTrigger<Long> trigger1 =
|
||||
new LessThanOrEqualToAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeLow);
|
||||
GreaterThanAttrEventTrigger<Long> trigger2 =
|
||||
GreaterThanAttrEventTrigger<Long> trigger2 =
|
||||
new GreaterThanAttrEventTrigger<Long>("org.eclipse.jetty.monitor:type=requestcounter,id=0", "counter",
|
||||
testRangeHigh);
|
||||
OrEventTrigger trigger = new OrEventTrigger(trigger1, trigger2);
|
||||
EventNotifier notifier = new ConsoleNotifier("%s");
|
||||
CounterAction action = new CounterAction(trigger, notifier, 500, 100);
|
||||
|
||||
|
||||
performTest(action, requestCount, 1000);
|
||||
|
||||
|
||||
ResultSet result = new ResultSet(1,testRangeLow,testRangeHigh+1, requestCount);
|
||||
assertEquals(result, action.getHits());
|
||||
}
|
||||
|
||||
|
||||
protected void performTest(MonitorAction action, long count, long interval)
|
||||
throws Exception
|
||||
{
|
||||
@ -363,17 +361,17 @@ public class AttrEventTriggerTest
|
||||
ContentExchange getExchange = new ContentExchange();
|
||||
getExchange.setURL(_requestUrl);
|
||||
getExchange.setMethod(HttpMethods.GET);
|
||||
|
||||
|
||||
_client.send(getExchange);
|
||||
int state = getExchange.waitForDone();
|
||||
|
||||
|
||||
String content = "";
|
||||
int responseStatus = getExchange.getResponseStatus();
|
||||
if (responseStatus == HttpStatus.OK_200)
|
||||
{
|
||||
content = getExchange.getResponseContent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
assertEquals(HttpStatus.OK_200,responseStatus);
|
||||
Thread.sleep(interval);
|
||||
}
|
||||
@ -382,12 +380,12 @@ public class AttrEventTriggerTest
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Thread.sleep(interval);
|
||||
|
||||
_monitor.removeActions(action);
|
||||
}
|
||||
|
||||
|
||||
protected void startClient(Realm realm)
|
||||
throws Exception
|
||||
{
|
||||
@ -397,7 +395,7 @@ public class AttrEventTriggerTest
|
||||
_client.setRealmResolver(new SimpleRealmResolver(realm));
|
||||
_client.start();
|
||||
}
|
||||
|
||||
|
||||
protected void stopClient()
|
||||
throws Exception
|
||||
{
|
||||
@ -412,7 +410,7 @@ public class AttrEventTriggerTest
|
||||
extends AbstractHandler
|
||||
{
|
||||
private RequestCounter _counter = new RequestCounter();
|
||||
|
||||
|
||||
public void handle(String target, Request baseRequest,
|
||||
HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
@ -421,40 +419,40 @@ public class AttrEventTriggerTest
|
||||
return;
|
||||
}
|
||||
_counter.increment();
|
||||
|
||||
|
||||
response.setContentType("text/plain");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.println("===TEST RESPONSE===");
|
||||
baseRequest.setHandled(true);
|
||||
}
|
||||
|
||||
|
||||
public RequestCounter getRequestCounter()
|
||||
{
|
||||
return _counter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected static class ResultSet extends TreeSet<Long>
|
||||
{
|
||||
{
|
||||
public ResultSet() {}
|
||||
|
||||
|
||||
public ResultSet(long value)
|
||||
{
|
||||
add(value);
|
||||
}
|
||||
|
||||
|
||||
public ResultSet(long start, long end)
|
||||
{
|
||||
addEntries(start, end);
|
||||
}
|
||||
|
||||
|
||||
public ResultSet(long start, long pause, long resume, long end)
|
||||
{
|
||||
addEntries(start, pause);
|
||||
addEntries(resume, end);
|
||||
}
|
||||
|
||||
|
||||
public void addEntries(long start, long stop)
|
||||
{
|
||||
if (start > 0 && stop > 0)
|
||||
@ -471,23 +469,23 @@ public class AttrEventTriggerTest
|
||||
return (this.size() == set.size()) && containsAll(set);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected static class CounterAction
|
||||
extends MonitorAction
|
||||
{
|
||||
private ResultSet _hits = new ResultSet();
|
||||
|
||||
|
||||
public CounterAction(EventTrigger trigger, EventNotifier notifier, long interval, long delay)
|
||||
{
|
||||
super(trigger, notifier, interval, delay);
|
||||
}
|
||||
|
||||
|
||||
public void execute(EventTrigger trigger, EventState<?> state, long timestamp)
|
||||
{
|
||||
if (trigger != null && state != null)
|
||||
{
|
||||
Collection<?> values = state.values();
|
||||
|
||||
|
||||
Iterator<?> it = values.iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
@ -500,7 +498,7 @@ public class AttrEventTriggerTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ResultSet getHits()
|
||||
{
|
||||
return _hits;
|
||||
|
@ -68,7 +68,6 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit4-version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -79,7 +79,7 @@ public class NoSqlSession extends AbstractSession
|
||||
__log.debug("NoSqlSession:access:active "+_active);
|
||||
if (_active.incrementAndGet()==1)
|
||||
{
|
||||
int period=_manager.getStalePeriod()*1000;
|
||||
long period=_manager.getStalePeriod()*1000L;
|
||||
if (period==0)
|
||||
refresh();
|
||||
else if (period>0)
|
||||
|
@ -49,13 +49,11 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-deploy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -67,7 +65,6 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -79,13 +76,11 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-jmx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -97,7 +92,6 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-websocket</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- can't use javax.servlet:servlet-api:2.5 it is not a bundle.
|
||||
@ -112,13 +106,11 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
<version>${osgi-version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||
<version>${osgi-services-version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -129,7 +121,6 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlets</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
@ -192,7 +183,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
|
@ -55,7 +55,7 @@ public class ProxyRule extends PatternRule
|
||||
private String _hostHeader;
|
||||
private String _proxyTo;
|
||||
|
||||
private int _connectorType = 2;
|
||||
private int _connectorType = HttpClient.CONNECTOR_SELECT_CHANNEL;
|
||||
private String _maxThreads;
|
||||
private String _maxConnections;
|
||||
private String _timeout;
|
||||
|
@ -1,5 +1,3 @@
|
||||
package org.eclipse.jetty.rewrite.handler;
|
||||
|
||||
//========================================================================
|
||||
//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
|
||||
//You may elect to redistribute this code under either of these licenses.
|
||||
//========================================================================
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
package org.eclipse.jetty.rewrite.handler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -35,6 +31,8 @@ import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ProxyRuleTest
|
||||
{
|
||||
private static ProxyRule _rule;
|
||||
|
@ -115,7 +115,6 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>1.8.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -18,20 +18,21 @@ import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
|
||||
import org.eclipse.jetty.http.HttpBuffers;
|
||||
import org.eclipse.jetty.http.HttpBuffersImpl;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.io.Buffers;
|
||||
import org.eclipse.jetty.io.Buffers.Type;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.EofException;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.statistic.CounterStatistic;
|
||||
@ -51,7 +52,7 @@ import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractConnector extends HttpBuffers implements Connector, Dumpable
|
||||
public abstract class AbstractConnector extends AggregateLifeCycle implements HttpBuffers, Connector, Dumpable
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(AbstractConnector.class);
|
||||
|
||||
@ -84,7 +85,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
protected int _lowResourceMaxIdleTime = -1;
|
||||
protected int _soLingerTime = -1;
|
||||
|
||||
private transient Thread[] _acceptorThread;
|
||||
private transient Thread[] _acceptorThreads;
|
||||
|
||||
private final AtomicLong _statsStartedAt = new AtomicLong(-1L);
|
||||
|
||||
@ -95,11 +96,14 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
/** duration of a connection */
|
||||
private final SampleStatistic _connectionDurationStats = new SampleStatistic();
|
||||
|
||||
protected final HttpBuffersImpl _buffers = new HttpBuffersImpl();
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
*/
|
||||
public AbstractConnector()
|
||||
{
|
||||
addBean(_buffers);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -123,9 +127,16 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Set the ThreadPool.
|
||||
* The threadpool passed is added via {@link #addBean(Object)} so that
|
||||
* it's lifecycle may be managed as a {@link AggregateLifeCycle}.
|
||||
* @param threadPool the threadPool to set
|
||||
*/
|
||||
public void setThreadPool(ThreadPool pool)
|
||||
{
|
||||
removeBean(_threadPool);
|
||||
_threadPool = pool;
|
||||
addBean(_threadPool);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -299,20 +310,22 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
// open listener port
|
||||
open();
|
||||
|
||||
super.doStart();
|
||||
|
||||
if (_threadPool == null)
|
||||
{
|
||||
_threadPool = _server.getThreadPool();
|
||||
if (_threadPool != _server.getThreadPool() && (_threadPool instanceof LifeCycle))
|
||||
((LifeCycle)_threadPool).start();
|
||||
addBean(_threadPool,false);
|
||||
}
|
||||
|
||||
super.doStart();
|
||||
|
||||
// Start selector thread
|
||||
synchronized (this)
|
||||
{
|
||||
_acceptorThread = new Thread[getAcceptors()];
|
||||
_acceptorThreads = new Thread[getAcceptors()];
|
||||
|
||||
for (int i = 0; i < _acceptorThread.length; i++)
|
||||
_threadPool.dispatch(new Acceptor(i));
|
||||
for (int i = 0; i < _acceptorThreads.length; i++)
|
||||
if (!_threadPool.dispatch(new Acceptor(i)))
|
||||
throw new IllegalStateException("!accepting");
|
||||
if (_threadPool.isLowOnThreads())
|
||||
LOG.warn("insufficient threads configured for {}",this);
|
||||
}
|
||||
@ -333,22 +346,18 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
LOG.warn(e);
|
||||
}
|
||||
|
||||
if (_threadPool != _server.getThreadPool() && _threadPool instanceof LifeCycle)
|
||||
((LifeCycle)_threadPool).stop();
|
||||
|
||||
super.doStop();
|
||||
|
||||
Thread[] acceptors = null;
|
||||
Thread[] acceptors;
|
||||
synchronized (this)
|
||||
{
|
||||
acceptors = _acceptorThread;
|
||||
_acceptorThread = null;
|
||||
acceptors = _acceptorThreads;
|
||||
_acceptorThreads = null;
|
||||
}
|
||||
if (acceptors != null)
|
||||
{
|
||||
for (int i = 0; i < acceptors.length; i++)
|
||||
for (Thread thread : acceptors)
|
||||
{
|
||||
Thread thread = acceptors[i];
|
||||
if (thread != null)
|
||||
thread.interrupt();
|
||||
}
|
||||
@ -361,12 +370,12 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
Thread[] threads;
|
||||
synchronized(this)
|
||||
{
|
||||
threads= _acceptorThread;
|
||||
threads=_acceptorThreads;
|
||||
}
|
||||
if (threads != null)
|
||||
for (int i = 0; i < threads.length; i++)
|
||||
if (threads[i] != null)
|
||||
threads[i].join();
|
||||
for (Thread thread : threads)
|
||||
if (thread != null)
|
||||
thread.join();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -786,17 +795,105 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
_forwardedSslSessionIdHeader = forwardedSslSessionId;
|
||||
}
|
||||
|
||||
public int getRequestBufferSize()
|
||||
{
|
||||
return _buffers.getRequestBufferSize();
|
||||
}
|
||||
|
||||
public void setRequestBufferSize(int requestBufferSize)
|
||||
{
|
||||
_buffers.setRequestBufferSize(requestBufferSize);
|
||||
}
|
||||
|
||||
public int getRequestHeaderSize()
|
||||
{
|
||||
return _buffers.getRequestHeaderSize();
|
||||
}
|
||||
|
||||
public void setRequestHeaderSize(int requestHeaderSize)
|
||||
{
|
||||
_buffers.setRequestHeaderSize(requestHeaderSize);
|
||||
}
|
||||
|
||||
public int getResponseBufferSize()
|
||||
{
|
||||
return _buffers.getResponseBufferSize();
|
||||
}
|
||||
|
||||
public void setResponseBufferSize(int responseBufferSize)
|
||||
{
|
||||
_buffers.setResponseBufferSize(responseBufferSize);
|
||||
}
|
||||
|
||||
public int getResponseHeaderSize()
|
||||
{
|
||||
return _buffers.getResponseHeaderSize();
|
||||
}
|
||||
|
||||
public void setResponseHeaderSize(int responseHeaderSize)
|
||||
{
|
||||
_buffers.setResponseHeaderSize(responseHeaderSize);
|
||||
}
|
||||
|
||||
public Type getRequestBufferType()
|
||||
{
|
||||
return _buffers.getRequestBufferType();
|
||||
}
|
||||
|
||||
public Type getRequestHeaderType()
|
||||
{
|
||||
return _buffers.getRequestHeaderType();
|
||||
}
|
||||
|
||||
public Type getResponseBufferType()
|
||||
{
|
||||
return _buffers.getResponseBufferType();
|
||||
}
|
||||
|
||||
public Type getResponseHeaderType()
|
||||
{
|
||||
return _buffers.getResponseHeaderType();
|
||||
}
|
||||
|
||||
public void setRequestBuffers(Buffers requestBuffers)
|
||||
{
|
||||
_buffers.setRequestBuffers(requestBuffers);
|
||||
}
|
||||
|
||||
public void setResponseBuffers(Buffers responseBuffers)
|
||||
{
|
||||
_buffers.setResponseBuffers(responseBuffers);
|
||||
}
|
||||
|
||||
public Buffers getRequestBuffers()
|
||||
{
|
||||
return _buffers.getRequestBuffers();
|
||||
}
|
||||
|
||||
public Buffers getResponseBuffers()
|
||||
{
|
||||
return _buffers.getResponseBuffers();
|
||||
}
|
||||
|
||||
public void setMaxBuffers(int maxBuffers)
|
||||
{
|
||||
_buffers.setMaxBuffers(maxBuffers);
|
||||
}
|
||||
|
||||
public int getMaxBuffers()
|
||||
{
|
||||
return _buffers.getMaxBuffers();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String name = this.getClass().getName();
|
||||
int dot = name.lastIndexOf('.');
|
||||
if (dot > 0)
|
||||
name = name.substring(dot + 1);
|
||||
|
||||
return name + "@" + (getHost() == null?"0.0.0.0":getHost()) + ":" + (getLocalPort() <= 0?getPort():getLocalPort()) + " "
|
||||
+ AbstractLifeCycle.getState(this);
|
||||
return String.format("%s@%s:%d %s",
|
||||
getClass().getSimpleName(),
|
||||
getHost()==null?"0.0.0.0":getHost(),
|
||||
getLocalPort()<=0?getPort():getLocalPort(),
|
||||
AbstractLifeCycle.getState(this));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -818,11 +915,11 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
String name;
|
||||
synchronized (AbstractConnector.this)
|
||||
{
|
||||
if (_acceptorThread == null)
|
||||
if (_acceptorThreads == null)
|
||||
return;
|
||||
|
||||
_acceptorThread[_acceptor] = current;
|
||||
name = _acceptorThread[_acceptor].getName();
|
||||
_acceptorThreads[_acceptor] = current;
|
||||
name = _acceptorThreads[_acceptor].getName();
|
||||
current.setName(name + " Acceptor" + _acceptor + " " + AbstractConnector.this);
|
||||
}
|
||||
int old_priority = current.getPriority();
|
||||
@ -862,8 +959,8 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
|
||||
synchronized (AbstractConnector.this)
|
||||
{
|
||||
if (_acceptorThread != null)
|
||||
_acceptorThread[_acceptor] = null;
|
||||
if (_acceptorThreads != null)
|
||||
_acceptorThreads[_acceptor] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1118,17 +1215,4 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
||||
oldValue = valueHolder.get();
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String dump()
|
||||
{
|
||||
return AggregateLifeCycle.dump(this);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
out.append(String.valueOf(this)).append("\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -467,7 +467,6 @@ public class Response implements HttpServletResponse
|
||||
}
|
||||
}
|
||||
|
||||
location=encodeRedirectURL(location);
|
||||
resetBuffer();
|
||||
setHeader(HttpHeaders.LOCATION,location);
|
||||
setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
|
||||
|
@ -85,7 +85,10 @@ import org.eclipse.jetty.util.resource.Resource;
|
||||
* <p>
|
||||
* If the context init parameter "org.eclipse.jetty.server.context.ManagedAttributes" is set to a comma separated list of names, then they are treated as
|
||||
* context attribute names, which if set as attributes are passed to the servers Container so that they may be managed with JMX.
|
||||
*
|
||||
* <p>
|
||||
* The maximum size of a form that can be processed by this context is controlled by the system properties org.eclipse.jetty.server.Request.maxFormKeys
|
||||
* and org.eclipse.jetty.server.Request.maxFormContentSize. These can also be configured with {@link #setMaxFormContentSize(int)} and {@link #setMaxFormKeys(int)}
|
||||
*
|
||||
* @org.apache.xbean.XBean description="Creates a basic HTTP context"
|
||||
*/
|
||||
public class ContextHandler extends ScopedHandler implements Attributes, Server.Graceful
|
||||
|
@ -50,7 +50,7 @@ public class DefaultHandler extends AbstractHandler
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(DefaultHandler.class);
|
||||
|
||||
final long _faviconModified=(System.currentTimeMillis()/1000)*1000;
|
||||
final long _faviconModified=(System.currentTimeMillis()/1000)*1000L;
|
||||
byte[] _favicon;
|
||||
boolean _serveIcon=true;
|
||||
boolean _showContexts=true;
|
||||
|
@ -4,35 +4,31 @@
|
||||
// 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
|
||||
// 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.
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.eclipse.jetty.server.nio;
|
||||
|
||||
import org.eclipse.jetty.io.Buffers.Type;
|
||||
import org.eclipse.jetty.server.AbstractConnector;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractNIOConnector extends AbstractConnector implements NIOConnector
|
||||
{
|
||||
public AbstractNIOConnector()
|
||||
{
|
||||
setRequestBufferType(Type.DIRECT);
|
||||
setRequestHeaderType(Type.INDIRECT);
|
||||
setResponseBufferType(Type.DIRECT);
|
||||
setResponseHeaderType(Type.INDIRECT);
|
||||
_buffers.setRequestBufferType(Type.DIRECT);
|
||||
_buffers.setRequestHeaderType(Type.INDIRECT);
|
||||
_buffers.setResponseBufferType(Type.DIRECT);
|
||||
_buffers.setResponseHeaderType(Type.INDIRECT);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
public boolean getUseDirectBuffers()
|
||||
{
|
||||
@ -46,8 +42,7 @@ public abstract class AbstractNIOConnector extends AbstractConnector implements
|
||||
*/
|
||||
public void setUseDirectBuffers(boolean direct)
|
||||
{
|
||||
setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT);
|
||||
setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT);
|
||||
_buffers.setRequestBufferType(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.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jetty.continuation.Continuation;
|
||||
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.server.AsyncHttpConnection;
|
||||
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;
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
@ -65,8 +61,6 @@ import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
*/
|
||||
public class SelectChannelConnector extends AbstractNIOConnector
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(SelectChannelConnector.class);
|
||||
|
||||
protected ServerSocketChannel _acceptChannel;
|
||||
private int _lowResourcesConnections;
|
||||
private int _lowResourcesMaxIdleTime;
|
||||
@ -82,6 +76,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
public SelectChannelConnector()
|
||||
{
|
||||
_manager.setMaxIdleTime(getMaxIdleTime());
|
||||
addBean(_manager,true);
|
||||
setAcceptors(Math.max(1,(Runtime.getRuntime().availableProcessors()+3)/4));
|
||||
}
|
||||
|
||||
@ -111,7 +106,11 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
synchronized(this)
|
||||
{
|
||||
if (_acceptChannel != null)
|
||||
_acceptChannel.close();
|
||||
{
|
||||
removeBean(_acceptChannel);
|
||||
if (_acceptChannel.isOpen())
|
||||
_acceptChannel.close();
|
||||
}
|
||||
_acceptChannel = null;
|
||||
_localPort=-2;
|
||||
}
|
||||
@ -121,7 +120,6 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
@Override
|
||||
public void customize(EndPoint endpoint, Request request) throws IOException
|
||||
{
|
||||
AsyncEndPoint aEndp = ((AsyncEndPoint)endpoint);
|
||||
request.setTimeStamp(System.currentTimeMillis());
|
||||
endpoint.setMaxIdleTime(_maxIdleTime);
|
||||
super.customize(endpoint, request);
|
||||
@ -178,6 +176,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
if (_localPort<=0)
|
||||
throw new IOException("Server channel not bound");
|
||||
|
||||
addBean(_acceptChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,31 +249,6 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
_manager.setLowResourcesMaxIdleTime(getLowResourcesMaxIdleTime());
|
||||
|
||||
super.doStart();
|
||||
_manager.start();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see org.eclipse.jetty.server.server.AbstractConnector#doStop()
|
||||
*/
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
synchronized(this)
|
||||
{
|
||||
if(_manager.isRunning())
|
||||
{
|
||||
try
|
||||
{
|
||||
_manager.stop();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.warn(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.doStop();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -297,20 +271,6 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
return new AsyncHttpConnection(SelectChannelConnector.this,endpoint,getServer());
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void dump(Appendable out, String indent) throws IOException
|
||||
{
|
||||
super.dump(out, indent);
|
||||
ServerSocketChannel channel;
|
||||
synchronized (this)
|
||||
{
|
||||
channel=_acceptChannel;
|
||||
}
|
||||
if (channel==null)
|
||||
AggregateLifeCycle.dump(out,indent,Arrays.asList(null,"CLOSED",_manager));
|
||||
else
|
||||
AggregateLifeCycle.dump(out,indent,Arrays.asList(channel,channel.isOpen()?"OPEN":"CLOSED",_manager));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -357,5 +317,4 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
||||
return SelectChannelConnector.this.newEndPoint(channel,selectSet,sKey);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
||||
_accessed=_created;
|
||||
_lastAccessed=_created;
|
||||
_requests=1;
|
||||
_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000:-1;
|
||||
_maxIdleMs=_manager._dftMaxIdleSecs>0?_manager._dftMaxIdleSecs*1000L:-1;
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("new session & id "+_nodeId+" "+_clusterId);
|
||||
}
|
||||
@ -430,7 +430,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
|
||||
/* ------------------------------------------------------------- */
|
||||
public void setMaxInactiveInterval(int secs)
|
||||
{
|
||||
_maxIdleMs=(long)secs*1000;
|
||||
_maxIdleMs=(long)secs*1000L;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -54,9 +54,9 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
private Timer _timer;
|
||||
private boolean _timerStop=false;
|
||||
private TimerTask _task;
|
||||
int _scavengePeriodMs=30000;
|
||||
int _savePeriodMs=0; //don't do period saves by default
|
||||
int _idleSavePeriodMs = 0; // don't idle save sessions by default.
|
||||
long _scavengePeriodMs=30000;
|
||||
long _savePeriodMs=0; //don't do period saves by default
|
||||
long _idleSavePeriodMs = 0; // don't idle save sessions by default.
|
||||
private TimerTask _saveTask;
|
||||
File _storeDir;
|
||||
private boolean _lazyLoad=false;
|
||||
@ -135,7 +135,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
*/
|
||||
public int getScavengePeriod()
|
||||
{
|
||||
return _scavengePeriodMs/1000;
|
||||
return (int)(_scavengePeriodMs/1000);
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +161,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
if (_idleSavePeriodMs <= 0)
|
||||
return 0;
|
||||
|
||||
return _idleSavePeriodMs / 1000;
|
||||
return (int)(_idleSavePeriodMs / 1000);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -175,7 +175,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
*/
|
||||
public void setIdleSavePeriod(int seconds)
|
||||
{
|
||||
_idleSavePeriodMs = seconds * 1000;
|
||||
_idleSavePeriodMs = seconds * 1000L;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -183,7 +183,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
public void setMaxInactiveInterval(int seconds)
|
||||
{
|
||||
super.setMaxInactiveInterval(seconds);
|
||||
if (_dftMaxIdleSecs>0&&_scavengePeriodMs>_dftMaxIdleSecs*1000)
|
||||
if (_dftMaxIdleSecs>0&&_scavengePeriodMs>_dftMaxIdleSecs*1000L)
|
||||
setScavengePeriod((_dftMaxIdleSecs+9)/10);
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
*/
|
||||
public void setSavePeriod (int seconds)
|
||||
{
|
||||
int period = (seconds * 1000);
|
||||
long period = (seconds * 1000L);
|
||||
if (period < 0)
|
||||
period=0;
|
||||
_savePeriodMs=period;
|
||||
@ -236,7 +236,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
if (_savePeriodMs<=0)
|
||||
return 0;
|
||||
|
||||
return _savePeriodMs/1000;
|
||||
return (int)(_savePeriodMs/1000);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -248,8 +248,8 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
if (seconds==0)
|
||||
seconds=60;
|
||||
|
||||
int old_period=_scavengePeriodMs;
|
||||
int period=seconds*1000;
|
||||
long old_period=_scavengePeriodMs;
|
||||
long period=seconds*1000L;
|
||||
if (period>60000)
|
||||
period=60000;
|
||||
if (period<1000)
|
||||
@ -298,7 +298,7 @@ public class HashSessionManager extends AbstractSessionManager
|
||||
for (Iterator<HashedSession> i=_sessions.values().iterator(); i.hasNext();)
|
||||
{
|
||||
HashedSession session=i.next();
|
||||
long idleTime=session.getMaxInactiveInterval()*1000;
|
||||
long idleTime=session.getMaxInactiveInterval()*1000L;
|
||||
if (idleTime>0&&session.getAccessed()+idleTime<now)
|
||||
{
|
||||
// Found a stale session, add it to the list
|
||||
|
@ -60,7 +60,7 @@ public class HashedSession extends AbstractSession
|
||||
public void setMaxInactiveInterval(int secs)
|
||||
{
|
||||
super.setMaxInactiveInterval(secs);
|
||||
if (getMaxInactiveInterval()>0&&(getMaxInactiveInterval()*1000/10)<_hashSessionManager._scavengePeriodMs)
|
||||
if (getMaxInactiveInterval()>0&&(getMaxInactiveInterval()*1000L/10)<_hashSessionManager._scavengePeriodMs)
|
||||
_hashSessionManager.setScavengePeriod((secs+9)/10);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||
protected Timer _timer; //scavenge timer
|
||||
protected TimerTask _task; //scavenge task
|
||||
protected long _lastScavengeTime;
|
||||
protected long _scavengeIntervalMs = 1000 * 60 * 10; //10mins
|
||||
protected long _scavengeIntervalMs = 1000L * 60 * 10; //10mins
|
||||
protected String _blobType; //if not set, is deduced from the type of the database at runtime
|
||||
|
||||
protected String _createSessionIdTable;
|
||||
@ -245,7 +245,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
|
||||
sec=60;
|
||||
|
||||
long old_period=_scavengeIntervalMs;
|
||||
long period=sec*1000;
|
||||
long period=sec*1000L;
|
||||
|
||||
_scavengeIntervalMs=period;
|
||||
|
||||
|
@ -279,11 +279,11 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||
super(JDBCSessionManager.this,request);
|
||||
_data = new SessionData(getClusterId(),_jdbcAttributes);
|
||||
if (_dftMaxIdleSecs>0)
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000);
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||
_data.setCanonicalContext(canonicalize(_context.getContextPath()));
|
||||
_data.setVirtualHost(getVirtualHost(_context));
|
||||
int maxInterval=getMaxInactiveInterval();
|
||||
_data.setExpiryTime(maxInterval <= 0 ? 0 : (System.currentTimeMillis() + maxInterval*1000));
|
||||
_data.setExpiryTime(maxInterval <= 0 ? 0 : (System.currentTimeMillis() + maxInterval*1000L));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -295,7 +295,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||
super(JDBCSessionManager.this,data.getCreated(), accessed, data.getId());
|
||||
_data=data;
|
||||
if (_dftMaxIdleSecs>0)
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000);
|
||||
_data.setMaxIdleMs(_dftMaxIdleSecs*1000L);
|
||||
_jdbcAttributes.putAll(_data.getAttributeMap());
|
||||
_data.setAttributeMap(_jdbcAttributes);
|
||||
}
|
||||
@ -335,7 +335,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||
_data.setAccessed(time);
|
||||
|
||||
int maxInterval=getMaxInactiveInterval();
|
||||
_data.setExpiryTime(maxInterval <= 0 ? 0 : (time + maxInterval*1000));
|
||||
_data.setExpiryTime(maxInterval <= 0 ? 0 : (time + maxInterval*1000L));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -359,7 +359,7 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||
updateSession(_data);
|
||||
didActivate();
|
||||
}
|
||||
else if ((_data._accessed - _data._lastSaved) >= (getSaveInterval() * 1000))
|
||||
else if ((_data._accessed - _data._lastSaved) >= (getSaveInterval() * 1000L))
|
||||
{
|
||||
updateSessionAccessTime(_data);
|
||||
}
|
||||
@ -508,23 +508,23 @@ public class JDBCSessionManager extends AbstractSessionManager
|
||||
LOG.debug("getSession("+idInCluster+"): not in session map,"+
|
||||
" now="+now+
|
||||
" lastSaved="+(session==null?0:session._data._lastSaved)+
|
||||
" interval="+(_saveIntervalSec * 1000));
|
||||
" interval="+(_saveIntervalSec * 1000L));
|
||||
else
|
||||
LOG.debug("getSession("+idInCluster+"): in session map, "+
|
||||
" now="+now+
|
||||
" lastSaved="+(session==null?0:session._data._lastSaved)+
|
||||
" interval="+(_saveIntervalSec * 1000)+
|
||||
" interval="+(_saveIntervalSec * 1000L)+
|
||||
" lastNode="+session._data.getLastNode()+
|
||||
" thisNode="+getSessionIdManager().getWorkerName()+
|
||||
" difference="+(now - session._data._lastSaved));
|
||||
}
|
||||
|
||||
if (session==null || ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000)))
|
||||
if (session==null || ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000L)))
|
||||
{
|
||||
LOG.debug("getSession("+idInCluster+"): no session in session map or stale session. Reloading session data from db.");
|
||||
data = loadSession(idInCluster, canonicalize(_context.getContextPath()), getVirtualHost(_context));
|
||||
}
|
||||
else if ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000))
|
||||
else if ((now - session._data._lastSaved) >= (_saveIntervalSec * 1000L))
|
||||
{
|
||||
LOG.debug("getSession("+idInCluster+"): stale session. Reloading session data from db.");
|
||||
data = loadSession(idInCluster, canonicalize(_context.getContextPath()), getVirtualHost(_context));
|
||||
|
@ -33,6 +33,7 @@ import org.eclipse.jetty.io.nio.AsyncConnection;
|
||||
import org.eclipse.jetty.io.nio.SslConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -54,9 +55,15 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Construct with explicit SslContextFactory.
|
||||
* The SslContextFactory passed is added via {@link #addBean(Object)} so that
|
||||
* it's lifecycle may be managed with {@link AggregateLifeCycle}.
|
||||
* @param sslContextFactory
|
||||
*/
|
||||
public SslSelectChannelConnector(SslContextFactory sslContextFactory)
|
||||
{
|
||||
_sslContextFactory = sslContextFactory;
|
||||
addBean(_sslContextFactory);
|
||||
setUseDirectBuffers(false);
|
||||
setSoLingerTime(30000);
|
||||
}
|
||||
@ -597,7 +604,6 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
_sslContextFactory.checkKeyStore();
|
||||
|
||||
_sslContextFactory.start();
|
||||
|
||||
SSLEngine sslEngine = _sslContextFactory.newSslEngine();
|
||||
@ -627,7 +633,6 @@ public class SslSelectChannelConnector extends SelectChannelConnector implements
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
_sslContextFactory.stop();
|
||||
_sslBuffers=null;
|
||||
super.doStop();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class ELContextCleaner implements ServletContextListener
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
LOG.warn("Cannot purge classes from javax.el.BeanELResolver", e);
|
||||
LOG.info("Not cleaning cached beans: no such field javax.el.BeanELResolver.properties");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,13 @@ import org.eclipse.jetty.util.TypeUtil;
|
||||
* <p>
|
||||
* If the init parameter "delete" is set to "true", any files created will be deleted when the
|
||||
* current request returns.
|
||||
* <p>
|
||||
* The init parameter maxFormKeys sets the maximum number of keys that may be present in a
|
||||
* form (default set by system property org.eclipse.jetty.server.Request.maxFormKeys or 1000) to protect
|
||||
* against DOS attacks by bad hash keys.
|
||||
* <p>
|
||||
* The init parameter deleteFiles controls if uploaded files are automatically deleted after the request
|
||||
* completes.
|
||||
*
|
||||
* Use init parameter "maxFileSize" to set the max size file that can be uploaded.
|
||||
*
|
||||
@ -77,6 +84,7 @@ public class MultiPartFilter implements Filter
|
||||
private int _fileOutputBuffer = 0;
|
||||
private long _maxFileSize = -1L;
|
||||
private long _maxRequestSize = -1L;
|
||||
private int _maxFormKeys = Integer.getInteger("org.eclipse.jetty.server.Request.maxFormKeys",1000).intValue();
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/**
|
||||
@ -97,6 +105,9 @@ public class MultiPartFilter implements Filter
|
||||
_maxRequestSize = Long.parseLong(maxRequestSize.trim());
|
||||
|
||||
_context=filterConfig.getServletContext();
|
||||
String mfks = filterConfig.getInitParameter("maxFormKeys");
|
||||
if (mfks!=null)
|
||||
_maxFormKeys=Integer.parseInt(mfks);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
@ -138,8 +149,10 @@ public class MultiPartFilter implements Filter
|
||||
Collection<Part> parts = mpis.getParts();
|
||||
if (parts != null)
|
||||
{
|
||||
for (Part p:parts)
|
||||
Iterator<Part> itor = parts.iterator();
|
||||
while (itor.hasNext() && params.size() < _maxFormKeys)
|
||||
{
|
||||
Part p = itor.next();
|
||||
MultiPartInputStream.MultiPart mp = (MultiPartInputStream.MultiPart)p;
|
||||
if (mp.getFile() != null)
|
||||
{
|
||||
|
@ -12,92 +12,224 @@ import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/**
|
||||
* An AggregateLifeCycle is an AbstractLifeCycle with a collection of dependent beans.
|
||||
* An AggregateLifeCycle is an {@link LifeCycle} implementation for a collection of contained beans.
|
||||
* <p>
|
||||
* Beans can be added the AggregateLifeCycle either as managed beans or as unmanaged beans. A managed bean is started, stopped and destroyed with the aggregate.
|
||||
* An umanaged bean is associated with the aggregate for the purposes of {@link #dump()}, but it's lifecycle must be managed externally.
|
||||
* <p>
|
||||
* When a bean is added, if it is a {@link LifeCycle} and it is already started, then it is assumed to be an unmanaged bean.
|
||||
* Otherwise the methods {@link #addBean(LifeCycle, boolean)}, {@link #manage(LifeCycle)} and {@link #unmanage(LifeCycle)} can be used to
|
||||
* explicitly control the life cycle relationship.
|
||||
* <p>
|
||||
* If adding a bean that is shared between multiple {@link AggregateLifeCycle} instances, then it should be started before being added, so it is unmanged, or
|
||||
* the API must be used to explicitly set it as unmanaged.
|
||||
* <p>
|
||||
* Dependent beans are started and stopped with the {@link LifeCycle} and if they are destroyed if they are also {@link Destroyable}.
|
||||
*
|
||||
*/
|
||||
public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable, Dumpable
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(AggregateLifeCycle.class);
|
||||
private final List<Object> _dependentBeans=new CopyOnWriteArrayList<Object>();
|
||||
private final List<Bean> _beans=new CopyOnWriteArrayList<Bean>();
|
||||
private boolean _started=false;
|
||||
|
||||
public void destroy()
|
||||
private class Bean
|
||||
{
|
||||
for (Object o : _dependentBeans)
|
||||
Bean(Object b)
|
||||
{
|
||||
if (o instanceof Destroyable)
|
||||
{
|
||||
((Destroyable)o).destroy();
|
||||
}
|
||||
_bean=b;
|
||||
}
|
||||
_dependentBeans.clear();
|
||||
final Object _bean;
|
||||
volatile boolean _managed=true;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Start the managed lifecycle beans in the order they were added.
|
||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
|
||||
*/
|
||||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
for (Object o:_dependentBeans)
|
||||
for (Bean b:_beans)
|
||||
{
|
||||
if (o instanceof LifeCycle)
|
||||
((LifeCycle)o).start();
|
||||
if (b._managed && b._bean instanceof LifeCycle)
|
||||
{
|
||||
LifeCycle l=(LifeCycle)b._bean;
|
||||
if (!l.isRunning())
|
||||
l.start();
|
||||
}
|
||||
}
|
||||
// indicate that we are started, so that addBean will start other beans added.
|
||||
_started=true;
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Stop the joined lifecycle beans in the reverse order they were added.
|
||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
|
||||
*/
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
_started=false;
|
||||
super.doStop();
|
||||
List<Object> reverse = new ArrayList<Object>(_dependentBeans);
|
||||
List<Bean> reverse = new ArrayList<Bean>(_beans);
|
||||
Collections.reverse(reverse);
|
||||
for (Object o:reverse)
|
||||
for (Bean b:reverse)
|
||||
{
|
||||
if (o instanceof LifeCycle)
|
||||
((LifeCycle)o).stop();
|
||||
if (b._managed && b._bean instanceof LifeCycle)
|
||||
{
|
||||
LifeCycle l=(LifeCycle)b._bean;
|
||||
if (l.isRunning())
|
||||
l.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Destroy the joined Destroyable beans in the reverse order they were added.
|
||||
* @see org.eclipse.jetty.util.component.Destroyable#destroy()
|
||||
*/
|
||||
public void destroy()
|
||||
{
|
||||
List<Bean> reverse = new ArrayList<Bean>(_beans);
|
||||
Collections.reverse(reverse);
|
||||
for (Bean b:reverse)
|
||||
{
|
||||
if (b._bean instanceof Destroyable && b._managed)
|
||||
{
|
||||
Destroyable d=(Destroyable)b._bean;
|
||||
d.destroy();
|
||||
}
|
||||
}
|
||||
_beans.clear();
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Is the bean contained in the aggregate.
|
||||
* @param bean
|
||||
* @return True if the aggregate contains the bean
|
||||
*/
|
||||
public boolean contains(Object bean)
|
||||
{
|
||||
for (Bean b:_beans)
|
||||
if (b._bean==bean)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Is the bean joined to the aggregate.
|
||||
* @param bean
|
||||
* @return True if the aggregate contains the bean and it is joined
|
||||
*/
|
||||
public boolean isManaged(Object bean)
|
||||
{
|
||||
for (Bean b:_beans)
|
||||
if (b._bean==bean)
|
||||
return b._managed;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Add an associated bean.
|
||||
* The bean will be added to this LifeCycle and if it is also a
|
||||
* {@link LifeCycle} instance, it will be
|
||||
* started/stopped. Any beans that are also
|
||||
* {@link Destroyable}, will be destroyed with the server.
|
||||
* If the bean is a {@link LifeCycle}, then it will be managed if it is not
|
||||
* already started and umanaged if it is already started. The {@link #addBean(Object, boolean)}
|
||||
* method should be used if this is not correct, or the {@link #manage(Object)} and {@link #unmanage(Object)}
|
||||
* methods may be used after an add to change the status.
|
||||
* @param o the bean object to add
|
||||
* @return true if the bean was added or false if it has already been added.
|
||||
*/
|
||||
public boolean addBean(Object o)
|
||||
{
|
||||
if (o == null)
|
||||
// beans are joined unless they are started lifecycles
|
||||
return addBean(o,!((o instanceof LifeCycle)&&((LifeCycle)o).isStarted()));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Add an associated lifecycle.
|
||||
* @param o The lifecycle to add
|
||||
* @param managed True if the LifeCycle is to be joined, otherwise it will be disjoint.
|
||||
* @return
|
||||
*/
|
||||
public boolean addBean(Object o, boolean managed)
|
||||
{
|
||||
if (contains(o))
|
||||
return false;
|
||||
boolean added=false;
|
||||
if (!_dependentBeans.contains(o))
|
||||
{
|
||||
_dependentBeans.add(o);
|
||||
added=true;
|
||||
}
|
||||
|
||||
try
|
||||
Bean b = new Bean(o);
|
||||
b._managed=managed;
|
||||
_beans.add(b);
|
||||
|
||||
if (o instanceof LifeCycle)
|
||||
{
|
||||
if (isStarted() && o instanceof LifeCycle)
|
||||
((LifeCycle)o).start();
|
||||
LifeCycle l=(LifeCycle)o;
|
||||
|
||||
// Start the bean if we are started
|
||||
if (managed && _started)
|
||||
{
|
||||
try
|
||||
{
|
||||
l.start();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new RuntimeException (e);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Manage a bean by this aggregate, so that it is started/stopped/destroyed with the
|
||||
* aggregate lifecycle.
|
||||
* @param bean The bean to manage (must already have been added).
|
||||
*/
|
||||
public void manage(Object bean)
|
||||
{
|
||||
for (Bean b :_beans)
|
||||
{
|
||||
throw new RuntimeException (e);
|
||||
if (b._bean==bean)
|
||||
{
|
||||
b._managed=true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return added;
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Unmanage a bean by this aggregate, so that it is not started/stopped/destroyed with the
|
||||
* aggregate lifecycle.
|
||||
* @param bean The bean to manage (must already have been added).
|
||||
*/
|
||||
public void unmanage(Object bean)
|
||||
{
|
||||
for (Bean b :_beans)
|
||||
{
|
||||
if (b._bean==bean)
|
||||
{
|
||||
b._managed=false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Get dependent beans
|
||||
* @return List of beans.
|
||||
*/
|
||||
public Collection<Object> getBeans()
|
||||
{
|
||||
return _dependentBeans;
|
||||
return getBeans(Object.class);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -109,19 +241,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
||||
public <T> List<T> getBeans(Class<T> clazz)
|
||||
{
|
||||
ArrayList<T> beans = new ArrayList<T>();
|
||||
Iterator<?> iter = _dependentBeans.iterator();
|
||||
while (iter.hasNext())
|
||||
for (Bean b:_beans)
|
||||
{
|
||||
Object o = iter.next();
|
||||
if (clazz.isInstance(o))
|
||||
beans.add((T)o);
|
||||
if (clazz.isInstance(b._bean))
|
||||
beans.add((T)(b._bean));
|
||||
}
|
||||
return beans;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Get dependent bean of a specific class.
|
||||
/** Get dependent beans of a specific class.
|
||||
* If more than one bean of the type exist, the first is returned.
|
||||
* @see #addBean(Object)
|
||||
* @param clazz
|
||||
@ -129,23 +259,13 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
||||
*/
|
||||
public <T> T getBean(Class<T> clazz)
|
||||
{
|
||||
Iterator<?> iter = _dependentBeans.iterator();
|
||||
T t=null;
|
||||
int count=0;
|
||||
while (iter.hasNext())
|
||||
for (Bean b:_beans)
|
||||
{
|
||||
Object o = iter.next();
|
||||
if (clazz.isInstance(o))
|
||||
{
|
||||
count++;
|
||||
if (t==null)
|
||||
t=(T)o;
|
||||
}
|
||||
if (clazz.isInstance(b._bean))
|
||||
return (T)b._bean;
|
||||
}
|
||||
if (count>1 && LOG.isDebugEnabled())
|
||||
LOG.debug("getBean({}) 1 of {}",clazz.getName(),count);
|
||||
|
||||
return t;
|
||||
return null;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -154,7 +274,7 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
||||
*/
|
||||
public void removeBeans ()
|
||||
{
|
||||
_dependentBeans.clear();
|
||||
_beans.clear();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -163,9 +283,17 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
||||
*/
|
||||
public boolean removeBean (Object o)
|
||||
{
|
||||
if (o == null)
|
||||
return false;
|
||||
return _dependentBeans.remove(o);
|
||||
Iterator<Bean> i = _beans.iterator();
|
||||
while(i.hasNext())
|
||||
{
|
||||
Bean b=i.next();
|
||||
if (b._bean==o)
|
||||
{
|
||||
_beans.remove(b);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -218,7 +346,32 @@ public class AggregateLifeCycle extends AbstractLifeCycle implements Destroyable
|
||||
public void dump(Appendable out,String indent) throws IOException
|
||||
{
|
||||
dumpThis(out);
|
||||
dump(out,indent,_dependentBeans);
|
||||
int size=_beans.size();
|
||||
if (size==0)
|
||||
return;
|
||||
int i=0;
|
||||
for (Bean b : _beans)
|
||||
{
|
||||
i++;
|
||||
|
||||
if (b._managed)
|
||||
{
|
||||
out.append(indent).append(" +- ");
|
||||
if (b._bean instanceof Dumpable)
|
||||
((Dumpable)b._bean).dump(out,indent+(i==size?" ":" | "));
|
||||
else
|
||||
out.append(String.valueOf(b._bean)).append("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(indent).append(" +~ ");
|
||||
out.append(String.valueOf(b._bean)).append("\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (i!=size)
|
||||
out.append(indent).append(" |\n");
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -38,7 +38,6 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.net.ssl.CertPathTrustManagerParameters;
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
@ -73,7 +72,7 @@ import org.eclipse.jetty.util.security.Password;
|
||||
public class SslContextFactory extends AbstractLifeCycle
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(SslContextFactory.class);
|
||||
|
||||
|
||||
public static final String DEFAULT_KEYMANAGERFACTORY_ALGORITHM =
|
||||
(Security.getProperty("ssl.KeyManagerFactory.algorithm") == null ?
|
||||
"SunX509" : Security.getProperty("ssl.KeyManagerFactory.algorithm"));
|
||||
@ -96,7 +95,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
// private final Set<String> _excludeProtocols = new HashSet<String>(Collections.singleton("SSLv2Hello"));
|
||||
/** Included protocols. */
|
||||
private Set<String> _includeProtocols = null;
|
||||
|
||||
|
||||
/** Excluded cipher suites. */
|
||||
private final Set<String> _excludeCipherSuites = new HashSet<String>();
|
||||
/** Included cipher suites. */
|
||||
@ -178,7 +177,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
|
||||
/** SSL context */
|
||||
private SSLContext _context;
|
||||
|
||||
|
||||
private boolean _trustAll;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@ -225,7 +224,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
_trustStore==null && _trustStoreInputStream == null && _trustStorePath == null )
|
||||
{
|
||||
TrustManager[] trust_managers=null;
|
||||
|
||||
|
||||
if (_trustAll)
|
||||
{
|
||||
LOG.debug("No keystore or trust store configured. ACCEPTING UNTRUSTED CERTIFICATES!!!!!");
|
||||
@ -247,7 +246,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
};
|
||||
trust_managers = new TrustManager[] { trustAllCerts };
|
||||
}
|
||||
|
||||
|
||||
SecureRandom secureRandom = (_secureRandomAlgorithm == null)?null:SecureRandom.getInstance(_secureRandomAlgorithm);
|
||||
_context = SSLContext.getInstance(_sslProtocol);
|
||||
_context.init(null, trust_managers, secureRandom);
|
||||
@ -255,7 +254,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
else
|
||||
{
|
||||
// verify that keystore and truststore
|
||||
// parameters are set up correctly
|
||||
// parameters are set up correctly
|
||||
checkKeyStore();
|
||||
|
||||
KeyStore keyStore = loadKeyStore();
|
||||
@ -293,7 +292,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
_context.init(keyManagers,trustManagers,secureRandom);
|
||||
|
||||
SSLEngine engine=newSslEngine();
|
||||
|
||||
|
||||
LOG.info("Enabled Protocols {} of {}",Arrays.asList(engine.getEnabledProtocols()),Arrays.asList(engine.getSupportedProtocols()));
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Enabled Ciphers {} of {}",Arrays.asList(engine.getEnabledCipherSuites()),Arrays.asList(engine.getSupportedCipherSuites()));
|
||||
@ -334,7 +333,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
checkNotStarted();
|
||||
_excludeProtocols.addAll(Arrays.asList(protocol));
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return The array of protocol names to include in
|
||||
@ -380,7 +379,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
_excludeCipherSuites.clear();
|
||||
_excludeCipherSuites.addAll(Arrays.asList(cipherSuites));
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param cipher Cipher names to add to {@link SSLEngine#setEnabledCipherSuites(String[])}
|
||||
@ -429,7 +428,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
{
|
||||
return _keyStorePath;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param keyStorePath
|
||||
@ -878,7 +877,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
{
|
||||
return (_keyManagerFactoryAlgorithm);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param algorithm
|
||||
@ -1094,7 +1093,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
protected TrustManager[] getTrustManagers(KeyStore trustStore, Collection<? extends CRL> crls) throws Exception
|
||||
{
|
||||
{
|
||||
TrustManager[] managers = null;
|
||||
if (trustStore != null)
|
||||
{
|
||||
@ -1156,15 +1155,15 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
* used as truststore.
|
||||
* @throws IllegalStateException if SslContextFactory configuration can't be used.
|
||||
*/
|
||||
public void checkKeyStore()
|
||||
public void checkKeyStore()
|
||||
{
|
||||
if (_context != null)
|
||||
return; //nothing to check if using preconfigured context
|
||||
|
||||
|
||||
|
||||
|
||||
if (_keyStore == null && _keyStoreInputStream == null && _keyStorePath == null)
|
||||
throw new IllegalStateException("SSL doesn't have a valid keystore");
|
||||
|
||||
|
||||
// if the keystore has been configured but there is no
|
||||
// truststore configured, use the keystore as the truststore
|
||||
if (_trustStore == null && _trustStoreInputStream == null && _trustStorePath == null)
|
||||
@ -1209,7 +1208,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
public String[] selectProtocols(String[] enabledProtocols, String[] supportedProtocols)
|
||||
{
|
||||
Set<String> selected_protocols = new HashSet<String>();
|
||||
|
||||
|
||||
// Set the starting protocols - either from the included or enabled list
|
||||
if (_includeProtocols!=null)
|
||||
{
|
||||
@ -1220,15 +1219,15 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
}
|
||||
else
|
||||
selected_protocols.addAll(Arrays.asList(enabledProtocols));
|
||||
|
||||
|
||||
|
||||
|
||||
// Remove any excluded protocols
|
||||
if (_excludeProtocols != null)
|
||||
selected_protocols.removeAll(_excludeProtocols);
|
||||
|
||||
|
||||
return selected_protocols.toArray(new String[selected_protocols.size()]);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Select cipher suites to be used by the connector
|
||||
@ -1241,7 +1240,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
public String[] selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites)
|
||||
{
|
||||
Set<String> selected_ciphers = new HashSet<String>();
|
||||
|
||||
|
||||
// Set the starting ciphers - either from the included or enabled list
|
||||
if (_includeCipherSuites!=null)
|
||||
{
|
||||
@ -1252,8 +1251,8 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
}
|
||||
else
|
||||
selected_ciphers.addAll(Arrays.asList(enabledCipherSuites));
|
||||
|
||||
|
||||
|
||||
|
||||
// Remove any excluded ciphers
|
||||
if (_excludeCipherSuites != null)
|
||||
selected_ciphers.removeAll(_excludeCipherSuites);
|
||||
@ -1450,7 +1449,7 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
{
|
||||
SSLServerSocketFactory factory = _context.getServerSocketFactory();
|
||||
|
||||
SSLServerSocket socket =
|
||||
SSLServerSocket socket =
|
||||
(SSLServerSocket) (host==null ?
|
||||
factory.createServerSocket(port,backlog):
|
||||
factory.createServerSocket(port,backlog,InetAddress.getByName(host)));
|
||||
@ -1467,14 +1466,14 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public SSLSocket newSslSocket() throws IOException
|
||||
{
|
||||
SSLSocketFactory factory = _context.getSocketFactory();
|
||||
|
||||
|
||||
SSLSocket socket = (SSLSocket)factory.createSocket();
|
||||
|
||||
|
||||
if (getWantClientAuth())
|
||||
socket.setWantClientAuth(getWantClientAuth());
|
||||
if (getNeedClientAuth())
|
||||
@ -1482,23 +1481,23 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
|
||||
socket.setEnabledCipherSuites(selectCipherSuites(
|
||||
socket.getEnabledCipherSuites(),
|
||||
socket.getSupportedCipherSuites()));
|
||||
socket.getSupportedCipherSuites()));
|
||||
socket.setEnabledProtocols(selectProtocols(socket.getEnabledProtocols(),socket.getSupportedProtocols()));
|
||||
|
||||
return socket;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public SSLEngine newSslEngine(String host,int port)
|
||||
{
|
||||
SSLEngine sslEngine=isSessionCachingEnabled()
|
||||
?_context.createSSLEngine(host, port)
|
||||
:_context.createSSLEngine();
|
||||
|
||||
|
||||
customize(sslEngine);
|
||||
return sslEngine;
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public SSLEngine newSslEngine()
|
||||
{
|
||||
@ -1518,8 +1517,18 @@ public class SslContextFactory extends AbstractLifeCycle
|
||||
sslEngine.setEnabledCipherSuites(selectCipherSuites(
|
||||
sslEngine.getEnabledCipherSuites(),
|
||||
sslEngine.getSupportedCipherSuites()));
|
||||
|
||||
|
||||
sslEngine.setEnabledProtocols(selectProtocols(sslEngine.getEnabledProtocols(),sslEngine.getSupportedProtocols()));
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public String toString()
|
||||
{
|
||||
return String.format("%s@%x(%s,%s)#%s",
|
||||
getClass().getSimpleName(),
|
||||
hashCode(),
|
||||
_keyStorePath,
|
||||
_trustStorePath,
|
||||
getState());
|
||||
}
|
||||
}
|
||||
|
@ -363,6 +363,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LOG.debug("Dispatched {} to stopped {}",job,this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -110,6 +110,107 @@ public class AggregateLifeCycleTest
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisJoint() throws Exception
|
||||
{
|
||||
final AtomicInteger destroyed=new AtomicInteger();
|
||||
final AtomicInteger started=new AtomicInteger();
|
||||
final AtomicInteger stopped=new AtomicInteger();
|
||||
|
||||
AggregateLifeCycle a0=new AggregateLifeCycle();
|
||||
|
||||
AggregateLifeCycle a1=new AggregateLifeCycle()
|
||||
{
|
||||
@Override
|
||||
protected void doStart() throws Exception
|
||||
{
|
||||
started.incrementAndGet();
|
||||
super.doStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStop() throws Exception
|
||||
{
|
||||
stopped.incrementAndGet();
|
||||
super.doStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy()
|
||||
{
|
||||
destroyed.incrementAndGet();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Start the a1 bean before adding, makes it auto disjoint
|
||||
a1.start();
|
||||
|
||||
// Now add it
|
||||
a0.addBean(a1);
|
||||
Assert.assertFalse(a0.isManaged(a1));
|
||||
|
||||
a0.start();
|
||||
Assert.assertEquals(1,started.get());
|
||||
Assert.assertEquals(0,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a0.start();
|
||||
Assert.assertEquals(1,started.get());
|
||||
Assert.assertEquals(0,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a0.stop();
|
||||
Assert.assertEquals(1,started.get());
|
||||
Assert.assertEquals(0,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a1.stop();
|
||||
Assert.assertEquals(1,started.get());
|
||||
Assert.assertEquals(1,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a0.start();
|
||||
Assert.assertEquals(1,started.get());
|
||||
Assert.assertEquals(1,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a0.manage(a1);
|
||||
Assert.assertTrue(a0.isManaged(a1));
|
||||
|
||||
a0.stop();
|
||||
Assert.assertEquals(1,started.get());
|
||||
Assert.assertEquals(1,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
|
||||
a0.start();
|
||||
Assert.assertEquals(2,started.get());
|
||||
Assert.assertEquals(1,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a0.stop();
|
||||
Assert.assertEquals(2,started.get());
|
||||
Assert.assertEquals(2,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
|
||||
a0.unmanage(a1);
|
||||
Assert.assertFalse(a0.isManaged(a1));
|
||||
|
||||
a0.destroy();
|
||||
Assert.assertEquals(2,started.get());
|
||||
Assert.assertEquals(2,stopped.get());
|
||||
Assert.assertEquals(0,destroyed.get());
|
||||
|
||||
a1.destroy();
|
||||
Assert.assertEquals(2,started.get());
|
||||
Assert.assertEquals(2,stopped.get());
|
||||
Assert.assertEquals(1,destroyed.get());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDumpable()
|
||||
{
|
||||
@ -159,6 +260,11 @@ public class AggregateLifeCycleTest
|
||||
System.err.println("--");
|
||||
a2.addBean(aa0);
|
||||
a0.dumpStdErr();
|
||||
|
||||
System.err.println("--");
|
||||
a0.unmanage(aa);
|
||||
a2.unmanage(aa0);
|
||||
a0.dumpStdErr();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ import org.eclipse.jetty.io.nio.SslConnection;
|
||||
import org.eclipse.jetty.util.B64Code;
|
||||
import org.eclipse.jetty.util.QuotedStringTokenizer;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
@ -68,7 +67,6 @@ public class WebSocketClientFactory extends AggregateLifeCycle
|
||||
private final Queue<WebSocketConnection> connections = new ConcurrentLinkedQueue<WebSocketConnection>();
|
||||
private final SslContextFactory _sslContextFactory = new SslContextFactory();
|
||||
private final ThreadPool _threadPool;
|
||||
private final boolean _shutdownThreadPool;
|
||||
private final WebSocketClientSelector _selector;
|
||||
private MaskGen _maskGen;
|
||||
private WebSocketBuffers _buffers;
|
||||
@ -117,16 +115,9 @@ public class WebSocketClientFactory extends AggregateLifeCycle
|
||||
public WebSocketClientFactory(ThreadPool threadPool, MaskGen maskGen, int bufferSize)
|
||||
{
|
||||
if (threadPool == null)
|
||||
{
|
||||
_threadPool = new QueuedThreadPool();
|
||||
addBean(_threadPool);
|
||||
_shutdownThreadPool = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_threadPool = threadPool;
|
||||
_shutdownThreadPool = false;
|
||||
}
|
||||
threadPool = new QueuedThreadPool();
|
||||
_threadPool = threadPool;
|
||||
addBean(_threadPool);
|
||||
|
||||
_buffers = new WebSocketBuffers(bufferSize);
|
||||
addBean(_buffers);
|
||||
@ -224,8 +215,6 @@ public class WebSocketClientFactory extends AggregateLifeCycle
|
||||
{
|
||||
closeConnections();
|
||||
super.doStop();
|
||||
if (_shutdownThreadPool && _threadPool instanceof LifeCycle)
|
||||
((LifeCycle)_threadPool).stop();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -1,242 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<linux-packaging>
|
||||
<mapping>
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jsp-api-2.1-glassfish</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<required-classes>
|
||||
<class>ch.qos.logback.classic.LoggerContext</class>
|
||||
</required-classes>
|
||||
<debian criteria=">= 0.9.18">liblogback-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<required-classes>
|
||||
<class>javax.servlet.http.HttpServlet</class>
|
||||
</required-classes>
|
||||
<debian available="false"/>
|
||||
<redhat avaialble="false">tomcat6-servlet-2.5-api</redhat>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<!-- In order to assure proper packaging setup, a few classes
|
||||
should be specified to check for on the classpath.
|
||||
If these classes are not present on the classpath, then
|
||||
the jar is downloaded from the maven repo and used in
|
||||
an embedded fashion. -->
|
||||
<required-classes>
|
||||
<class>junit.framework.Assert</class>
|
||||
<class>junit.framework.TestCase</class>
|
||||
</required-classes>
|
||||
<!-- The debian packaging refers to the version-less package name.
|
||||
An optional criteria can be specified that would indicate
|
||||
a minimum version to be present on the system.
|
||||
This information will (eventually) be verified against
|
||||
the debian/control file to ensure that the packaging
|
||||
is still valid.
|
||||
If the information is determined to not be present
|
||||
in the debian/control file than a build error is
|
||||
(hopefully) produced to let the maintainers know
|
||||
that this information is now out of date. -->
|
||||
<debian criteria=">= 3.8">junit</debian>
|
||||
<redhat>junit</redhat>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jdt.core.compiler</groupId>
|
||||
<artifactId>ecj</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat>ecj</redhat>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jsp-2.1-glassfish</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<required-classes>
|
||||
<class>ch.qos.logback.core.joran.JoranConfiguratorBase</class>
|
||||
</required-classes>
|
||||
<debian criteria=">= 0.9.18">liblogback-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jaspic_1.0_spec</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.equinox.http</groupId>
|
||||
<artifactId>servlet</artifactId>
|
||||
<debian criteria=">= 3.5">eclipse-platform</debian>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>services</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.1_spec</artifactId>
|
||||
<debian available="false">libgeronimo-jta-1.1-spec-1.1.1-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse</groupId>
|
||||
<artifactId>osgi</artifactId>
|
||||
<required-classes>
|
||||
<class>org.osgi.framework.BundleContext</class>
|
||||
</required-classes>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<debian criteria=">= 1.5.10">libslf4j-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm-commons</artifactId>
|
||||
<debian criteria=">= 3.1">libasm3-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<debian criteria=">= 1.6">ant</debian>
|
||||
<redhat>ant</redhat>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
<debian criteria=">= 3.1">libasm3-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm-tree</artifactId>
|
||||
<debian criteria=">= 3.1">libasm3-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<required-classes>
|
||||
<class>javax.mail.Authenticator</class>
|
||||
<class>javax.mail.PasswordAuthentication</class>
|
||||
<class>javax.mail.Session</class>
|
||||
</required-classes>
|
||||
<debian>libgnumail-java</debian>
|
||||
<redhat>sun-mail</redhat>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-annotation_1.0_spec</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<debian criteria=">= 1.5.10">libslf4j-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<debian criteria=">= 5.8">testng</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>3.0.20100224</version>
|
||||
<required-classes>
|
||||
<class>javax.servlet.AsyncContext</class>
|
||||
<class>javax.servlet.AsyncEvent</class>
|
||||
<class>javax.servlet.AsyncListener</class>
|
||||
</required-classes>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<required-classes>
|
||||
<class>org.slf4j.Logger</class>
|
||||
</required-classes>
|
||||
<debian criteria=">= 1.5.10">libslf4j-java</debian>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<debian available="false"/>
|
||||
<redhat available="false"/>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<debian>libgnujav-java</debian>
|
||||
<redhat>sun-jaf</redhat>
|
||||
</dependency>
|
||||
</mapping>
|
||||
<!-- Excluding due to Geronimo Dependency Requirements -->
|
||||
<project groupId="org.eclipse.jetty">
|
||||
<exclude>jetty-annotations</exclude>
|
||||
<exclude>jetty-jaspi</exclude>
|
||||
<exclude>jetty-plus</exclude>
|
||||
<exclude>example-jetty-embedded</exclude>
|
||||
<exclude>test-continuation</exclude>
|
||||
<exclude>test-continuation-jetty6</exclude>
|
||||
<exclude>test-jetty-servlet</exclude>
|
||||
</project>
|
||||
<!-- Dependencies for OSGI are too complicated to deal with right now -->
|
||||
<project groupId="org.eclipse.jetty.osgi">
|
||||
<exclude>jetty-osgi</exclude>
|
||||
<exclude>jetty-osgi-boot</exclude>
|
||||
<exclude>jetty-osgi-boot-jsp</exclude>
|
||||
<exclude>jetty-osgi-boot-logback</exclude>
|
||||
<exclude>jetty-osgi-boot-warurl</exclude>
|
||||
<exclude>jetty-httpservice</exclude>
|
||||
</project>
|
||||
<!-- Aggregate Projects need not be built by linux-packaging -->
|
||||
<project groupId="org.eclipse.jetty.aggregate">
|
||||
<exclude>jetty-server</exclude>
|
||||
<exclude>jetty-client</exclude>
|
||||
<exclude>jetty-servlet</exclude>
|
||||
<exclude>jetty-webapp</exclude>
|
||||
<exclude>jetty-plus</exclude>
|
||||
<exclude>jetty-all-server</exclude>
|
||||
<exclude>jetty-all</exclude>
|
||||
</project>
|
||||
<project groupId="org.eclipse.jetty.tests">
|
||||
<exclude>test-sessions-common</exclude>
|
||||
<exclude>test-jdbc-sessions</exclude>
|
||||
<exclude>test-hash-sessions</exclude>
|
||||
<exclude>test-integration</exclude>
|
||||
<exclude>test-webapp-rfc2616</exclude>
|
||||
</project>
|
||||
<daemon>
|
||||
<script>jetty-distribution/src/main/resources/bin/jetty.sh</script>
|
||||
<debian>debian/jetty.init</debian>
|
||||
<redhat>rpm/jetty.init</redhat>
|
||||
</daemon>
|
||||
</linux-packaging>
|
||||
|
Loading…
x
Reference in New Issue
Block a user