SOLR-4839: Upgrade to Jetty 9

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1649552 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-01-05 15:45:58 +00:00
parent de4f26978f
commit a41b9954d1
65 changed files with 597 additions and 209 deletions

View File

@ -68,11 +68,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<tests.jettyConnector>${tests.jettyConnector}</tests.jettyConnector>
</systemPropertyVariables>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -103,7 +103,6 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<systemPropertyVariables> <systemPropertyVariables>
<tests.jettyConnector>${tests.jettyConnector}</tests.jettyConnector>
<tests.disableHdfs>${tests.disableHdfs}</tests.disableHdfs> <tests.disableHdfs>${tests.disableHdfs}</tests.disableHdfs>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>

View File

@ -1036,7 +1036,6 @@
<propertyref prefix="tests.badapples" /> <propertyref prefix="tests.badapples" />
<propertyref prefix="tests.bwcdir" /> <propertyref prefix="tests.bwcdir" />
<propertyref prefix="tests.timeoutSuite" /> <propertyref prefix="tests.timeoutSuite" />
<propertyref prefix="tests.jettyConnector" />
<propertyref prefix="tests.disableHdfs" /> <propertyref prefix="tests.disableHdfs" />
<propertyref prefix="tests.filter" /> <propertyref prefix="tests.filter" />
<propertyref prefix="tests.leavetmpdir" /> <propertyref prefix="tests.leavetmpdir" />

View File

@ -70,7 +70,7 @@ com.sun.jersey.version = 1.9
/jakarta-regexp/jakarta-regexp = 1.4 /jakarta-regexp/jakarta-regexp = 1.4
/javax.activation/activation = 1.1.1 /javax.activation/activation = 1.1.1
/javax.inject/javax.inject= 1 /javax.inject/javax.inject= 1
/javax.servlet/javax.servlet-api = 3.0.1 /javax.servlet/javax.servlet-api = 3.1.0
/javax.servlet/servlet-api = 2.4 /javax.servlet/servlet-api = 2.4
/jdom/jdom = 1.0 /jdom/jdom = 1.0
/joda-time/joda-time = 2.2 /joda-time/joda-time = 2.2
@ -178,7 +178,7 @@ org.codehaus.jackson.version = 1.9.13
/org.easymock/easymock = 3.0 /org.easymock/easymock = 3.0
/org.eclipse.jetty.orbit/javax.servlet = 3.0.0.v201112011016 /org.eclipse.jetty.orbit/javax.servlet = 3.0.0.v201112011016
org.eclipse.jetty.version = 8.1.10.v20130312 org.eclipse.jetty.version = 9.2.6.v20141205
/org.eclipse.jetty/jetty-continuation = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-continuation = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-deploy = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-deploy = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-http = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-http = ${org.eclipse.jetty.version}
@ -187,6 +187,7 @@ org.eclipse.jetty.version = 8.1.10.v20130312
/org.eclipse.jetty/jetty-security = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-security = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-server = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-server = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-servlet = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-servlet = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-servlets = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-start = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-start = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-util = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-util = ${org.eclipse.jetty.version}
/org.eclipse.jetty/jetty-webapp = ${org.eclipse.jetty.version} /org.eclipse.jetty/jetty-webapp = ${org.eclipse.jetty.version}
@ -219,7 +220,7 @@ org.ow2.asm.version = 4.1
/org.ow2.asm/asm = ${org.ow2.asm.version} /org.ow2.asm/asm = ${org.ow2.asm.version}
/org.ow2.asm/asm-commons = ${org.ow2.asm.version} /org.ow2.asm/asm-commons = ${org.ow2.asm.version}
org.restlet.jee.version = 2.1.1 org.restlet.jee.version = 2.3.0
/org.restlet.jee/org.restlet = ${org.restlet.jee.version} /org.restlet.jee/org.restlet = ${org.restlet.jee.version}
/org.restlet.jee/org.restlet.ext.servlet = ${org.restlet.jee.version} /org.restlet.jee/org.restlet.ext.servlet = ${org.restlet.jee.version}

View File

@ -1 +0,0 @@
c0e26574ddcac7a86486f19a8b3782657acfd961

View File

@ -0,0 +1 @@
74ca2679e461e7e9b5fdffcf9685575a7d5f5c8e

View File

@ -1 +0,0 @@
d9eb53007e04d6338f12f3ded60fad1f7bfcb40e

View File

@ -0,0 +1 @@
5484771191612c1f5a57466865b7014ff56886ce

View File

@ -1 +0,0 @@
e829c768f2b9de5d9fae3bc0aba3996bd0344f56

View File

@ -0,0 +1 @@
11b84cc7078745fca844bd2fb95c2b4f818eafc2

View File

@ -1 +0,0 @@
13ca9587bc1645f8fac89454b15252a2ad5bdcf5

View File

@ -0,0 +1 @@
5960eb385ded42360045447185a0510365f811dc

View File

@ -1 +0,0 @@
98f8029fe7236e9c66381c04f292b5319f47ca84

View File

@ -0,0 +1 @@
026aa018ef20780e8a900ae7fc95f59884d3095b

View File

@ -1 +0,0 @@
d198a8ad8ea20b4fb74c781175c48500ec2b8b7a

View File

@ -0,0 +1 @@
fdfa0b969d99a2dfb2a46c0ff00251d7e6c7b2bb

View File

