diff options
Diffstat (limited to 'src/main/java/com/juick/www/api/Service.java')
-rw-r--r-- | src/main/java/com/juick/www/api/Service.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/juick/www/api/Service.java b/src/main/java/com/juick/www/api/Service.java index 41fdcfbf..ed6699d2 100644 --- a/src/main/java/com/juick/www/api/Service.java +++ b/src/main/java/com/juick/www/api/Service.java @@ -37,6 +37,7 @@ import jakarta.mail.internet.AddressException; import jakarta.mail.internet.InternetAddress; import jakarta.mail.internet.MimeMessage; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; @@ -53,7 +54,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.async.AsyncRequestTimeoutException; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -221,7 +222,8 @@ public class Service { } @GetMapping("/api/events") - public SseEmitter handle(@Parameter(hidden = true) User visitor) { + public SseEmitter handle(@Parameter(hidden = true) User visitor, HttpServletResponse response) { + response.addHeader("X-Accel-Buffering", "no"); logger.info("{} connected", visitor.getName()); if (!visitor.isAnonymous()) { userService.updateLastSeen(visitor); |