Browse Source

Fix broken link for Server-Sent Events

Signed-off-by: Taeik Lim <sibera21@gmail.com>
Closes gh-34705
pull/34732/head
Taeik Lim 9 months ago committed by Sébastien Deleuze
parent
commit
a946fe2bf8
  1. 2
      framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc
  2. 2
      framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-async.adoc
  3. 4
      spring-web/src/main/java/org/springframework/http/MediaType.java
  4. 4
      spring-web/src/main/java/org/springframework/http/codec/ServerSentEvent.java
  5. 4
      spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java
  6. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java
  7. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/function/SseServerResponse.java
  8. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SseEmitter.java
  9. 4
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java

2
framework-docs/modules/ROOT/pages/web/webmvc-functional.adoc

@ -276,7 +276,7 @@ ServerResponse.async(asyncResponse); @@ -276,7 +276,7 @@ ServerResponse.async(asyncResponse);
----
======
https://www.w3.org/TR/eventsource/[Server-Sent Events] can be provided via the
https://html.spec.whatwg.org/multipage/server-sent-events.html[Server-Sent Events] can be provided via the
static `sse` method on `ServerResponse`. The builder provided by that method
allows you to send Strings, or other objects as JSON. For example:

2
framework-docs/modules/ROOT/pages/web/webmvc/mvc-ann-async.adoc

@ -281,7 +281,7 @@ invokes the configured exception resolvers and completes the request. @@ -281,7 +281,7 @@ invokes the configured exception resolvers and completes the request.
=== SSE
`SseEmitter` (a subclass of `ResponseBodyEmitter`) provides support for
https://www.w3.org/TR/eventsource/[Server-Sent Events], where events sent from the server
https://html.spec.whatwg.org/multipage/server-sent-events.html[Server-Sent Events], where events sent from the server
are formatted according to the W3C SSE specification. To produce an SSE
stream from a controller, return `SseEmitter`, as the following example shows:

4
spring-web/src/main/java/org/springframework/http/MediaType.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -395,7 +395,7 @@ public class MediaType extends MimeType implements Serializable { @@ -395,7 +395,7 @@ public class MediaType extends MimeType implements Serializable {
/**
* Public constant media type for {@code text/event-stream}.
* @since 4.3.6
* @see <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events W3C recommendation</a>
* @see <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>
*/
public static final MediaType TEXT_EVENT_STREAM;

4
spring-web/src/main/java/org/springframework/http/codec/ServerSentEvent.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -32,7 +32,7 @@ import org.springframework.util.StringUtils; @@ -32,7 +32,7 @@ import org.springframework.util.StringUtils;
* @since 5.0
* @param <T> the type of data that this event contains
* @see ServerSentEventHttpMessageWriter
* @see <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events W3C recommendation</a>
* @see <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>
*/
public final class ServerSentEvent<T> {

4
spring-webflux/src/main/java/org/springframework/web/reactive/function/BodyInserters.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -262,7 +262,7 @@ public abstract class BodyInserters { @@ -262,7 +262,7 @@ public abstract class BodyInserters {
* @param eventsPublisher the {@code ServerSentEvent} publisher to write to the response body
* @param <T> the type of the data elements in the {@link ServerSentEvent}
* @return the inserter to write a {@code ServerSentEvent} publisher
* @see <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events W3C recommendation</a>
* @see <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>
*/
// Parameterized for server-side use
public static <T, S extends Publisher<ServerSentEvent<T>>> BodyInserter<S, ServerHttpResponse> fromServerSentEvents(

6
spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -293,7 +293,7 @@ public interface ServerResponse { @@ -293,7 +293,7 @@ public interface ServerResponse {
* @param consumer consumer that will be provided with an event builder
* @return the server-side event response
* @since 5.3.2
* @see <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events</a>
* @see <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>
*/
static ServerResponse sse(Consumer<SseBuilder> consumer) {
return SseServerResponse.create(consumer, null);
@ -323,7 +323,7 @@ public interface ServerResponse { @@ -323,7 +323,7 @@ public interface ServerResponse {
* @param timeout maximum time period to wait before timing out
* @return the server-side event response
* @since 5.3.2
* @see <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events</a>
* @see <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>
*/
static ServerResponse sse(Consumer<SseBuilder> consumer, Duration timeout) {
return SseServerResponse.create(consumer, timeout);

2
spring-webmvc/src/main/java/org/springframework/web/servlet/function/SseServerResponse.java

@ -46,7 +46,7 @@ import org.springframework.web.servlet.ModelAndView; @@ -46,7 +46,7 @@ import org.springframework.web.servlet.ModelAndView;
/**
* Implementation of {@link ServerResponse} for sending
* <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events</a>.
* <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>.
*
* @author Arjen Poutsma
* @author Sebastien Deleuze

4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SseEmitter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.web.servlet.ModelAndView; @@ -34,7 +34,7 @@ import org.springframework.web.servlet.ModelAndView;
/**
* A specialization of {@link ResponseBodyEmitter} for sending
* <a href="https://www.w3.org/TR/eventsource/">Server-Sent Events</a>.
* <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller

4
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/handler/EventSourceTransportHandler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,7 +31,7 @@ import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSe @@ -31,7 +31,7 @@ import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSe
/**
* A TransportHandler for sending messages via Server-Sent Events:
* <a href="https://dev.w3.org/html5/eventsource/">https://dev.w3.org/html5/eventsource/</a>.
* <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html">Server-Sent Events</a>.
*
* @author Rossen Stoyanchev
* @since 4.0

Loading…
Cancel
Save