View Javadoc

1   package com.atlassian.plugins.rest.sample.expansion.resource;
2   
3   import static com.atlassian.plugins.rest.sample.expansion.resource.PlayerResource.getPlayerUriBuilder;
4   
5   import javax.ws.rs.Consumes;
6   import javax.ws.rs.GET;
7   import javax.ws.rs.Path;
8   import javax.ws.rs.Produces;
9   import javax.ws.rs.core.Context;
10  import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
11  import static javax.ws.rs.core.MediaType.APPLICATION_XML;
12  import javax.ws.rs.core.Response;
13  import javax.ws.rs.core.UriInfo;
14  
15  /**
16   * Resource representing a Game such as Rugby, Football (and I mean soccer), etc.
17   */
18  @Path("/game")
19  @Consumes({APPLICATION_XML, APPLICATION_JSON})
20  @Produces({APPLICATION_XML, APPLICATION_JSON})
21  public class GameResource
22  {
23      @Context
24      private UriInfo uriInfo;
25  
26      @GET
27      public Response getGame()
28      {
29          return Response.ok(DataStore.getInstance().getGame("rugby", getPlayerUriBuilder(uriInfo))).build();
30      }
31  }