|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.glassfish.jersey.examples.sseitemstore.ItemStoreResource
@Path(value="items") public class ItemStoreResource
A resource for storing named items.
| Constructor Summary | |
|---|---|
ItemStoreResource()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ItemStoreResource()
| Method Detail |
|---|
@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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||