code: @DELETE
      @Path("{token: .*}")
      public Response unregisterInstallations(
              @PathParam("token") String token,
              @Context HttpServletRequest request) {
  
          // find the matching variation:
          final Variant variant = loadVariantWhenAuthorized(request);
          if (variant == null) {
              return create401Response(request);
          }
  
          // look up all installations (with same token) for the given variant:
          Installation installation =
                  clientInstallationService.findInstallationForVariantByDeviceToken(variant.getVariantID(), token);
  
          if (installation == null) {
              return appendAllowOriginHeader(Response.status(Status.NOT_FOUND), request);
          }
  
          logger.info("Deleting metadata Installation");
          // remove
          clientInstallationService.removeInstallation(installation);
  
          return appendAllowOriginHeader(Response.noContent(), request);
      }
docs: RESTful API for Device unregistration.
  The Endpoint is protected using <code>HTTP Basic</code> (credentials <code>VariantID:secret</code>).
  
  <pre>
  curl -u "variantID:secret"
  -v -H "Accept: application/json" -H "Content-type: application/json"
  -X DELETE
  https://SERVER:PORT/context/rest/registry/device/{token}
  </pre>
  
  @param token device token
  @param request the request
  @return empty json
  
  @responseheader Access-Control-Allow-Origin      With host in your "Origin" header
  @responseheader Access-Control-Allow-Credentials true
  @responseheader WWW-Authenticate Basic realm="AeroGear UnifiedPush Server" (only for 401 response)
  
  @statuscode 204 Successful unregistration
  @statuscode 401 The request requires authentication
  @statuscode 404 The requested device metadata does not exist