@Path(value="items") public class ItemStoreResource extends Object
| Constructor and Description |
|---|
ItemStoreResource() |
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(String name)
Add new item to the item store.
|
EventOutput |
itemEvents(int lastEventId)
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)
command - command to be processed.javax.ws.rs.BadRequestException - in case the command is not recognized or not specified.@GET @Path(value="events") @Produces(value="text/event-stream") public EventOutput itemEvents(@HeaderParam(value="Last-Event-ID") @DefaultValue(value="-1") int lastEventId)
lastEventId - Value of custom SSE HTTP header.
Defaults to -1 if not set.javax.ws.rs.InternalServerErrorException - in case replaying missed events to the reconnected output stream fails.javax.ws.rs.ServiceUnavailableException - in case the reconnect delay is set to a positive value.@POST
public void addItem(@FormParam(value="name")
String name)
name - item name.Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.