public Response delete ( Session session , String path , String lockTokenHeader ) { try { if ( lockTokenHeader == null ) { lockTokenHeader = "" ; } Item item = session . getItem ( path ) ; if ( item . isNode ( ) ) { Node node = ( Node ) item ; if ( node . isLocked ( ) ) { String nodeLockToken = node . getLock ( ) . getLockToken ( ) ; if ( ( nodeLockToken == null ) || ( ! nodeLockToken . equals ( lockTokenHeader ) ) ) { return Response . status ( HTTPStatus . LOCKED ) . entity ( "The " + path + " item is locked. " ) . type ( MediaType . TEXT_PLAIN ) . build ( ) ; } } } item . remove ( ) ; session . save ( ) ; return Response . status ( HTTPStatus . NO_CONTENT ) . build ( ) ; } catch ( PathNotFoundException exc ) { return Response . status ( HTTPStatus . NOT_FOUND ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( RepositoryException exc ) { return Response . status ( HTTPStatus . FORBIDDEN ) . entity ( exc . getMessage ( ) ) . build ( ) ; } }
Webdav Delete method implementation .