public Response move ( Session session , String srcPath , String destPath ) { try { session . move ( srcPath , destPath ) ; session . save ( ) ; // If the source resource was successfully moved // to a pre-existing destination resource. if ( itemExisted ) { return Response . status ( HTTPStatus . NO_CONTENT ) . cacheControl ( cacheControl ) . build ( ) ; } // If the source resource was successfully moved, // and a new resource was created at the destination. else { if ( uriBuilder != null ) { return Response . created ( uriBuilder . path ( session . getWorkspace ( ) . getName ( ) ) . path ( destPath ) . build ( ) ) . cacheControl ( cacheControl ) . build ( ) ; } // to save compatibility if uriBuilder is not provided return Response . status ( HTTPStatus . CREATED ) . cacheControl ( cacheControl ) . build ( ) ; } } catch ( LockException exc ) { return Response . status ( HTTPStatus . LOCKED ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( PathNotFoundException exc ) { return Response . status ( HTTPStatus . CONFLICT ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( RepositoryException exc ) { log . error ( exc . getMessage ( ) , exc ) ; return Response . serverError ( ) . entity ( exc . getMessage ( ) ) . build ( ) ; } }
Webdav Move method implementation .