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

SSE API and implementation in Nima #6096

Merged
merged 24 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7032c24
Initial SSE prototype.
spericas Feb 2, 2023
f40dc2a
Added one more test.
spericas Feb 3, 2023
47b8524
Moved SSE prototype to new package. Updated and moved tests to corres…
spericas Feb 6, 2023
e9e0d6b
Restored changes to webserver package.
spericas Feb 6, 2023
7912615
Fixed copyright and checkstyle problems.
spericas Feb 6, 2023
08e9dfb
Integration with media types and MediaTypeSupport. Each SSE event can…
spericas Feb 7, 2023
3636074
Updated prototype to use a Sink SPI. Tests changed.
spericas Feb 8, 2023
08aac5b
Copyright and checkstyle.
spericas Feb 8, 2023
0be551b
Basic handling for sink events in ServerResponseBase class. Use singl…
spericas Feb 8, 2023
316ef4c
Use the event consumer to serialize event data.
spericas Feb 8, 2023
e73002e
Make Http1ServerResponse private again.
spericas Feb 8, 2023
1ff0312
Improved handling of content negotiation. Small tweak to SPI to acces…
spericas Feb 9, 2023
26b7ece
Basic support for SSE event comment/id. New tests.
spericas Feb 9, 2023
52f1f09
New SPI for handling sources in WebClient. Basic implementation for S…
spericas Feb 10, 2023
043638e
Improved client SSE stream parser with support for comments, events, …
spericas Feb 13, 2023
226d48e
Use try-with-resources to close reader.
spericas Feb 13, 2023
f6a8803
Renamed SSE common module. Incorporated additional feedback from the …
spericas Feb 14, 2023
569ef04
Use wildcards in SPI types. Renamed SourceHandler to SourceHandlerPro…
spericas Feb 14, 2023
b6ddb95
Fixed javadoc.
spericas Feb 14, 2023
4f7478a
Use equals to compare GenericType and make SseSource a functional int…
spericas Feb 23, 2023
4b5a220
Support for media context and media types in SSE sources and events. …
spericas Feb 23, 2023
1633b53
Some cleanup of SseEvent class and an additional test class that veri…
spericas Feb 24, 2023
64e1471
POM cleanup.
spericas Feb 24, 2023
235eb7d
Removed comment.
spericas Feb 24, 2023
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
15 changes: 15 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,21 @@
<artifactId>helidon-nima-websocket-client</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.nima.sse</groupId>
<artifactId>helidon-nima-sse</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.nima.sse</groupId>
<artifactId>helidon-nima-sse-webclient</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.nima.sse</groupId>
<artifactId>helidon-nima-sse-webserver</artifactId>
<version>${helidon.version}</version>
</dependency>
<dependency>
<groupId>io.helidon.nima.testing.junit5</groupId>
<artifactId>helidon-nima-testing-junit5-webserver</artifactId>
Expand Down
12 changes: 11 additions & 1 deletion common/http/src/main/java/io/helidon/common/http/Http.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022 Oracle and/or its affiliates.
* Copyright (c) 2018, 2023 Oracle and/or its affiliates.
*
* 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 @@ -1596,6 +1596,12 @@ public static final class HeaderValues {
*/
public static final HeaderValue CONTENT_TYPE_OCTET_STREAM = Header.createCached(Header.CONTENT_TYPE,
"application/octet-stream");
/**
* Content type SSE event stream.
*/
public static final HeaderValue CONTENT_TYPE_EVENT_STREAM = Header.createCached(Header.CONTENT_TYPE,
"text/event-stream");

/**
* Accept application/json.
*/
Expand All @@ -1604,6 +1610,10 @@ public static final class HeaderValues {
* Accept text/plain with UTF-8.
*/
public static final HeaderValue ACCEPT_TEXT = Header.createCached(Header.ACCEPT, "text/plain;charset=UTF-8");
/**
* Accept text/event-stream.
*/
public static final HeaderValue ACCEPT_EVENT_STREAM = Header.createCached(Header.ACCEPT, "text/event-stream");
/**
* Expect 100 header.
*/
Expand Down
3 changes: 2 additions & 1 deletion nima/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.

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 @@ -42,6 +42,7 @@
<module>webclient</module>
<module>webserver</module>
<module>http2</module>
<module>sse</module>
<module>websocket</module>
<module>grpc</module>
<module>observe</module>
Expand Down
5 changes: 5 additions & 0 deletions nima/sse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SSE
---

Server sent events implementation in Nima.

44 changes: 44 additions & 0 deletions nima/sse/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2023 Oracle and/or its affiliates.

Licensed 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.

-->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.helidon.nima</groupId>
<artifactId>helidon-nima-project</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>io.helidon.nima.sse</groupId>
<artifactId>helidon-nima-sse-project</artifactId>
<name>Helidon Níma SSE Project</name>

<packaging>pom</packaging>

<modules>
<module>sse</module>
<module>webclient</module>
<module>webserver</module>
</modules>

</project>
59 changes: 59 additions & 0 deletions nima/sse/sse/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023 Oracle and/or its affiliates.

Licensed 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.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.helidon.nima.sse</groupId>
<artifactId>helidon-nima-sse-project</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>helidon-nima-sse</artifactId>
<name>Helidon Níma SSE</name>

<dependencies>
<dependency>
<groupId>io.helidon.common</groupId>
<artifactId>helidon-common</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.common</groupId>
<artifactId>helidon-common-media-type</artifactId>
</dependency>
<dependency>
<groupId>io.helidon.nima.http.media</groupId>
<artifactId>helidon-nima-http-media</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading