Search in sources :

Example 1 with JaxbKeyValueBean

use of ee.jakarta.tck.ws.rs.common.impl.JaxbKeyValueBean in project jaxrs-api by eclipse-ee4j.

the class MediaTypeResource method sendXML.

@GET
@Path("xml")
@Produces(MediaType.SERVER_SENT_EVENTS)
public void sendXML(@Context SseEventSink sink, @Context Sse sse) {
    try (SseEventSink s = sink) {
        JaxbKeyValueBean bean = new JaxbKeyValueBean();
        bean.set("key", SSEMessage.MESSAGE);
        s.send(sse.newEventBuilder().data(bean).mediaType(mediaType).build());
    }
}
Also used : SseEventSink(jakarta.ws.rs.sse.SseEventSink) JaxbKeyValueBean(ee.jakarta.tck.ws.rs.common.impl.JaxbKeyValueBean) Path(jakarta.ws.rs.Path) Produces(jakarta.ws.rs.Produces) GET(jakarta.ws.rs.GET)

Aggregations

JaxbKeyValueBean (ee.jakarta.tck.ws.rs.common.impl.JaxbKeyValueBean)1 GET (jakarta.ws.rs.GET)1 Path (jakarta.ws.rs.Path)1 Produces (jakarta.ws.rs.Produces)1 SseEventSink (jakarta.ws.rs.sse.SseEventSink)1