View Javadoc

1   package com.atlassian.plugins.rest.sample.expansion.resource;
2   
3   import javax.ws.rs.Consumes;
4   import javax.ws.rs.GET;
5   import javax.ws.rs.Path;
6   import javax.ws.rs.Produces;
7   import javax.ws.rs.core.Context;
8   import javax.ws.rs.core.Response;
9   import javax.ws.rs.core.UriInfo;
10  
11  import static com.atlassian.plugins.rest.sample.expansion.resource.PlayerResource.getPlayerUriBuilder;
12  import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
13  import static javax.ws.rs.core.MediaType.APPLICATION_XML;
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      @Context
23      private UriInfo uriInfo;
24  
25      @GET
26      public Response getGame() {
27          return Response.ok(DataStore.getInstance().getGame("rugby", getPlayerUriBuilder(uriInfo))).build();
28      }
29  }