@Test public void testAbout() throws Exception { WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("timeline") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); TimelineWebServices.AboutInfo about = response.getEntity(TimelineWebServices.AboutInfo.class); Assert.assertNotNull(about); Assert.assertEquals("Timeline API", about.getAbout()); }
@GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("Timeline API"); }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("Timeline API"); } }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("Timeline API"); } @Inject  TimelineWebServices(TimelineDataManager timelineDataManager); }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("Timeline API"); } @Inject  TimelineWebServices(TimelineDataManager timelineDataManager); @GET @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) AboutInfo about(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res); @GET @Path("/{entityType}") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelineEntities getEntities(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      @PathParam("entityType") String entityType,
      @QueryParam("primaryFilter") String primaryFilter,
      @QueryParam("secondaryFilter") String secondaryFilter,
      @QueryParam("windowStart") String windowStart,
      @QueryParam("windowEnd") String windowEnd,
      @QueryParam("fromId") String fromId,
      @QueryParam("fromTs") String fromTs,
      @QueryParam("limit") String limit,
      @QueryParam("fields") String fields); @GET @Path("/{entityType}/{entityId}") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelineEntity getEntity(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      @PathParam("entityType") String entityType,
      @PathParam("entityId") String entityId,
      @QueryParam("fields") String fields); @GET @Path("/{entityType}/events") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelineEvents getEvents(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      @PathParam("entityType") String entityType,
      @QueryParam("entityId") String entityId,
      @QueryParam("eventType") String eventType,
      @QueryParam("windowStart") String windowStart,
      @QueryParam("windowEnd") String windowEnd,
      @QueryParam("limit") String limit); @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postEntities(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      TimelineEntities entities); }
TimelineWebServices { @GET @Produces({ MediaType.APPLICATION_JSON }) public AboutInfo about( @Context HttpServletRequest req, @Context HttpServletResponse res) { init(res); return new AboutInfo("Timeline API"); } @Inject  TimelineWebServices(TimelineDataManager timelineDataManager); @GET @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) AboutInfo about(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res); @GET @Path("/{entityType}") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelineEntities getEntities(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      @PathParam("entityType") String entityType,
      @QueryParam("primaryFilter") String primaryFilter,
      @QueryParam("secondaryFilter") String secondaryFilter,
      @QueryParam("windowStart") String windowStart,
      @QueryParam("windowEnd") String windowEnd,
      @QueryParam("fromId") String fromId,
      @QueryParam("fromTs") String fromTs,
      @QueryParam("limit") String limit,
      @QueryParam("fields") String fields); @GET @Path("/{entityType}/{entityId}") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelineEntity getEntity(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      @PathParam("entityType") String entityType,
      @PathParam("entityId") String entityId,
      @QueryParam("fields") String fields); @GET @Path("/{entityType}/events") @Produces({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelineEvents getEvents(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      @PathParam("entityType") String entityType,
      @QueryParam("entityId") String entityId,
      @QueryParam("eventType") String eventType,
      @QueryParam("windowStart") String windowStart,
      @QueryParam("windowEnd") String windowEnd,
      @QueryParam("limit") String limit); @POST @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) TimelinePutResponse postEntities(
      @Context HttpServletRequest req,
      @Context HttpServletResponse res,
      TimelineEntities entities);  }