Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of WebSockets POC into Helidon 2.0 #1280

Merged
merged 38 commits into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
302cd1e
Initial integration of Tyrus integration POC into 2.0 branch.
spericas Jan 7, 2020
0d6080d
Merge branch 'master' into websockets20
spericas Jan 8, 2020
423a91e
Moved new dependencies to parent POM, fixed copyright and checkstyle …
spericas Jan 8, 2020
0b71781
Some changes to the webserver engine to handle websocket connections.
spericas Jan 8, 2020
467059e
Fixed copyright and checkstyle.
spericas Jan 8, 2020
c34dce5
A few more copyright fixes.
spericas Jan 8, 2020
d19f47d
Spotbugs fix.
spericas Jan 8, 2020
37a0de2
Moving up to WebSockets API 1.1.2.
spericas Jan 8, 2020
938d6f8
Created base class for tests. Improved testing for EchoService.
spericas Jan 9, 2020
0771410
Basic support for WebSocket programmatic API. New and improved testin…
spericas Jan 10, 2020
7e0d81d
New routing tests. Some additional changes to test framework.
spericas Jan 10, 2020
7c50794
Filter out any flush buffers in the count.
spericas Jan 13, 2020
30dcb6b
Merging with master for PR 1259.
spericas Jan 14, 2020
989d881
Initial work to support WebSocket in Helidon MP.
spericas Jan 17, 2020
ccbda1e
Tyrus component provider to integrate with CDI. Changes to JerseySupp…
spericas Jan 22, 2020
507c2df
Support for scanning programmatic endpoints and applications. Allow @…
spericas Jan 23, 2020
89c7f69
Testing websocket applications and programmatic endpoints.
spericas Jan 23, 2020
7345fc9
Extended server builder to allow manually setting a websocket applica…
spericas Jan 23, 2020
af077c6
New MP example that uses REST and WebSockets. Some other minor changes.
spericas Jan 24, 2020
0f2693f
Fixed copyright problems.
spericas Jan 27, 2020
f3d456a
Make @ServerEndpoint annotation a bean-defining annotation in CDI so …
spericas Jan 27, 2020
1e343ec
New Helidon SE example that uses the WebSocket programmatic API.
spericas Jan 28, 2020
8c4a878
Merging with master.
spericas Jan 28, 2020
4ea25ce
Initial doc for websocket support in Helidon SE and MP.
spericas Jan 29, 2020
d6e23e8
Fixed copyright.
spericas Jan 29, 2020
22865ca
Dropped support @ApplicationPath on websocket classes in favor of @Ro…
spericas Jan 30, 2020
71e4f44
Initial support for executor services in Helidon MP. In MP, websocket…
spericas Jan 30, 2020
70e696e
Updated tests to verify threads in which endpoint methods are called.
spericas Jan 31, 2020
0d0e215
Updated docs explaining websocket threading model for SE and MP.
spericas Jan 31, 2020
3e2d786
Minor improvements and fixes to logging calls.
spericas Feb 4, 2020
0f9a2f5
Ensure Netty's thread is not blocked when setting up a connection in MP.
spericas Feb 4, 2020
0953488
Fixed checkstyle.
spericas Feb 4, 2020
946db23
Re-shuffled code to remove dependency with websockets API and Tyrus i…
spericas Feb 5, 2020
363e5b9
Dropped support for websockets in Server.Builder. Created subclass fo…
spericas Feb 6, 2020
8f6051e
Fixed spotbugs error.
spericas Feb 6, 2020
3d874d6
Removed unused method and updated docs.
spericas Feb 7, 2020
9515f52
Removed unused class.
spericas Feb 7, 2020
1456226
Renamed module from tyrus to websocket. Restored transitive dependenc…
spericas Feb 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
<artifactId>helidon-webserver-test-support</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.webserver</groupId>
<artifactId>helidon-webserver-tyrus</artifactId>
<version>${helidon.version}</version>
</dependency>
<!-- Helidon Jersey -->
<dependency>
<groupId>io.helidon.jersey</groupId>
Expand Down Expand Up @@ -421,6 +426,11 @@
<artifactId>helidon-microprofile-access-log</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.microprofile.websocket</groupId>
<artifactId>helidon-microprofile-websocket</artifactId>
<version>${helidon.version}</version>
</dependency>
<!-- metrics -->
<dependency>
<groupId>io.helidon.metrics</groupId>
Expand Down
33 changes: 32 additions & 1 deletion common/http/src/main/java/io/helidon/common/http/DataChunk.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,8 @@
package io.helidon.common.http;

import java.nio.ByteBuffer;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

