Esempio n. 1
0
 @GET
 @javax.ws.rs.Path("/random")
 @Produces(MediaType.TEXT_PLAIN)
 public String getRandom(@Context HttpServletRequest request) throws IOException {
   Photos photos = Photos.getInstance();
   List<Photo> singleton = photos.getRandomSlice(0, 1);
   return photos.toURL(request, singleton.get(0).getImage());
 }
Esempio n. 2
0
 @GET
 @javax.ws.rs.Path("/random/page/{page}/count/{count}")
 @Produces(MediaType.APPLICATION_JSON)
 public List<Photo> getRandomSlice(
     @PathParam("page") Integer page, @PathParam("count") Integer count) throws IOException {
   Photos photos = Photos.getInstance();
   return photos.getRandomSlice(page, count);
 }