I have an application where I don't want to use CORS so I used the answer to this question: How to handle CORS using JAX-RS with Jersey
This works fine for default GET/POST.. etc.
Now I want to use server side events but I'm getting No 'Access-Control-Allow-Origin' header is present on the requested resource. on my front end page.
Using SSE in Jersey it forces me to use void in the method signature so I can't return a response. I think I need to somehow add this header to the preflight message. Unfortunately I don't know how to do so.
My SSE method signature:
@GET
@Produces(MediaType.SERVER_SENT_EVENTS)
public void subscribe(@Context SseEventSink eventSink, @Context Sse sse)
How do I make this endpoint return Access-Control-Allow-Origin: *?