use of ee.jakarta.tck.ws.rs.common.impl.SinglevaluedMap in project jaxrs-api by eclipse-ee4j.
the class MediaTypeResource method sendMap.
@GET
@Path("map")
@Produces(MediaType.SERVER_SENT_EVENTS)
public void sendMap(@Context SseEventSink sink, @Context Sse sse) {
try (SseEventSink s = sink) {
SinglevaluedMap<String, String> map = new SinglevaluedMap<>();
map.add("key", SSEMessage.MESSAGE);
s.send(sse.newEventBuilder().data(map).mediaType(mediaType).build());
}
}
use of ee.jakarta.tck.ws.rs.common.impl.SinglevaluedMap in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method replaceAllTest.
/*
* @testName: replaceAllTest
*
* @assertion_ids: JAXRS:JAVADOC:883;
*
* @test_Strategy: Replaces all existing headers with the newly supplied
* headers.
*/
@Test
public void replaceAllTest() throws Fault {
String[] headers = { "header1", "header2", "header3" };
String header99 = "header99";
MultivaluedMap<String, Object> mv = new SinglevaluedMap<String, Object>();
mv.add(header99, header99);
Response response = Response.ok().header(headers[0], headers[0]).header(headers[1], headers[1]).header(headers[2], headers[2]).replaceAll(mv).build();
for (String header : headers) assertTrue(response.getHeaderString(header) == null, "response contains non replaced header" + header);
assertTrue(response.getHeaderString(header99).equals(header99), "response does not contain header from replacedAll map" + header99);
}
use of ee.jakarta.tck.ws.rs.common.impl.SinglevaluedMap in project jaxrs-api by eclipse-ee4j.
the class MBWCheckResource method sendMultivaluedMap.
@GET
@Path("multivaluedmap")
@Produces(MediaType.SERVER_SENT_EVENTS)
public void sendMultivaluedMap(@Context SseEventSink sink, @Context Sse sse) {
try (SseEventSink s = sink) {
SinglevaluedMap<String, String> map = new SinglevaluedMap<>();
map.add("name", MESSAGE);
s.send(sse.newEventBuilder().data(map).mediaType(MediaType.APPLICATION_FORM_URLENCODED_TYPE).build());
}
}
Aggregations