Class JaxrsItemStoreResource


  • @Path("items")
    public class JaxrsItemStoreResource
    extends Object
    A resource for storing named items.
    Author:
    Marek Potociar
    • Constructor Detail

      • JaxrsItemStoreResource

        public JaxrsItemStoreResource()
    • Method Detail

      • listItems

        @GET
        @Produces("text/plain")
        public String listItems()
        List all stored items.
        Returns:
        list of all stored items.
      • processCommand

        @POST
        @Path("commands")
        public String processCommand​(String command)
        Receive & process commands sent by the test client that control the internal resource state.

        Following is the list of recognized commands:

        • disconnect - disconnect all registered event streams.
        • reconnect now - enable client reconnecting.
        • reconnect <seconds> - disable client reconnecting. Reconnecting clients will receive a HTTP 503 response with "Retry-After" set to the amount of milliseconds specified.
        Parameters:
        command - command to be processed.
        Returns:
        message about processing result.
        Throws:
        BadRequestException - in case the command is not recognized or not specified.
      • addItem

        @POST
        public void addItem​(@FormParam("name")
                            String name)
        Add new item to the item store.

        Invoking this method will fire 2 new SSE events - 1st about newly added item and 2nd about the new item store size.

        Parameters:
        name - item name.