@DELETE
    @Produces({MediaType.TEXT_HTML, "application/json"})
    @ApiOperation(value = "Delete all the registered services",
            notes = "BE CAREFUL! You can lose all your data. It returns a message which confirms all the service deletions.")
    @ApiResponses(
            value = {
                    @ApiResponse(code = 200, message = "Registry cleaned. All the services are deleted."),
                    @ApiResponse(code = 304, message = "The services could not be cleared."),
                    @ApiResponse(code = 403, message = "You have not got the appropriate permissions for clearing the services"),
                    @ApiResponse(code = 500, message = "Internal error")})
    public Response clearServices(
            @ApiParam(value = "Response message media type", allowableValues = "application/json,text/html")
            @HeaderParam("Accept") String accept) {

        // Check first that the user is allowed to upload a service
//        Subject currentUser = SecurityUtils.getSubject();
//        if (!currentUser.isPermitted("services:delete")) {
//            log.warn("User without the appropriate permissions attempted to clear the services: " + currentUser.getPrincipal());
//
//            String htmlString = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" +
//                    "  <body>\n You have not got the appropriate permissions for clearing the services. Please login and ensure you have the correct permissions. </body>\n</html>";
//
//            return Response.status(Response.Status.FORBIDDEN).entity(htmlString).build();
//        }

        URI serviceUri = uriInfo.getRequestUri();

        String response;
        try {
            if (manager.getServiceManager().clearServices()) {
                // The registry was cleared
                if (accept.contains(MediaType.TEXT_HTML)) {
                    response = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" +
                            "  <body>\n The services have been cleared.\n  </body>\n</html>";
                } else {
                    JsonObject message = new JsonObject();
                    message.add("message", new JsonPrimitive("The services have been cleared."));
                    response = message.toString();
                }
                return Response.status(Status.OK).contentLocation(serviceUri).entity(response).build();
            } else {
                // The registry was not cleared
                if (accept.contains(MediaType.TEXT_HTML)) {
                response = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" +
                        "  <body>\n The services could not be cleared. Try again or contact a server administrator.\n  </body>\n</html>";
                } else {
                    JsonObject message = new JsonObject();
                    message.add("message", new JsonPrimitive("The services could not be cleared. Try again or contact a server administrator."));
                    response = message.toString();
                }
                return Response.status(Status.NOT_MODIFIED).contentLocation(serviceUri).entity(response).build();
            }
        } catch (SalException e) {
            if (accept.contains(MediaType.TEXT_HTML)) {
                response = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" +
                        "<body>\nThere was an error while clearing the services. Contact the system administrator. \n  </body>\n</html>";
            } else {
                JsonObject message = new JsonObject();
                message.add("message", new JsonPrimitive("There was an error while clearing the services. Contact the system administrator."));
                response = message.toString();
            }
            // TODO: Add logging
            log.error("SAL Exception while deleting service", e);
            return Response.status(Status.INTERNAL_SERVER_ERROR).entity(response).build();
        }

    }
@ DELETE @ Produces ( { MediaType . TEXT_HTML , "application/json" } ) @ ApiOperation ( value = "Delete all the registered services" , notes = "BE CAREFUL! You can lose all your data. It returns a message which confirms all the service deletions." ) @ ApiResponses ( value = { @ ApiResponse ( code = 200 , message = "Registry cleaned. All the services are deleted." ) , @ ApiResponse ( code = 304 , message = "The services could not be cleared." ) , @ ApiResponse ( code = 403 , message = "You have not got the appropriate permissions for clearing the services" ) , @ ApiResponse ( code = 500 , message = "Internal error" ) } ) public Response clearServices ( @ ApiParam ( value = "Response message media type" , allowableValues = "application/json,text/html" ) @ HeaderParam ( "Accept" ) String accept ) { URI serviceUri = uriInfo . getRequestUri ( ) ; String response ; try { if ( manager . getServiceManager ( ) . clearServices ( ) ) { if ( accept . contains ( MediaType . TEXT_HTML ) ) { response = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" + "  <body>\n The services have been cleared.\n  </body>\n</html>" ; } else { JsonObject message = new JsonObject ( ) ; message . add ( "message" , new JsonPrimitive ( "The services have been cleared." ) ) ; response = message . toString ( ) ; } return Response . status ( Status . OK ) . contentLocation ( serviceUri ) . entity ( response ) . build ( ) ; } else { if ( accept . contains ( MediaType . TEXT_HTML ) ) { response = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" + "  <body>\n The services could not be cleared. Try again or contact a server administrator.\n  </body>\n</html>" ; } else { JsonObject message = new JsonObject ( ) ; message . add ( "message" , new JsonPrimitive ( "The services could not be cleared. Try again or contact a server administrator." ) ) ; response = message . toString ( ) ; } return Response . status ( Status . NOT_MODIFIED ) . contentLocation ( serviceUri ) . entity ( response ) . build ( ) ; } } catch ( SalException e ) { if ( accept . contains ( MediaType . TEXT_HTML ) ) { response = "<html>\n  <head>\n    <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n  </head>\n" + "<body>\nThere was an error while clearing the services. Contact the system administrator. \n  </body>\n</html>" ; } else { JsonObject message = new JsonObject ( ) ; message . add ( "message" , new JsonPrimitive ( "There was an error while clearing the services. Contact the system administrator." ) ) ; response = message . toString ( ) ; } log . error ( "SAL Exception while deleting service" , e ) ; return Response . status ( Status . INTERNAL_SERVER_ERROR ) . entity ( response ) . build ( ) ; } }
Clears the services registry

From HTTP Method definition
9.7 DELETE
A successful response SHOULD be
200 (OK) if the response includes an entity describing the status,
202 (Accepted) if the action has not yet been enacted, or
204 (No Content) if the action has been enacted but the response does not include an entity.

@return