@RequestMapping( value = DELETE_REFERENCE_REQUEST, method = {RequestMethod.POST}) public void deleteReference( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "api", required = false) boolean api) throws IOException { if (apiRequested(response, api, DELETE_REFERENCE_REQUEST)) return; com.c9a.buffers.CatalogServiceRequestProtocalBuffer.DeleteReferenceRequest deleteReferenceRequest = com.c9a.buffers.CatalogServiceRequestProtocalBuffer.DeleteReferenceRequest.parseFrom( GoogleProtoclBufferRequestContentUtils.getContentForRequest(request)); try { catalogService.deleteReferenceFromCollection( deleteReferenceRequest.getUserId(), deleteReferenceRequest.getPartitionId(), deleteReferenceRequest.getReferenceUniqueId(), false); CatalogGPBUtils.generateResponseProtoBuf( com.c9a.buffers.CatalogServiceResponseProtocalBuffer.ResponseCode.SUCCESS, "") .build() .writeTo(response.getOutputStream()); return; } catch (CollectionModificationException e) { CatalogGPBUtils.generateResponseProtoBuf( com.c9a.buffers.CatalogServiceResponseProtocalBuffer.ResponseCode .COLLECTION_CAN_NOT_BE_MODIFIED, "You do not have the needed permissions to modify the collection that holds this reference.") .build() .writeTo(response.getOutputStream()); return; } catch (ReferenceNotFoundException e) { CatalogGPBUtils.generateResponseProtoBuf( com.c9a.buffers.CatalogServiceResponseProtocalBuffer.ResponseCode.REFERENCE_NOT_FOUND, "The reference can not be found with unique id : " + deleteReferenceRequest.getReferenceUniqueId()) .build() .writeTo(response.getOutputStream()); return; } }