@ -18,18 +18,20 @@ package org.apache.lucene.replicator;
*/ */
import java.util.Random; import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.nio.SelectChannelConnector; import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.session.HashSessionIdManager; import org.eclipse.jetty.server.session.HashSessionIdManager;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.AfterClass; import org.junit.AfterClass;
@ -51,12 +53,6 @@ public abstract class ReplicatorTestCase extends LuceneTestCase {
* {@link #serverPort(Server)}. * {@link #serverPort(Server)}.
*/ */
public static synchronized Server newHttpServer(Handler handler) throws Exception { public static synchronized Server newHttpServer(Handler handler) throws Exception {
Server server = new Server(0);
server.setHandler(handler);
final String connectorName = System.getProperty("tests.jettyConnector", "SelectChannel");
// if this property is true, then jetty will be configured to use SSL // if this property is true, then jetty will be configured to use SSL
// leveraging the same system properties as java to specify // leveraging the same system properties as java to specify
// the keystore/truststore if they are set // the keystore/truststore if they are set
@ -78,7 +74,7 @@ public abstract class ReplicatorTestCase extends LuceneTestCase {
(System.getProperty("javax.net.ssl.keyStorePassword")); (System.getProperty("javax.net.ssl.keyStorePassword"));
} }
if (null != System.getProperty("javax.net.ssl.trustStore")) { if (null != System.getProperty("javax.net.ssl.trustStore")) {
sslcontext.setTrustStore sslcontext.setKeyStorePath
(System.getProperty("javax.net.ssl.trustStore")); (System.getProperty("javax.net.ssl.trustStore"));
} }
if (null != System.getProperty("javax.net.ssl.trustStorePassword")) { if (null != System.getProperty("javax.net.ssl.trustStorePassword")) {
@ -88,34 +84,36 @@ public abstract class ReplicatorTestCase extends LuceneTestCase {
sslcontext.setNeedClientAuth(Boolean.getBoolean("tests.jettySsl.clientAuth")); sslcontext.setNeedClientAuth(Boolean.getBoolean("tests.jettySsl.clientAuth"));
} }
final Connector connector; final QueuedThreadPool threadPool = new QueuedThreadPool();
final QueuedThreadPool threadPool; threadPool.setDaemon(true);
if ("SelectChannel".equals(connectorName)) { threadPool.setMaxThreads(10000);
final SelectChannelConnector c = useSsl ? new SslSelectChannelConnector(sslcontext) : new SelectChannelConnector(); threadPool.setIdleTimeout(5000);
c.setReuseAddress(true); threadPool.setStopTimeout(30000);
c.setLowResourcesMaxIdleTime(1500);
Server server = new Server(threadPool);
server.setStopAtShutdown(true);
server.manage(threadPool);
final ServerConnector connector;
if (useSsl) {
HttpConfiguration configuration = new HttpConfiguration();
configuration.setSecureScheme("https");
configuration.addCustomizer(new SecureRequestCustomizer());
ServerConnector c = new ServerConnector(server, new SslConnectionFactory(sslcontext, "http/1.1"),
new HttpConnectionFactory(configuration));
connector = c; connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else if ("Socket".equals(connectorName)) {
final SocketConnector c = useSsl ? new SslSocketConnector(sslcontext) : new SocketConnector();
c.setReuseAddress(true);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else { } else {
throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName); ServerConnector c = new ServerConnector(server, new HttpConnectionFactory());
connector = c;
} }
connector.setPort(0); connector.setPort(0);
connector.setHost("127.0.0.1"); connector.setHost("127.0.0.1");
if (threadPool != null) {
threadPool.setDaemon(true);
threadPool.setMaxThreads(10000);
threadPool.setMaxIdleTimeMs(5000);
threadPool.setMaxStopTimeMs(30000);
}
server.setConnectors(new Connector[] {connector}); server.setConnectors(new Connector[] {connector});
server.setSessionIdManager(new HashSessionIdManager(new Random(random().nextLong()))); server.setSessionIdManager(new HashSessionIdManager(new Random(random().nextLong())));
server.setHandler(handler);
server.start(); server.start();
@ -124,12 +122,12 @@ public abstract class ReplicatorTestCase extends LuceneTestCase {
/** Returns a {@link Server}'s port. */ /** Returns a {@link Server}'s port. */
public static int serverPort(Server server) { public static int serverPort(Server server) {
return server.getConnectors()[0].getLocalPort(); return ((ServerConnector)server.getConnectors()[0]).getLocalPort();
} }
/** Returns a {@link Server}'s host. */ /** Returns a {@link Server}'s host. */
public static String serverHost(Server server) { public static String serverHost(Server server) {
return server.getConnectors()[0].getHost(); return ((ServerConnector)server.getConnectors()[0]).getHost();
} }
/** /**

View File

@ -62,6 +62,7 @@ Carrot2 3.9.0
Velocity 1.7 and Velocity Tools 2.0 Velocity 1.7 and Velocity Tools 2.0
Apache UIMA 2.3.1 Apache UIMA 2.3.1
Apache ZooKeeper 3.4.6 Apache ZooKeeper 3.4.6
Jetty 9.2.6.v20141205
Upgrading from Solr 4.x Upgrading from Solr 4.x
---------------------- ----------------------
@ -626,6 +627,9 @@ Other Changes
* SOLR-6905: Test pseudo-field retrieval in distributed search. * SOLR-6905: Test pseudo-field retrieval in distributed search.
(Ramkumar Aiyengar via shalin) (Ramkumar Aiyengar via shalin)
* SOLR-4839: Upgrade Jetty to 9.2.6.v20141205 and restlet-jee to 2.3.0
(Bill Bell, Timothy Potter, Uwe Schindler, shalin)
================== 4.10.3 ================== ================== 4.10.3 ==================
Bug Fixes Bug Fixes

View File

@ -1138,6 +1138,7 @@ function launch_solr() {
SOLR_START_OPTS="-server -Xss256k $SOLR_JAVA_MEM $GC_TUNE $GC_LOG_OPTS $REMOTE_JMX_OPTS \ SOLR_START_OPTS="-server -Xss256k $SOLR_JAVA_MEM $GC_TUNE $GC_LOG_OPTS $REMOTE_JMX_OPTS \
$CLOUD_MODE_OPTS \ $CLOUD_MODE_OPTS \
-Djetty.home=$SOLR_SERVER_DIR
-DSTOP.PORT=$stop_port -DSTOP.KEY=$STOP_KEY \ -DSTOP.PORT=$stop_port -DSTOP.KEY=$STOP_KEY \
$SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \ $SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \
-Dsolr.solr.home=$SOLR_HOME \ -Dsolr.solr.home=$SOLR_HOME \

View File

@ -19,17 +19,19 @@ package org.apache.solr.client.solrj.embedded;
import org.apache.solr.servlet.SolrDispatchFilter; import org.apache.solr.servlet.SolrDispatchFilter;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.LowResourceMonitor;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.GzipHandler; import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.session.HashSessionIdManager; import org.eclipse.jetty.server.session.HashSessionIdManager;
import org.eclipse.jetty.server.ssl.SslConnector;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlets.GzipFilter;
import org.eclipse.jetty.servlets.gzip.GzipHandler;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -202,18 +204,11 @@ public class JettySolrRunner {
private void init(String solrHome, String context, int port, boolean stopAtShutdown) { private void init(String solrHome, String context, int port, boolean stopAtShutdown) {
this.context = context; this.context = context;
server = new Server(port);
this.solrHome = solrHome; this.solrHome = solrHome;
this.stopAtShutdown = stopAtShutdown; this.stopAtShutdown = stopAtShutdown;
server.setStopAtShutdown(stopAtShutdown);
if (!stopAtShutdown) {
server.setGracefulShutdown(0);
}
System.setProperty("solr.solr.home", solrHome); System.setProperty("solr.solr.home", solrHome);
if (System.getProperty("jetty.testMode") != null) { if (System.getProperty("jetty.testMode") != null) {
final String connectorName = System.getProperty("tests.jettyConnector", "SelectChannel");
// if this property is true, then jetty will be configured to use SSL // if this property is true, then jetty will be configured to use SSL
// leveraging the same system properties as java to specify // leveraging the same system properties as java to specify
// the keystore/truststore if they are set unless specific config // the keystore/truststore if they are set unless specific config
@ -227,52 +222,56 @@ public class JettySolrRunner {
final SslContextFactory sslcontext = new SslContextFactory(false); final SslContextFactory sslcontext = new SslContextFactory(false);
sslInit(useSsl, sslcontext); sslInit(useSsl, sslcontext);
final Connector connector; QueuedThreadPool qtp = new QueuedThreadPool();
if ("SelectChannel".equals(connectorName)) { qtp.setMaxThreads(10000);
final SelectChannelConnector c = useSsl qtp.setIdleTimeout((int) TimeUnit.SECONDS.toMillis(5));
? new SslSelectChannelConnector(sslcontext) qtp.setStopTimeout((int) TimeUnit.MINUTES.toMillis(1));
: new SelectChannelConnector();
c.setReuseAddress(true); server = new Server(qtp);
c.setLowResourcesMaxIdleTime(1500); server.setStopAtShutdown(stopAtShutdown);
c.setSoLingerTime(0); server.manage(qtp);
connector = c;
} else if ("Socket".equals(connectorName)) { ServerConnector connector;
final SocketConnector c = useSsl if (useSsl) {
? new SslSocketConnector(sslcontext) HttpConfiguration configuration = new HttpConfiguration();
: new SocketConnector(); configuration.setSecureScheme("https");
c.setReuseAddress(true); configuration.addCustomizer(new SecureRequestCustomizer());
c.setSoLingerTime(0); connector = new ServerConnector(server, new SslConnectionFactory(sslcontext, "http/1.1"),
connector = c; new HttpConnectionFactory(configuration));
} else { } else {
throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName); connector = new ServerConnector(server, new HttpConnectionFactory());
} }
connector.setReuseAddress(true);
connector.setSoLingerTime(0);
connector.setPort(port); connector.setPort(port);
connector.setHost("127.0.0.1"); connector.setHost("127.0.0.1");
// Connectors by default inherit server's thread pool. // Enable Low Resources Management
QueuedThreadPool qtp = new QueuedThreadPool(); LowResourceMonitor lowResources = new LowResourceMonitor(server);
qtp.setMaxThreads(10000); lowResources.setLowResourcesIdleTimeout(1500);
qtp.setMaxIdleTimeMs((int) TimeUnit.MILLISECONDS.toMillis(200)); lowResources.setMaxConnections(10000);
qtp.setMaxStopTimeMs((int) TimeUnit.MINUTES.toMillis(1)); server.addBean(lowResources);
server.setThreadPool(qtp);
server.setConnectors(new Connector[] {connector}); server.setConnectors(new Connector[] {connector});
server.setSessionIdManager(new HashSessionIdManager(new Random())); server.setSessionIdManager(new HashSessionIdManager(new Random()));
} else { } else {
if (server.getThreadPool() == null) { ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
// Connectors by default inherit server's thread pool. connector.setPort(port);
QueuedThreadPool qtp = new QueuedThreadPool(); QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setMaxThreads(10000); qtp.setMaxThreads(10000);
qtp.setMaxIdleTimeMs((int) TimeUnit.SECONDS.toMillis(5)); qtp.setIdleTimeout((int) TimeUnit.SECONDS.toMillis(5));
qtp.setMaxStopTimeMs((int) TimeUnit.SECONDS.toMillis(1)); qtp.setStopTimeout((int) TimeUnit.SECONDS.toMillis(1));
server.setThreadPool(qtp);
} server = new Server(qtp);
server.setStopAtShutdown(stopAtShutdown);
server.manage(qtp);
} }
// Initialize the servlets // Initialize the servlets
final ServletContextHandler root = new ServletContextHandler(server, context, ServletContextHandler.SESSIONS); final ServletContextHandler root = new ServletContextHandler(server, context, ServletContextHandler.SESSIONS);
root.setHandler(new GzipHandler()); root.addFilter(GzipFilter.class, "*", EnumSet.of(DispatcherType.REQUEST));
server.addLifeCycleListener(new LifeCycle.Listener() { server.addLifeCycleListener(new LifeCycle.Listener() {
@Override @Override
@ -309,11 +308,11 @@ public class JettySolrRunner {
EnumSet.of(DispatcherType.REQUEST))); EnumSet.of(DispatcherType.REQUEST)));
} }
} }
dispatchFilter = root.addFilter(SolrDispatchFilter.class, "*", EnumSet.of(DispatcherType.REQUEST) );
for (ServletHolder servletHolder : extraServlets.keySet()) { for (ServletHolder servletHolder : extraServlets.keySet()) {
String pathSpec = extraServlets.get(servletHolder); String pathSpec = extraServlets.get(servletHolder);
root.addServlet(servletHolder, pathSpec); root.addServlet(servletHolder, pathSpec);
} }
dispatchFilter = root.addFilter(SolrDispatchFilter.class, "*", EnumSet.of(DispatcherType.REQUEST) );
if (solrConfigFilename != null) System.clearProperty("solrconfig"); if (solrConfigFilename != null) System.clearProperty("solrconfig");
if (schemaFilename != null) System.clearProperty("schema"); if (schemaFilename != null) System.clearProperty("schema");
System.clearProperty("solr.solr.home"); System.clearProperty("solr.solr.home");
@ -339,7 +338,7 @@ public class JettySolrRunner {
sslcontext.setKeyStorePassword(sslConfig.getKeyStorePassword()); sslcontext.setKeyStorePassword(sslConfig.getKeyStorePassword());
} }
if (null != sslConfig.getTrustStore()) { if (null != sslConfig.getTrustStore()) {
sslcontext.setTrustStore(System sslcontext.setTrustStorePath(System
.getProperty(sslConfig.getTrustStore())); .getProperty(sslConfig.getTrustStore()));
} }
if (null != sslConfig.getTrustStorePassword()) { if (null != sslConfig.getTrustStorePassword()) {
@ -359,7 +358,7 @@ public class JettySolrRunner {
(System.getProperty("javax.net.ssl.keyStorePassword")); (System.getProperty("javax.net.ssl.keyStorePassword"));
} }
if (null != System.getProperty("javax.net.ssl.trustStore")) { if (null != System.getProperty("javax.net.ssl.trustStore")) {
sslcontext.setTrustStore sslcontext.setTrustStorePath
(System.getProperty("javax.net.ssl.trustStore")); (System.getProperty("javax.net.ssl.trustStore"));
} }
if (null != System.getProperty("javax.net.ssl.trustStorePassword")) { if (null != System.getProperty("javax.net.ssl.trustStorePassword")) {
@ -464,7 +463,7 @@ public class JettySolrRunner {
if (0 == conns.length) { if (0 == conns.length) {
throw new RuntimeException("Jetty Server has no Connectors"); throw new RuntimeException("Jetty Server has no Connectors");
} }
return (proxyPort != -1) ? proxyPort : conns[0].getLocalPort(); return (proxyPort != -1) ? proxyPort : ((ServerConnector) conns[0]).getLocalPort();
} }
/** /**
@ -489,7 +488,7 @@ public class JettySolrRunner {
} }
/** /**
* Returns a base URL consisting of the protocal, host, and port for a * Returns a base URL consisting of the protocol, host, and port for a
* Connector in use by the Jetty Server contained in this runner. * Connector in use by the Jetty Server contained in this runner.
*/ */
public URL getBaseUrl() { public URL getBaseUrl() {
@ -499,12 +498,12 @@ public class JettySolrRunner {
if (0 == conns.length) { if (0 == conns.length) {
throw new IllegalStateException("Jetty Server has no Connectors"); throw new IllegalStateException("Jetty Server has no Connectors");
} }
Connector c = conns[0]; ServerConnector c = (ServerConnector) conns[0];
if (c.getLocalPort() < 0) { if (c.getLocalPort() < 0) {
throw new IllegalStateException("Jetty Connector is not open: " + throw new IllegalStateException("Jetty Connector is not open: " +
c.getLocalPort()); c.getLocalPort());
} }
protocol = (c instanceof SslConnector) ? "https" : "http"; protocol = c.getDefaultProtocol().equals("SSL-http/1.1") ? "https" : "http";
return new URL(protocol, c.getHost(), c.getLocalPort(), context); return new URL(protocol, c.getHost(), c.getLocalPort(), context);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
@ -614,6 +613,11 @@ class NoLog implements Logger {
} }
@Override
public void debug(String s, long l) {
}
@Override @Override
public String getName() { public String getName() {
return toString(); return toString();

View File

@ -22,7 +22,9 @@ import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.replay;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.URL; import java.net.URL;
@ -34,6 +36,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream; import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -225,10 +228,7 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
expect(request.getContentType()).andReturn( contentType ).anyTimes(); expect(request.getContentType()).andReturn( contentType ).anyTimes();
expect(request.getQueryString()).andReturn(getParams).anyTimes(); expect(request.getQueryString()).andReturn(getParams).anyTimes();
expect(request.getContentLength()).andReturn(postBytes.length).anyTimes(); expect(request.getContentLength()).andReturn(postBytes.length).anyTimes();
expect(request.getInputStream()).andReturn(new ServletInputStream() { expect(request.getInputStream()).andReturn(new ByteServletInputStream(postBytes));
private final ByteArrayInputStream in = new ByteArrayInputStream(postBytes);
@Override public int read() { return in.read(); }
});
replay(request); replay(request);
MultipartRequestParser multipart = new MultipartRequestParser( 2048 ); MultipartRequestParser multipart = new MultipartRequestParser( 2048 );
@ -244,6 +244,39 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
} }
} }
static class ByteServletInputStream extends ServletInputStream {
final BufferedInputStream in;
final int len;
int readCount = 0;
public ByteServletInputStream(byte[] data) {
this.len = data.length;
this.in = new BufferedInputStream(new ByteArrayInputStream(data));
}
@Override
public boolean isFinished() {
return readCount == len;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
throw new IllegalStateException("Not supported");
}
@Override
public int read() throws IOException {
int read = in.read();
readCount += read;
return read;
}
}
@Test @Test
public void testStandardParseParamsAndFillStreamsISO88591() throws Exception public void testStandardParseParamsAndFillStreamsISO88591() throws Exception
{ {
@ -257,10 +290,7 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
expect(request.getContentType()).andReturn( contentType ).anyTimes(); expect(request.getContentType()).andReturn( contentType ).anyTimes();
expect(request.getQueryString()).andReturn(getParams).anyTimes(); expect(request.getQueryString()).andReturn(getParams).anyTimes();
expect(request.getContentLength()).andReturn(postBytes.length).anyTimes(); expect(request.getContentLength()).andReturn(postBytes.length).anyTimes();
expect(request.getInputStream()).andReturn(new ServletInputStream() { expect(request.getInputStream()).andReturn(new ByteServletInputStream(postBytes));
private final ByteArrayInputStream in = new ByteArrayInputStream(postBytes);
@Override public int read() { return in.read(); }
});
replay(request); replay(request);
MultipartRequestParser multipart = new MultipartRequestParser( 2048 ); MultipartRequestParser multipart = new MultipartRequestParser( 2048 );
@ -292,10 +322,7 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
// we dont pass a content-length to let the security mechanism limit it: // we dont pass a content-length to let the security mechanism limit it:
expect(request.getContentLength()).andReturn(-1).anyTimes(); expect(request.getContentLength()).andReturn(-1).anyTimes();
expect(request.getQueryString()).andReturn(null).anyTimes(); expect(request.getQueryString()).andReturn(null).anyTimes();
expect(request.getInputStream()).andReturn(new ServletInputStream() { expect(request.getInputStream()).andReturn(new ByteServletInputStream(large.toString().getBytes(StandardCharsets.US_ASCII)));
private final ByteArrayInputStream in = new ByteArrayInputStream(large.toString().getBytes(StandardCharsets.US_ASCII));
@Override public int read() { return in.read(); }
});
replay(request); replay(request);
FormDataRequestParser formdata = new FormDataRequestParser( limitKBytes ); FormDataRequestParser formdata = new FormDataRequestParser( limitKBytes );
@ -319,6 +346,21 @@ public class SolrRequestParserTest extends SolrTestCaseJ4 {
// we emulate Jetty that returns empty stream when parameters were parsed before: // we emulate Jetty that returns empty stream when parameters were parsed before:
expect(request.getInputStream()).andReturn(new ServletInputStream() { expect(request.getInputStream()).andReturn(new ServletInputStream() {
@Override public int read() { return -1; } @Override public int read() { return -1; }
@Override
public boolean isFinished() {
return true;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
}); });
replay(request); replay(request);

View File

@ -1 +0,0 @@
6bf0ebb7efd993e222fc1112377b5e92a13b38dd

View File

@ -0,0 +1 @@
3cd63d075497751784b2fa84be59432f4905bf7c

View File

@ -1 +0,0 @@
c0e26574ddcac7a86486f19a8b3782657acfd961

View File

@ -0,0 +1 @@
74ca2679e461e7e9b5fdffcf9685575a7d5f5c8e

View File

@ -1 +0,0 @@
875b96ef84e3b83a40b3aac9e473434d6414a389

View File

@ -0,0 +1 @@
7ad677c1442dc965b5815f4452848b8eecbc5082

View File

@ -1 +0,0 @@
d9eb53007e04d6338f12f3ded60fad1f7bfcb40e

View File

@ -0,0 +1 @@
5484771191612c1f5a57466865b7014ff56886ce

View File

@ -1 +0,0 @@
e829c768f2b9de5d9fae3bc0aba3996bd0344f56

View File

@ -0,0 +1 @@
11b84cc7078745fca844bd2fb95c2b4f818eafc2

View File

@ -1 +0,0 @@
6e48870e2af2caf2a77751eae3a79bfcf6b90a78

View File

@ -0,0 +1 @@
53ebf8bd8d151c3c7883e3b23eee9f67ecd716e9

View File

@ -1 +0,0 @@
a386e7f0a8b9157b99a2f29a6deac61e007a2b9b

View File

@ -0,0 +1 @@
513537c2a4f7d2a44120f4ff5fdc7fc2c8bc9357

View File

@ -1 +0,0 @@
13ca9587bc1645f8fac89454b15252a2ad5bdcf5

View File

@ -0,0 +1 @@
5960eb385ded42360045447185a0510365f811dc

View File

@ -1 +0,0 @@
98f8029fe7236e9c66381c04f292b5319f47ca84

View File

@ -0,0 +1 @@
026aa018ef20780e8a900ae7fc95f59884d3095b

View File

@ -0,0 +1 @@
0e36f5f1d19c48ad1ae6e65172ee472d0ba8b571

View File

@ -1 +0,0 @@
d198a8ad8ea20b4fb74c781175c48500ec2b8b7a

View File

@ -0,0 +1 @@
fdfa0b969d99a2dfb2a46c0ff00251d7e6c7b2bb

View File

@ -1 +0,0 @@
a3353244b93e895f1ca8f607077f247063470233

View File

@ -0,0 +1 @@
68da2c29c6bedac8d502839fea66b91e05077a68

View File

@ -1 +0,0 @@
96eb17dd4265732b0cb9cd15e36f83633832dd65

View File

@ -0,0 +1 @@
2f51a87d2c962257304391aa29e1c0030774c4ac

View File

@ -1 +0,0 @@
e12c23b962c925f2681729afa1e40066a350ad27

View File

@ -0,0 +1 @@
4c5d184e23fa729726668a90dc7338d80c4e7e6f

View File

@ -1 +0,0 @@
72baf27dc19d98f43c362ded582db408433373ee

View File

@ -0,0 +1 @@
9303e20d0397c0304342943560c3a1693fd7ce7d

View File

@ -1 +1 @@
8e1a37a8daae3f222d957012f826047497466a56 6380e0fe5a738cced80ef705dbac3320a8f25edf

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath"><SystemProperty name="hostContext" default="/solr"/></Set> <Set name="contextPath"><Property name="hostContext" default="/solr"/></Set>
<Set name="war"><SystemProperty name="jetty.home"/>/webapps/solr.war</Set> <Set name="war"><Property name="jetty.base"/>/webapps/solr.war</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home"/>/etc/webdefault.xml</Set> <Set name="defaultsDescriptor"><Property name="jetty.base"/>/etc/webdefault.xml</Set>
<Set name="tempDirectory"><Property name="jetty.home" default="."/>/solr-webapp</Set> <Set name="tempDirectory"><Property name="jetty.base" default="."/>/solr-webapp</Set>
</Configure> </Configure>

View File

@ -0,0 +1,75 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================= -->
<!-- Configure the Jetty Server instance with an ID "Server" -->
<!-- by adding a HTTP connector. -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- ============================================================= -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Get name="ThreadPool">
<!-- Default queued blocking threadpool -->
<Set name="minThreads"><Property name="jetty.threads.min" /></Set>
<Set name="maxThreads"><Property name="jetty.threads.max" /></Set>
<Set name="detailedDump">false</Set>
<Set name="idleTimeout"><Property name="jetty.threads.idle.timeout" /></Set>
</Get>
<!-- =========================================================== -->
<!-- Add a HTTP Connector. -->
<!-- Configure an o.e.j.server.ServerConnector with a single -->
<!-- HttpConnectionFactory instance using the common httpConfig -->
<!-- instance defined in jetty.xml -->
<!-- -->
<!-- Consult the javadoc of o.e.j.server.ServerConnector and -->
<!-- o.e.j.server.HttpConnectionFactory for all configuration -->
<!-- that may be set here. -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="acceptors" type="int"><Property name="jetty.http.acceptors" default="-1"/></Arg>
<Arg name="selectors" type="int"><Property name="jetty.http.selectors" default="-1"/></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config">
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="sendServerVersion">false</Set>
<Set name="sendDateHeader">false</Set>
</New>
</Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="port"><Property name="jetty.port" /></Set>
<Set name="host"><Property name="jetty.host" /></Set>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================= -->
<!-- Configure a HTTPS connector. -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- and jetty-ssl.xml. -->
<!-- ============================================================= -->
<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
<Call name="addIfAbsentConnectionFactory">
<Arg>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="next">http/1.1</Arg>
<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
</New>
</Arg>
</Call>
<Call name="addConnectionFactory">
<Arg>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
</New>
</Arg>
</Call>
</Configure>

View File

@ -0,0 +1,95 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================= -->
<!-- Base SSL configuration -->
<!-- This configuration needs to be used together with 1 or more -->
<!-- of jetty-https.xml, jetty-spdy.xml and/or jetty-http2.xml -->
<!-- ============================================================= -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Add a SSL Connector with no protocol factories -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="acceptors" type="int"><Property name="ssl.acceptors" default="-1"/></Arg>
<Arg name="selectors" type="int"><Property name="ssl.selectors" default="-1"/></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<!-- uncomment to support proxy protocol
<Item>
<New class="org.eclipse.jetty.server.ProxyConnectionFactory"/>
</Item>-->
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="ssl.port" default="443" /></Set>
<Set name="idleTimeout"><Property name="ssl.timeout" default="30000"/></Set>
<Set name="soLingerTime"><Property name="ssl.soLingerTime" default="-1"/></Set>
<Set name="acceptorPriorityDelta"><Property name="ssl.acceptorPriorityDelta" default="0"/></Set>
<Set name="selectorPriorityDelta"><Property name="ssl.selectorPriorityDelta" default="0"/></Set>
<Set name="acceptQueueSize"><Property name="ssl.acceptQueueSize" default="0"/></Set>
</New>
</Arg>
</Call>
<!-- ============================================================= -->
<!-- Create a TLS (SSL) Context Factory for later reuse -->
<!-- ============================================================= -->
<New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="etc/keystore"/></Set>
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
<Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="OBF:1u2u1wml1z7s1z7a1wnl1u2g"/></Set>
<Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="etc/keystore"/></Set>
<Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4"/></Set>
<Set name="EndpointIdentificationAlgorithm"></Set>
<Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
<Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>
<Set name="ExcludeCipherSuites">
<Array type="String">
<Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
<Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
</Array>
</Set>
</New>
<!-- =========================================================== -->
<!-- Create a TLS specific HttpConfiguration based on the -->
<!-- common HttpConfiguration defined in jetty.xml -->
<!-- Add a SecureRequestCustomizer to extract certificate and -->
<!-- session information -->
<!-- =========================================================== -->
<New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Arg><Ref refid="httpConfig"/></Arg>
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</New>
</Configure>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== --> <!-- =============================================================== -->
<!-- Configure the Jetty Server --> <!-- Configure the Jetty Server -->
@ -12,54 +12,6 @@
<Configure id="Server" class="org.eclipse.jetty.server.Server"> <Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool -->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">10000</Set>
<Set name="detailedDump">false</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<!--
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">5000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
-->
<!-- This connector is currently being used for Solr because it
showed better performance than nio.SelectChannelConnector
for typical Solr requests. -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.bio.SocketConnector">
<Set name="host"><SystemProperty name="jetty.host" /></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
<Set name="statsOn">false</Set>
</New>
</Arg>
</Call>
<!-- if the connector below is uncommented, then jetty will also accept SSL <!-- if the connector below is uncommented, then jetty will also accept SSL
connections on port 8984, using a self signed certificate and can connections on port 8984, using a self signed certificate and can
optionally require the client to authenticate with a certificate. optionally require the client to authenticate with a certificate.
@ -149,26 +101,28 @@
<!-- extra options --> <!-- extra options -->
<!-- =========================================================== --> <!-- =========================================================== -->
<Set name="stopAtShutdown">true</Set> <Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">false</Set>
<Set name="sendDateHeader">false</Set>
<Set name="gracefulShutdown">1000</Set>
<Set name="dumpAfterStart">false</Set> <Set name="dumpAfterStart">false</Set>
<Set name="dumpBeforeStop">false</Set> <Set name="dumpBeforeStop">false</Set>
<Call name="addBean"> <Call name="addBean">
<Arg> <Arg>
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager"> <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts"> <Set name="contexts">
<Ref id="Contexts" /> <Ref refid="Contexts" />
</Set> </Set>
<Call name="setContextAttribute"> <Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg> <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/servlet-api-[^/]*\.jar$</Arg> <Arg>.*/servlet-api-[^/]*\.jar$</Arg>
</Call> </Call>
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDirName"><Property name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">0</Set>
</New>
</Arg>
</Call>
<!-- Add a customize step to the deployment lifecycle --> <!-- Add a customize step to the deployment lifecycle -->
<!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
@ -190,15 +144,4 @@
</Arg> </Arg>
</Call> </Call>
<Ref id="DeploymentManager">
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDirName"><SystemProperty name="jetty.home" default="."/>/contexts</Set>
<Set name="scanInterval">0</Set>
</New>
</Arg>
</Call>
</Ref>
</Configure> </Configure>

View File

@ -40,10 +40,13 @@
<dependency org="org.eclipse.jetty" name="jetty-security" rev="${/org.eclipse.jetty/jetty-security}" conf="jetty"/> <dependency org="org.eclipse.jetty" name="jetty-security" rev="${/org.eclipse.jetty/jetty-security}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-server" rev="${/org.eclipse.jetty/jetty-server}" conf="jetty"/> <dependency org="org.eclipse.jetty" name="jetty-server" rev="${/org.eclipse.jetty/jetty-server}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-servlet" rev="${/org.eclipse.jetty/jetty-servlet}" conf="jetty"/> <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="${/org.eclipse.jetty/jetty-servlet}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-servlets" rev="${/org.eclipse.jetty/jetty-servlets}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-util" rev="${/org.eclipse.jetty/jetty-util}" conf="jetty"/> <dependency org="org.eclipse.jetty" name="jetty-util" rev="${/org.eclipse.jetty/jetty-util}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-webapp" rev="${/org.eclipse.jetty/jetty-webapp}" conf="jetty"/> <dependency org="org.eclipse.jetty" name="jetty-webapp" rev="${/org.eclipse.jetty/jetty-webapp}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-xml" rev="${/org.eclipse.jetty/jetty-xml}" conf="jetty"/> <dependency org="org.eclipse.jetty" name="jetty-xml" rev="${/org.eclipse.jetty/jetty-xml}" conf="jetty"/>
<dependency org="javax.servlet" name="javax.servlet-api" rev="${/javax.servlet/javax.servlet-api}" conf="jetty"/>
<dependency org="org.eclipse.jetty" name="jetty-start" rev="${/org.eclipse.jetty/jetty-start}" conf="start"/> <dependency org="org.eclipse.jetty" name="jetty-start" rev="${/org.eclipse.jetty/jetty-start}" conf="start"/>
<dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="${/org.eclipse.jetty.orbit/javax.servlet}" conf="servlet"> <dependency org="org.eclipse.jetty.orbit" name="javax.servlet" rev="${/org.eclipse.jetty.orbit/javax.servlet}" conf="servlet">

View File

@ -0,0 +1,26 @@
#
# Jetty HTTP Connector
#
[depend]
server
[xml]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
etc/jetty-http.xml

View File

@ -0,0 +1,36 @@
#
# Jetty HTTPS Connector
#
[depend]
ssl
[xml]
etc/jetty-https.xml
[ini-template]
## HTTPS Configuration
# HTTP port to listen on
https.port=8443
# HTTPS idle timeout in milliseconds
https.timeout=30000
# HTTPS Socket.soLingerTime in seconds. (-1 to disable)
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
https.soLingerTime=-1

View File

@ -0,0 +1,33 @@
#
# Base Server Module
#
[optional]
jvm
ext
resources
[lib]
lib/*.jar
lib/ext/*.jar
resources/
[xml]
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
etc/jetty.xml

View File

@ -0,0 +1,57 @@
#
# SSL Keystore module
#
[depend]
server
[xml]
etc/jetty-ssl.xml
[files]
http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore|etc/keystore
[ini-template]
### SSL Keystore Configuration
# define the port to use for secure redirection
jetty.secure.port=8443
## Setup a demonstration keystore and truststore
jetty.keystore=etc/keystore
jetty.truststore=etc/keystore
## Set the demonstration passwords.
## Note that OBF passwords are not secure, just protected from casual observation
## See http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html
jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
### Set the client auth behavior
## Set to true if client certificate authentication is required
# jetty.ssl.needClientAuth=true
## Set to true if client certificate authentication is desired
# jetty.ssl.wantClientAuth=true
## Parameters to control the number and priority of acceptors and selectors
# ssl.selectors=1
# ssl.acceptors=1
# ssl.selectorPriorityDelta=0
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
ssl.acceptorPriorityDelta=0

View File

@ -0,0 +1,18 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog

11
solr/server/start.ini Normal file
View File

@ -0,0 +1,11 @@
--module=http
jetty.port=8983
jetty.threads.min=10
jetty.threads.max=10000
jetty.threads.idle.timeout=50000
# jetty.http.acceptors=1
# jetty.http.selectors=1

View File

@ -18,8 +18,9 @@
package org.apache.solr.client.solrj; package org.apache.solr.client.solrj;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
/** /**
@ -32,9 +33,9 @@ public class StartSolrJetty
//System.setProperty("solr.solr.home", "../../../example/solr"); //System.setProperty("solr.solr.home", "../../../example/solr");
Server server = new Server(); Server server = new Server();
SocketConnector connector = new SocketConnector(); ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
// Set some timeout options to make debugging easier. // Set some timeout options to make debugging easier.
connector.setMaxIdleTime(1000 * 60 * 60); connector.setIdleTimeout(1000 * 60 * 60);
connector.setSoLingerTime(-1); connector.setSoLingerTime(-1);
connector.setPort(8983); connector.setPort(8983);
server.setConnectors(new Connector[] { connector }); server.setConnectors(new Connector[] { connector });

View File

@ -28,8 +28,9 @@ import org.apache.solr.SolrJettyTestBase;
import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.util.ExternalPaths; import org.apache.solr.util.ExternalPaths;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.session.HashSessionIdManager; import org.eclipse.jetty.server.session.HashSessionIdManager;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.Rule; import org.junit.Rule;
@ -71,8 +72,8 @@ public class JettyWebappTest extends SolrTestCaseJ4
server.setSessionIdManager(new HashSessionIdManager(new Random(random().nextLong()))); server.setSessionIdManager(new HashSessionIdManager(new Random(random().nextLong())));
new WebAppContext(server, path, context ); new WebAppContext(server, path, context );
SocketConnector connector = new SocketConnector(); ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
connector.setMaxIdleTime(1000 * 60 * 60); connector.setIdleTimeout(1000 * 60 * 60);
connector.setSoLingerTime(-1); connector.setSoLingerTime(-1);
connector.setPort(0); connector.setPort(0);
server.setConnectors(new Connector[]{connector}); server.setConnectors(new Connector[]{connector});