Merge branch 'jetty-9.4.x' of github.com:eclipse/jetty.project into jetty-9.4.x

This commit is contained in:
Greg Wilkins 2017-03-10 09:31:52 +11:00
commit b747b7fb2f
8 changed files with 89 additions and 66 deletions

View File

@ -18,6 +18,8 @@
package org.eclipse.jetty.client;
import static org.hamcrest.CoreMatchers.instanceOf;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@ -47,10 +49,15 @@ import org.eclipse.jetty.util.Fields;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class HttpClientURITest extends AbstractHttpClientServerTest
{
@Rule
public ExpectedException expectedException = ExpectedException.none();
public HttpClientURITest(SslContextFactory sslContextFactory)
{
super(sslContextFactory);
@ -74,14 +81,15 @@ public class HttpClientURITest extends AbstractHttpClientServerTest
Assert.assertEquals(HttpStatus.OK_200, request.send().getStatus());
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testIDNHost() throws Exception
{
startClient();
expectedException.expect(IllegalArgumentException.class);
client.newRequest(scheme + "://пример.рф"); // example.com-like host in IDN domain
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testIDNRedirect() throws Exception
{
// Internationalized Domain Name.
@ -104,19 +112,12 @@ public class HttpClientURITest extends AbstractHttpClientServerTest
HttpField location = response.getHeaders().getField(HttpHeader.LOCATION);
Assert.assertEquals(incorrectlyDecoded, location.getValue());
try
{
client.newRequest("localhost", server.getLocalPort())
.timeout(5, TimeUnit.SECONDS)
.followRedirects(true)
.send();
}
catch (ExecutionException x)
{
Throwable cause = x.getCause();
if (cause instanceof IllegalArgumentException)
throw (IllegalArgumentException)cause;
}
expectedException.expect(ExecutionException.class);
expectedException.expectCause(instanceOf(IllegalArgumentException.class));
client.newRequest("localhost", server.getLocalPort())
.timeout(5, TimeUnit.SECONDS)
.followRedirects(true)
.send();
}
finally
{

View File

@ -26,11 +26,11 @@ $ java -jar ../start.jar --create-startd
INFO : Base directory was modified
$ java -jar ../start.jar --add-to-start=session-store-file
INFO : server initialised (transitively) in ${jetty.base}/start.d/server.ini
INFO : sessions initialised (transitively) in ${jetty.base}/start.d/sessions.ini
INFO : session-store-file initialised in ${jetty.base}/start.d/session-store-file.ini
MKDIR: ${jetty.base}/sessions
INFO : Base directory was modified
INFO : server transitively enabled, ini template available with --add-to-start=server
INFO : sessions transitively enabled, ini template available with --add-to-start=sessions
INFO : session-store-file initialized in ${jetty.base}/start.d/session-store-file.ini
MKDIR : ${jetty.base}/sessions
INFO : Base directory was modified
----
//TODO - Callout default Session file location - note it is configurable

View File

@ -39,12 +39,14 @@ The following 1 module(s):
+ http://www.apache.org/licenses/LICENSE-2.0.html
Proceed (y/N)? y
INFO : server initialised (transitively) in ${jetty.base}/start.d/server.ini
INFO : sessions initialised (transitively) in ${jetty.base}/start.d/sessions.ini
INFO : session-store-infinispan-remote initialised in ${jetty.base}/start.d/session-store-infinispan-remote.ini
DOWNLOAD: https://raw.githubusercontent.com/eclipse/jetty.project/master/jetty-infinispan/src/main/infinispan-resources/hotrod-client.properties?id=master to ${jetty.base}/resources/hotrod-client.properties
DOWNLOAD: http://central.maven.org/maven2/org/infinispan/infinispan-remote/7.1.1.Final/infinispan-remote-7.1.1.Final.jar to ${jetty.base}/lib/infinispan/infinispan-remote-7.1.1.Final.jar
INFO : Base directory was modified
INFO : server transitively enabled, ini template available with --add-to-start=server
INFO : sessions transitively enabled, ini template available with --add-to-start=sessions
INFO : session-store-infinispan-remote initialized in ${jetty.base}/start.d/session-store-infinispan-remote.ini
MKDIR : ${jetty.base}/lib/infinispan
DOWNLD: http://central.maven.org/maven2/org/infinispan/infinispan-remote/7.1.1.Final/infinispan-remote-7.1.1.Final.jar to ${jetty.base}/lib/infinispan/infinispan-remote-7.1.1.Final.jar
MKDIR : ${jetty.base}/resources
COPY : ${jetty.home}/modules/session-store-infinispan-remote/resources/hotrod-client.properties to ${jetty.base}/resources/hotrod-client.properties
INFO : Base directory was modified
----
Doing this enables the remote Infinispan Session module and any dependent modules or files needed for it to run on the server.

View File

@ -26,10 +26,11 @@ $ java -jar ../start.jar --create-startd
INFO : Base directory was modified
$ java -jar ../start.jar --add-to-start=session-store-jdbc
INFO : server initialised (transitively) in ${jetty.base}/start.d/server.ini
INFO : sessions initialised (transitively) in ${jetty.base}/start.d/sessions.ini
INFO : session-store-jdbc initialised in ${jetty.base}/start.d/session-store-jdbc.ini
INFO : Base directory was modified
INFO : server transitively enabled, ini template available with --add-to-start=server
INFO : sessions transitively enabled, ini template available with --add-to-start=sessions
INFO : sessions/jdbc/datasource dynamic dependency of session-store-jdbc
INFO : session-store-jdbc initialized in ${jetty.base}/start.d/session-store-jdbc.ini
INFO : Base directory was modified
----
Doing this enables the JDBC Session module and any dependent modules or files needed for it to run on the server.

View File

@ -39,11 +39,13 @@ The following 1 module(s):
+ http://www.apache.org/licenses/LICENSE-2.0.html
Proceed (y/N)? y
INFO : server initialised (transitively) in ${jetty.base}/start.d/server.ini
INFO : sessions initialised (transitively) in ${jetty.base}/start.d/sessions.ini
INFO : session-store-mongo initialised in ${jetty.base}/start.d/session-store-mongo.ini
DOWNLOAD: http://central.maven.org/maven2/org/mongodb/mongo-java-driver/2.6.1/mongo-java-driver-2.6.1.jar to ${jetty.base}/lib/nosql/mongo-java-driver-2.6.1.jar
INFO : Base directory was modified
INFO : server transitively enabled, ini template available with --add-to-start=server
INFO : sessions transitively enabled, ini template available with --add-to-start=sessions
INFO : session-store-mongo initialized in ${jetty.base}/start.d/session-store-mongo.ini
INFO : sessions/mongo/address dynamic dependency of session-store-mongo
MKDIR : ${jetty.base}/lib/nosql
DOWNLD: http://central.maven.org/maven2/org/mongodb/mongo-java-driver/2.13.2/mongo-java-driver-2.13.2.jar to ${jetty.base}/lib/nosql/mongo-java-driver-2.13.2.jar
INFO : Base directory was modified
----
Doing this enables the MongoDB Session module and any dependent modules or files needed for it to run on the server.
@ -70,18 +72,37 @@ Opening the `start.d/session-store-mongo.ini` will show a list of all the config
#jetty.session.mongo.dbName=HttpSessions
#jetty.session.mongo.collectionName=jettySessions
#jetty.session.gracePeriod.seconds=3600
connection-type=address
#jetty.session.mongo.host=localhost
#jetty.session.mongo.port=27017
#jetty.session.gracePeriod.seconds=3600
#connection-type=uri
#jetty.session.mongo.connectionString=mongodb://localhost
----
jetty.session.mongo.dbName::
Name of the database in Mongo used to store the Session collection.
jetty.session.mongo.collectionName::
Name of the collection in Mongo used to keep all of the Sessions.
jetty.session.mongo.host::
Host name or address for the remote Mongo instance.
jetty.session.mongo.port::
Port number for the remote Mongo instance.
jetty.session.gracePeriod.seconds::
Amount of time, in seconds, to wait for other nodes to be checked to verify an expired session is in fact expired throughout the cluster before closing it.
connection-type=address::
Used when utilizing a direct connection to the Mongo server.
jetty.session.mongo.host;;
Host name or address for the remote Mongo instance.
jetty.session.mongo.port;;
Port number for the remote Mongo instance.
connection-type=uri::
Used when utilizing MongoURI for secured connections.
jetty.session.mongo.connectionString;;
The string defining the MongoURI value, such as `mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]`.
More information on how to format the MongoURI string can be found in the https://docs.mongodb.com/manual/reference/connection-string/[official documentation for mongo.]
+
____
[NOTE]
You will only use *one* `connection-type` at a time, `address` or `uri`.
If both are utilized in your `session-store-mongo.ini`, only the last `connection-type` configured in the file will be used.
By default, the `connection-type` of `address` is used.
____

View File

@ -31,10 +31,10 @@ The following is the general process by which we operate.
Not everything is specifically relevant since we are at GitHub but the crux of things are detailed there.
The CLA is *critically* important to the process.
The ECA is *critically* important to the process.
[[contributing-cla]]
==== Sign a CLA
[[contributing-eca]]
==== Sign an Eclipse Contributor Agreement (ECA)
The Eclipse Foundation has a strong Intellectual Property policy which tracks contributions in detail to ensure that:
@ -42,12 +42,12 @@ The Eclipse Foundation has a strong Intellectual Property policy which tracks co
2. Does the contributor have the rights to contribute this content to Eclipse?
3. Is the contribution under the projects license(s) (e.g. EPL)
A contributor needs to e-sign a Contributor Licence Agreement (for more explanation see the http://www.eclipse.org/legal/clafaq.php[Eclipse CLA FAQ] ) regardless of how their contribution patch is provided.
A contributor needs to e-sign a Eclipse Contributor Agreement (for more explanation see the http://www.eclipse.org/legal/ecafaq.php[Eclipse ECA FAQ] ) regardless of how their contribution patch is provided.
You can familiarize yourself with the Eclipse wiki page at http://wiki.eclipse.org/Development_Resources/Contributing_via_Git[Contributing via Git].
In order to have a pull request accepted by any Eclipse project you must complete this agreement.
In order to have a pull request accepted by any Eclipse project you *must* complete this agreement.
____
[TIP]
Log into the https://projects.eclipse.org/user/login/sso[Eclipse projects forge] (you will need to create an account with the Eclipse Foundation if you have not already done so); click on "Contributor License Agreement"; and Complete the form.
Log into the https://www.eclipse.org[Eclipse home page] (you will need to create an account with the Eclipse Foundation if you have not already done so), click on "Eclipse ECA", and complete the form.
Be sure to use the _same email address_ when you create any Git commit records.
____
@ -60,13 +60,13 @@ Check out the following link:https://help.github.com/articles/setting-your-email
[[contributing-making-the-commit]]
==== Making the Commit
When making the commit for the pull request it is _vital_ that you "sign-off" on the commit using "git commit -s" option.
When making the commit for the pull request it is _vital_ that you "sign-off" on the commit using `git commit -s` option.
Without this sign-off, your patch cannot be applied to the Jetty repository because it will be rejected.
You can check out the link:https://help.github.com/articles/signing-tags-using-gpg[guide at Github] for more information.
____
[TIP]
One way to think of this is that when you sign the CLA you are indicating that you are free to contribute to eclipse, but that doesn't mean everything you ever do can be contributed.
One way to think of this is that when you sign the ECA you are indicating that you are free to contribute to eclipse, but that doesn't mean everything you ever do can be contributed.
Using the commit signing mechanism indicates that your commit is under the auspices of your agreement.
____
@ -74,9 +74,10 @@ If a pull request is for a particular issue in our repository then the format of
The message should follow the form "Issue #123 <description of the commit>".
When the Jetty project runs releases we have an automated process that scans for commits with this format for inclusion in our VERSION.txt file.
____
[source, screen]
----
> git commit -s -m "Issue #123 resolving the issue by adding widget"
____
----
[[contributing-the-pull-request]]
==== The Pull Request
@ -87,10 +88,11 @@ Pull requests are very much a GitHub process so best link:https://help.github.co
==== Our Policies
We wholeheartedly welcome contributions to Jetty and will do our best to process them in a timely fashion.
While not every contribution will be accepted as is our commitment is to work with interested parties on the things they care about.
With that in mind, short of some simple contributions we can only handle pull requests with actively engaged parties.
While not every contribution will be accepted, our commitment is to work with interested parties on the things they care about.
With that in mind, we can only handle pull requests with actively engaged parties.
We reserve the right to abandon pull requests whose authors do no respond in a timely fashion.
We will generally adhere to the following time frames for contributions.
We will generally adhere to the following time frames for contributions:
* Invalid Pull Requests - 1 week
** These pull requests do not follow the contribution requirements for some reason, be it missing contributor agreement or the wrong email.

View File

@ -14,7 +14,7 @@
<bundle-symbolic-name>${project.groupId}.boot.test.osgi</bundle-symbolic-name>
<jetty-orbit-url>http://download.eclipse.org/jetty/orbit/</jetty-orbit-url>
<assembly-directory>target/distribution</assembly-directory>
<exam.version>3.5.0</exam.version>
<exam.version>4.9.2</exam.version>
<url.version>1.5.2</url.version>
<injection.bundle.version>1.0</injection.bundle.version>
</properties>
@ -401,6 +401,8 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<!-- downgrading to version 2.18 here as there's a known JVM crash issue with the 2.19.x series -->
<version>2.18.1</version>
<configuration>
<!-- No point defining -Xbootclasspath as the actual OSGi VM is run as a forked process by pax-exam -->
<!-- But we do pass the sys property of the alpn-boot jar so that it can be configured inside tests -->

View File

@ -19,7 +19,6 @@
package org.eclipse.jetty.websocket.client;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
@ -106,7 +105,7 @@ public class ClientCloseTest
public void assertReceivedCloseEvent(int clientTimeoutMs, Matcher<Integer> statusCodeMatcher, Matcher<String> reasonMatcher)
throws InterruptedException
{
long maxTimeout = clientTimeoutMs * 2;
long maxTimeout = clientTimeoutMs * 4;
assertThat("Client Close Event Occurred",closeLatch.await(maxTimeout,TimeUnit.MILLISECONDS),is(true));
assertThat("Client Close Event Count",closeCount.get(),is(1));
@ -148,7 +147,7 @@ public class ClientCloseTest
@Override
public void onWebSocketError(Throwable cause)
{
LOG.debug("onWebSocketError",cause);
LOG.warn("onWebSocketError",cause);
assertThat("Unique Error Event", error.compareAndSet(null, cause), is(true));
errorLatch.countDown();
}
@ -401,16 +400,11 @@ public class ClientCloseTest
writeCount++;
writeSize += msg.length;
}
LOG.debug("Wrote {} frames totalling {} bytes of payload before congestion kicked in",writeCount,writeSize);
LOG.info("Wrote {} frames totalling {} bytes of payload before congestion kicked in",writeCount,writeSize);
// Verify that there are no errors
assertThat("Error events",clientSocket.error.get(),nullValue());
// client idle timeout triggers close event on client ws-endpoint
// client close event on ws-endpoint
clientSocket.assertReceivedCloseEvent(timeout,
anyOf(is(StatusCode.SHUTDOWN),is(StatusCode.ABNORMAL)),
anyOf(containsString("Timeout"),containsString("timeout"),containsString("Write")));
// Verify timeout error
assertThat("OnError Latch", clientSocket.errorLatch.await(2, TimeUnit.SECONDS), is(true));
assertThat("OnError", clientSocket.error.get(), instanceOf(SocketTimeoutException.class));
}
@Test