Пример #1
0
 @GET
 @Path("{name}/version/{version}")
 public Response getCollectionVersion(
     @PathParam("uuid") String uuid,
     @PathParam("name") String collName,
     @PathParam("version") String collVersion,
     @CookieParam(COOKIENAME) Cookie authCookie,
     @Context UriInfo uri) {
   checkAuthCookie(authCookie);
   ItemProxy item = getProxy(uuid);
   try {
     return toJSON(
         makeCollectionData(
             item.getCollection(
                 collName, collVersion.equals("last") ? null : Integer.valueOf(collVersion)),
             uri));
   } catch (ObjectNotFoundException e) {
     throw ItemUtils.createWebAppException(e.getMessage(), Response.Status.NOT_FOUND);
   } catch (NumberFormatException e) {
     throw ItemUtils.createWebAppException(e.getMessage(), Response.Status.NOT_FOUND);
   }
 }
Пример #2
0
 @GET
 @Path("{name}")
 @Produces(MediaType.APPLICATION_JSON)
 public Response getLastCollection(
     @PathParam("uuid") String uuid,
     @PathParam("name") String collName,
     @CookieParam(COOKIENAME) Cookie authCookie,
     @Context UriInfo uri) {
   checkAuthCookie(authCookie);
   ItemProxy item = getProxy(uuid);
   try {
     return toJSON(makeCollectionData(item.getCollection(collName), uri));
   } catch (ObjectNotFoundException e) {
     throw ItemUtils.createWebAppException(e.getMessage(), Response.Status.NOT_FOUND);
   }
 }