/**
* The DataChunk represents a part of the HTTP body content.
Expand Down Expand Up @@ -105,6 +107,7 @@ static DataChunk create(boolean flush, ByteBuffer data, Runnable releaseCallback
static DataChunk create(boolean flush, ByteBuffer data, Runnable releaseCallback, boolean readOnly) {
return new DataChunk() {
private boolean isReleased = false;
private CompletableFuture<DataChunk> writeFuture;

@Override
public ByteBuffer data() {
Expand All @@ -131,6 +134,16 @@ public boolean isReleased() {
public boolean isReadOnly() {
return readOnly;
}

@Override
public void writeFuture(CompletableFuture<DataChunk> writeFuture) {
this.writeFuture = writeFuture;
}

@Override
public Optional<CompletableFuture<DataChunk>> writeFuture() {
return Optional.ofNullable(writeFuture);
}
};
}

Expand Down Expand Up @@ -259,4 +272,22 @@ default boolean isReadOnly() {
default boolean isFlushChunk() {
return flush() && data().limit() == 0;
}

/**
* Set a write future that will complete when data chunk has been
* written to a connection.
*
* @param writeFuture Write future.
*/
default void writeFuture(CompletableFuture<DataChunk> writeFuture) {
}

/**
* Returns a write future associated with this chunk.
*
* @return Write future if one has ben set.
*/
default Optional<CompletableFuture<DataChunk>> writeFuture() {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -47,7 +47,9 @@ public void testBasic() {
printer.close();
assertThat(subscriber.isComplete(), is(equalTo(true)));
assertThat(subscriber.getLastError(), is(nullValue()));
assertThat(subscriber.getItems().size(),is(equalTo(1)));
// Filter out any OutputStreamPublisher#FLUSH_BUFFER
long size = subscriber.getItems().stream().filter(b -> b.capacity() > 0).count();
assertThat(size, is(equalTo(1L)));
ByteBuffer bb = subscriber.getItems().get(0);
assertThat(new String(bb.array()), is(equalTo("foo")));
}
Expand Down
29 changes: 26 additions & 3 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<version.lib.el-api>3.0.0</version.lib.el-api>
<version.lib.el-impl>3.0.0</version.lib.el-impl>
<version.lib.etcd4j>2.17.0</version.lib.etcd4j>
<version.lib.failsafe>2.3.1</version.lib.failsafe>
<version.lib.google-api-client>1.30.5</version.lib.google-api-client>
<version.lib.graalvm>19.2.0</version.lib.graalvm>
<version.lib.grpc>1.25.0</version.lib.grpc>
Expand All @@ -54,6 +55,7 @@
<version.lib.hamcrest>1.3</version.lib.hamcrest>
<version.lib.hibernate>5.4.4.Final</version.lib.hibernate>
<version.lib.hikaricp>3.4.1</version.lib.hikaricp>
<version.lib.hystrix>1.5.18</version.lib.hystrix>
<version.lib.inject>1</version.lib.inject>
<version.lib.interceptor-api>1.2.2</version.lib.interceptor-api>
<version.lib.jackson>2.10.0</version.lib.jackson>
Expand Down Expand Up @@ -97,12 +99,13 @@
<version.lib.snakeyaml>1.24</version.lib.snakeyaml>
<version.lib.transaction-api>1.2</version.lib.transaction-api>
<version.lib.typesafe-config>1.4.0</version.lib.typesafe-config>
<version.lib.tyrus>1.15</version.lib.tyrus>
<version.lib.ucp>19.3.0.0</version.lib.ucp>
<version.lib.validation-api>2.0.1.Final</version.lib.validation-api>
<version.lib.zipkin>2.12.0</version.lib.zipkin>
<version.lib.hystrix>1.5.18</version.lib.hystrix>
<version.lib.failsafe>2.3.1</version.lib.failsafe>
<version.lib.websockets-api>1.1.2</version.lib.websockets-api>
<version.lib.weld>3.1.1.Final</version.lib.weld>
<version.lib.yasson>1.0.6</version.lib.yasson>
<version.lib.zipkin>2.12.0</version.lib.zipkin>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -346,6 +349,26 @@
<artifactId>reactive-streams</artifactId>
<version>${version.lib.reactivestreams}</version>
</dependency>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>${version.lib.websockets-api}</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-core</artifactId>
<version>${version.lib.tyrus}</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-client</artifactId>
<version>${version.lib.tyrus}</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-server</artifactId>
<version>${version.lib.tyrus}</version>
</dependency>

<!-- Security related -->
<dependency>
Expand Down
Loading