public Response mkCol ( Session session , String path , String nodeType , List < String > mixinTypes , List < String > tokens ) { Node node ; try { nullResourceLocks . checkLock ( session , path , tokens ) ; node = session . getRootNode ( ) . addNode ( TextUtil . relativizePath ( path ) , nodeType ) ; // We set the new path path = node . getPath ( ) ; if ( mixinTypes != null ) { addMixins ( node , mixinTypes ) ; } session . save ( ) ; } catch ( ItemExistsException exc ) { return Response . status ( HTTPStatus . METHOD_NOT_ALLOWED ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( PathNotFoundException exc ) { return Response . status ( HTTPStatus . CONFLICT ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( AccessDeniedException exc ) { return Response . status ( HTTPStatus . FORBIDDEN ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( LockException exc ) { return Response . status ( HTTPStatus . LOCKED ) . entity ( exc . getMessage ( ) ) . build ( ) ; } catch ( RepositoryException exc ) { log . error ( exc . getMessage ( ) , exc ) ; return Response . serverError ( ) . entity ( exc . getMessage ( ) ) . build ( ) ; } if ( uriBuilder != null ) { return Response . created ( uriBuilder . path ( session . getWorkspace ( ) . getName ( ) ) . path ( path ) . build ( ) ) . build ( ) ; } // to save compatibility if uriBuilder is not provided return Response . status ( HTTPStatus . CREATED ) . build ( ) ; }
Webdav Mkcol method implementation .