다음을 통해 공유


Replication and the COPY Method

Topic Last Modified: 2006-06-12

A client can use the COPY Method to copy an existing resource. The COPY Method in the context of WebDAV replication is used to upload a copy change for a particular resource. The server might not return the resourcetag as a result of the execution of a COPY Method operation, and it is the client's responsibility to fetch the resourcetag of the resources at the destination.

COPY method with version checking

Usually, the client wants to verify that the correct version of a resource is being copied. If the client has previously downloaded content or properties of a resource, the server returned the resourcetag of that particular resource. Under these circumstances, the client can include the resourcetag in the request If Header of a COPY Method in the form of:

If: (<resourcetag>) or If: (<repl-uid>)

The If: (<resourcetag>) or If: (<repl-uid>) condition will evaluate to FALSE, thus cancelling the copy, if the specified resourcetag or the repl-uid doesn't match the resourcetag or the repl-uid of the resource.

COPY method with server-side modifications

Sometimes the COPY Method can trigger an action on the server that results in a successful overwrite from the client perspective, but modifications or transformations on the server resulting in content and/or properties mismatch between the client and server.

In this case, the status code 210 Content Different is returned. The response should also include information about what was affected during the execution of the COPY Method on the server.

To resolve this mismatch problem, the client may need to re-fetch the contents and/or properties of the affected resource using the GET method or PROPFIND Method.

COPY Method to prevent inadvertent overwrite of an existing resource

The client may want to check if the resource it is intending to copy already exists at the destination and, if so, may not want to overwrite the existing contents. In this case, the client should include the following request Overwrite Header in the COPY Method request so as to avoid overwriting an existing resource:

Overwrite: F

COPY method with client-initiated conflict detection

The client should include the If: (<resourcetag>) or If: (<repl-uid>) request header in the COPY Method request for a source collection, source non- collection resource, or destination collection. The resource on the server will only be copied if the version matches. If the condition fails, the server returns a 412 Precondition Failed error code.