| Constructor and Description |
|---|
JaxrsItemStoreResource() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(String name)
Add new item to the item store.
|
void |
itemEvents(int lastEventId,
SseEventSink eventSink)
TODO - rewrite Connect or re-connect to SSE event stream.
|
String |
listItems()
List all stored items.
|
String |
processCommand(String command)
Receive & process commands sent by the test client that control the internal resource state.
|
@GET @Produces(value="text/plain") public String listItems()
@POST @Path(value="commands") public String processCommand(String command)
Following is the list of recognized commands:
command - command to be processed.BadRequestException - in case the command is not recognized or not specified.@GET @Path(value="events") @Produces(value="text/event-stream") public void itemEvents(@HeaderParam(value="Last-Event-ID") @DefaultValue(value="-1") int lastEventId, @Context SseEventSink eventSink)
lastEventId - Value of custom SSE HTTP header.
Defaults to -1 if not set.InternalServerErrorException - in case replaying missed events to the reconnected output stream fails.ServiceUnavailableException - in case the reconnect delay is set to a positive value.@POST public void addItem(@FormParam(value="name") String name)
Invoking this method will fire 2 new SSE events - 1st about newly added item and 2nd about the new item store size.
name - item name.Copyright © 2007-2019, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.