@POST
  @Path("/item/{thing}")
  @Consumes({"text/plain", "application/json"})
  @Produces({"text/plain", "application/json"})
  public Response setFavoriteItem(@Context HttpHeaders headers, @Context UriInfo ui,
                            @PathParam("thing") String thing) {
                            
    context.putInstanceData(INSTANCE_ITEM, thing);
    
    StringBuffer buf = new StringBuffer();
    buf.append("{\"item\" : \"");
    buf.append(thing);
    buf.append("\"}");

    return Response.ok(buf.toString()).build();
  }
Handles: POST /item/{thing}.

@param headers   http headers
@param ui        uri info

@return favorite item representation
ambari-views/examples/favorite-view/src/main/java/org/apache/ambari/view/favorite/FavoriteService.java