public function httpPost(RequestInterface $request, ResponseInterface $response)
    {
        $path = $request->getPath();
        $contentType = $request->getHeader('Content-Type');
        if (null === $contentType) {
            return;
        }

        // We're only interested in the davsharing content type.
        if (false === strpos($contentType, 'application/davsharing+xml')) {
            return;
        }

        $message = $this->server->xml->parse(
            $request->getBody(),
            $request->getUrl(),
            $documentType
        );

        switch ($documentType) {
            case '{DAV:}share-resource':

                $this->shareResource($path, $message->sharees);
                $response->setStatus(200);
                // Adding this because sending a response body may cause issues,
                // and I wanted some type of indicator the response was handled.
                $response->setHeader('X-Sabre-Status', 'everything-went-well');

                // Breaking the event chain
                return false;

            default:
                throw new BadRequest('Unexpected document type: '.$documentType.' for this Content-Type');
        }
    }
public function httpPost(RequestInterface $request, ResponseInterface $response)
    {
        $path = $request->getPath();
        $contentType = $request->getHeader('Content-Type');
        if (null === $contentType) {
            return;
        }

        // We're only interested in the davsharing content type.
        if (false === strpos($contentType, 'application/davsharing+xml')) {
            return;
        }

        $message = $this->server->xml->parse(
            $request->getBody(),
            $request->getUrl(),
            $documentType
        );

        switch ($documentType) {
            case '{DAV:}share-resource':

                $this->shareResource($path, $message->sharees);
                $response->setStatus(200);
                // Adding this because sending a response body may cause issues,
                // and I wanted some type of indicator the response was handled.
                $response->setHeader('X-Sabre-Status', 'everything-went-well');

                // Breaking the event chain
                return false;

            default:
                throw new BadRequest('Unexpected document type: '.$documentType.' for this Content-Type');
        }
    }
public function httpPost ( RequestInterface $ request , ResponseInterface $ response ) { $ path = $ request -> getPath ( ) ; $ contentType = $ request -> getHeader ( 'Content-Type' ) ; if ( null === $ contentType ) { return ; } // We're only interested in the davsharing content type. if ( false === strpos ( $ contentType , 'application/davsharing+xml' ) ) { return ; } $ message = $ this -> server -> xml -> parse ( $ request -> getBody ( ) , $ request -> getUrl ( ) , $ documentType ) ; switch ( $ documentType ) { case '{DAV:}share-resource' : $ this -> shareResource ( $ path , $ message -> sharees ) ; $ response -> setStatus ( 200 ) ; // Adding this because sending a response body may cause issues, // and I wanted some type of indicator the response was handled. $ response -> setHeader ( 'X-Sabre-Status' , 'everything-went-well' ) ; // Breaking the event chain return false ; default : throw new BadRequest ( 'Unexpected document type: ' . $ documentType . ' for this Content-Type' ) ; } }
We intercept this to handle POST requests on shared resources.

@param RequestInterface  $request
@param ResponseInterface $response

@return bool|null
We intercept this to handle POST requests on shared resources .