use of gov.usgs.cida.coastalhazards.jpa.ThumbnailManager in project coastal-hazards by USGS-CIDA.
the class ThumbnailResource method putImage.
@RolesAllowed({ CoastalHazardsTokenBasedSecurityFilter.CCH_ADMIN_ROLE })
@PUT
@Path("/item/{id}")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
public Response putImage(@PathParam("id") String id, String content, @Context HttpServletRequest request) {
Response response = null;
Thumbnail thumb = new Thumbnail();
thumb.setItemId(id);
thumb.setImage(content);
thumb.setDirty(false);
try (ThumbnailManager manager = new ThumbnailManager()) {
response = Response.ok(manager.save(thumb), MediaType.APPLICATION_JSON_TYPE).build();
manager.updateDirtyBits(id);
}
return response;
}
Aggregations