private Message handleRequestWithIfMatch(Request request) throws IOException {
    final Path path = Path.fromString(request.uri().getPath());
    final Resource resource = resolveResource(path);

    final String ifMatch = getOnlyElement(request.headers().get(Header.IF_MATCH));

    if (ifMatch.equals("*") || !ifMatch.equals(resource.etag())) {
      return handleRequestWithoutIfMatch(request);
    } else {
      return Response.clientErrorPreconditionFailed();
    }
  }
  @MOVE
  public Message move(
      @PathTranslated Path path, @Destination URI destinationUri, @Overwrite boolean overwrite)
      throws IOException {
    final Resource source = resolveResource(path);

    final Resource destination = resolveResource(Path.fromString(destinationUri.getPath()));

    if (destination.isLocked()) {
      return Response.clientErrorLocked();
    }

    if (source.exists()) {
      if (source.isCollection()) { // source exists
        if (destination.exists()) { // source exists and is a collection
          if (destination.isCollection()) {
            return (overwrite
                ? moveCollectionToCollection(source, destination, overwrite)
                : Response.clientErrorPreconditionFailed());
          } else {
            return (overwrite
                ? moveCollectionToResource(source, destination, overwrite)
                : Response.clientErrorPreconditionFailed());
          }
        } else {
          return (destination.parent().exists()
              ? moveCollectionToCollection(source, destination, false)
              : Response.clientErrorPreconditionFailed());
        }
      } else {
        if (destination.exists()) { // source exists
          if (destination.isCollection()) { // source exists,
            return (overwrite
                ? moveResourceToCollection(source, destination, overwrite)
                : Response.clientErrorPreconditionFailed());
          } else {
            return (overwrite
                ? moveResourceToResource(source, destination, overwrite)
                : Response.clientErrorPreconditionFailed());
          }
        } else {
          if (destination.parent().exists()) {
            return (overwrite
                ? Response.clientErrorPreconditionFailed()
                : moveResourceToCollection(source, destination, overwrite));
          } else {
            return clientErrorConflict();
          }
        }
      }
    } else {
      return clientErrorNotFound();
    }
  }